Skip to content

Commit

Permalink
1.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
olikraus committed Apr 5, 2016
1 parent 178d5fd commit 5e04f7e
Show file tree
Hide file tree
Showing 21 changed files with 252 additions and 794 deletions.
2 changes: 1 addition & 1 deletion examples/GraphicsTest/GraphicsTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
Expand Down
8 changes: 5 additions & 3 deletions examples/HelloWorld/HelloWorld.ino
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
Expand Down Expand Up @@ -168,6 +168,8 @@ void setup(void) {
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255,255,255);
}

pinMode(8, OUTPUT);
}

void loop(void) {
Expand All @@ -178,6 +180,6 @@ void loop(void) {
} while( u8g.nextPage() );

// rebuild the picture after some delay
delay(50);
//delay(50);
}

4 changes: 3 additions & 1 deletion extras/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ u8glib ChangeLog
* Fixed bug in u8g_DrawLine(), Github issue 343
* Fixed bug in u8g_DrawStr90P(), Github issue 331
* Support for SSD1306 with 64x48 pixel
2016-04-05 v1.19
* Fixed contrast (brightness) setting for SH1106 and SSD1306 devices
* Fixed compiler warnings




2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=U8glib
version=1.18.1
version=1.19.0
author=oliver <[email protected]>
maintainer=oliver <[email protected]>
sentence=A library for monochrome TFTs and OLEDs
Expand Down
50 changes: 42 additions & 8 deletions src/clib/u8g.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ extern "C" {
# if defined(__MSPGCC__)
/* mspgcc does not have .progmem sections. Use -fdata-sections. */
# define U8G_FONT_SECTION(name)
# endif
# endif
# if defined(__AVR__)
# define U8G_FONT_SECTION(name) U8G_SECTION(".progmem." name)
# endif
# if defined(__XTENSA__)
//# define U8G_FONT_SECTION(name) U8G_SECTION(".irom.text." name)
# define U8G_FONT_SECTION(name) U8G_SECTION(".irom0.text" )
# endif
#else
# define U8G_NOINLINE
# define U8G_PURE
Expand Down Expand Up @@ -120,16 +124,26 @@ typedef uint8_t PROGMEM u8g_pgm_uint8_t;
typedef uint8_t u8g_fntpgm_uint8_t;
#define u8g_pgm_read(adr) pgm_read_byte_near(adr)
#define U8G_PSTR(s) ((u8g_pgm_uint8_t *)PSTR(s))
#endif

#else

#define U8G_PROGMEM
#define PROGMEM
#if defined(__XTENSA__)
# ifndef PROGMEM
# define PROGMEM __attribute__ ((section (".irom0.text")))
# endif
# define U8G_PROGMEM PROGMEM
typedef uint8_t u8g_pgm_uint8_t;
typedef uint8_t u8g_fntpgm_uint8_t;
#define u8g_pgm_read(adr) (*(const u8g_pgm_uint8_t *)(adr))
#define U8G_PSTR(s) ((u8g_pgm_uint8_t *)(s))
# define u8g_pgm_read(adr) (*(const u8g_pgm_uint8_t *)(adr))
# define U8G_PSTR(s) ((u8g_pgm_uint8_t *)(s))
#endif

#ifndef U8G_PROGMEM
# define U8G_PROGMEM
# define PROGMEM
typedef uint8_t u8g_pgm_uint8_t;
typedef uint8_t u8g_fntpgm_uint8_t;
# define u8g_pgm_read(adr) (*(const u8g_pgm_uint8_t *)(adr))
# define U8G_PSTR(s) ((u8g_pgm_uint8_t *)(s))
#endif

/*===============================================================*/
Expand Down Expand Up @@ -401,6 +415,7 @@ extern u8g_dev_t u8g_dev_ssd1325_nhd27oled_bw_hw_spi;
extern u8g_dev_t u8g_dev_ssd1325_nhd27oled_bw_parallel;
extern u8g_dev_t u8g_dev_ssd1325_nhd27oled_gr_sw_spi;
extern u8g_dev_t u8g_dev_ssd1325_nhd27oled_gr_hw_spi;
extern u8g_dev_t u8g_dev_ssd1325_nhd27oled_gr_parallel;

extern u8g_dev_t u8g_dev_ssd1325_nhd27oled_2x_bw_sw_spi;
extern u8g_dev_t u8g_dev_ssd1325_nhd27oled_2x_bw_hw_spi;
Expand Down Expand Up @@ -684,11 +699,18 @@ uint8_t u8g_com_atmega_st7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val
uint8_t u8g_com_atmega_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_atmega_parallel_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_atmega_parallel.c */

uint8_t u8g_com_atxmega_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_atxmega_hw_spi.c */
uint8_t u8g_com_atxmega_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_atxmega_st7920_spi.c */

uint8_t u8g_com_msp430_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_msp430_hw_spi.c */

uint8_t u8g_com_raspberrypi_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_rasperrypi_hw_spi.c */
uint8_t u8g_com_raspberrypi_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_raspberrypi_ssd_i2c.c */

uint8_t u8g_com_linux_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_linux_ssd_i2c.c */

uint8_t u8g_com_psoc5_ssd_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_psoc5_ssd_hw_spi.c */
uint8_t u8g_com_psoc5_ssd_hw_parallel_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_psoc5_ssd_hw_parallel.c */

/*
Translation of system specific com drives to generic com names
Expand Down Expand Up @@ -747,7 +769,10 @@ defined(__18CXX) || defined(__PIC32MX)
#endif
/* ==== HW SPI, not Arduino ====*/
#ifndef U8G_COM_HW_SPI
#if defined(__AVR__)
#if defined(__AVR_XMEGA__)
#define U8G_COM_HW_SPI u8g_com_atxmega_hw_spi_fn
#define U8G_COM_ST7920_HW_SPI u8g_com_atxmega_st7920_hw_spi_fn
#elif defined(__AVR__)
#define U8G_COM_HW_SPI u8g_com_atmega_hw_spi_fn
#define U8G_COM_ST7920_HW_SPI u8g_com_atmega_st7920_hw_spi_fn
#endif
Expand Down Expand Up @@ -842,6 +867,15 @@ defined(__18CXX) || defined(__PIC32MX)
#define U8G_COM_SSD_I2C u8g_com_raspberrypi_ssd_i2c_fn
#endif
#endif
#ifndef U8G_COM_SSD_I2C
#if defined(U8G_LINUX)
#define U8G_COM_SSD_I2C u8g_com_linux_ssd_i2c_fn
#endif
#endif
#if defined(U8G_CYPRESS_PSOC5)
#define U8G_COM_HW_SPI u8g_com_psoc5_ssd_hw_spi_fn
#define U8G_COM_FAST_PARALLEL u8g_com_psoc5_ssd_hw_parallel_fn
#endif

#ifndef U8G_COM_SSD_I2C
#define U8G_COM_SSD_I2C u8g_com_null_fn
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_clip.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#define U8G_ALWAYS_INLINE __inline__ __attribute__((always_inline))
#else
#define U8G_ALWAYS_INLINE
#endif
#endif

/*
intersection assumptions:
Expand Down
4 changes: 2 additions & 2 deletions src/clib/u8g_com_atmega_hw_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@

#include "u8g.h"


#if defined(__AVR__)
#if defined(__AVR_XMEGA__)
#elif defined(__AVR__)
#define U8G_ATMEGA_HW_SPI

/* remove the definition for attiny */
Expand Down
3 changes: 2 additions & 1 deletion src/clib/u8g_com_atmega_st7920_hw_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@

#include "u8g.h"

#if defined(__AVR__)
#if defined(__AVR_XMEGA__)
#elif defined(__AVR__)
#define U8G_ATMEGA_HW_SPI

/* remove the definition for attiny */
Expand Down
4 changes: 2 additions & 2 deletions src/clib/u8g_com_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ uint8_t u8g_i2c_get_err_pos(void)
}



#if defined(__AVR__)
#if defined(__AVR_XMEGA__)
#elif defined(__AVR__)

static void u8g_i2c_set_error(uint8_t code, uint8_t pos)
{
Expand Down
78 changes: 78 additions & 0 deletions src/clib/u8g_com_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,83 @@ uint8_t u8g_Pin(uint8_t port, uint8_t bitpos)
return port;
}

#if defined(__AVR_XMEGA__)

const IO_PTR u8g_avr_ddr_P[] PROGMEM = {
#ifdef PORTA
&PORTA.DIR,
#else
0,
#endif
&PORTB.DIR,
#ifdef PORTC
&PORTC.DIR,
#ifdef PORTD
&PORTD.DIR,
#ifdef PORTE
&PORTE.DIR,
#ifdef PORTF
&PORTF.DIR,
#ifdef PORTR
&PORTR.DIR,
#endif
#endif
#endif
#endif
#endif
};


const IO_PTR u8g_avr_port_P[] PROGMEM = {
#ifdef PORTA
&PORTA.OUT,
#else
0,
#endif
&PORTB.OUT,
#ifdef PORTC
&PORTC.OUT,
#ifdef PORTD
&PORTD.OUT,
#ifdef PORTE
&PORTE.OUT,
#ifdef PORTF
&PORTF.OUT,
#ifdef PORTR
&PORTR.OUT,
#endif
#endif
#endif
#endif
#endif
};

const IO_PTR u8g_avr_pin_P[] PROGMEM = {
#ifdef PORTA
&PORTA.IN,
#else
0,
#endif
&PORTB.IN,
#ifdef PORTC
&PORTC.IN,
#ifdef PORTD
&PORTD.IN,
#ifdef PORTE
&PORTE.IN,
#ifdef PORTF
&PORTF.IN,
#ifdef PORTR
&PORTR.IN,
#endif
#endif
#endif
#endif
#endif
};


#else
const IO_PTR u8g_avr_ddr_P[] PROGMEM = {
#ifdef DDRA
&DDRA,
Expand Down Expand Up @@ -146,6 +223,7 @@ const IO_PTR u8g_avr_pin_P[] PROGMEM = {
#endif
#endif
};
#endif

static volatile uint8_t *u8g_get_avr_io_ptr(const IO_PTR *base, uint8_t offset)
{
Expand Down
13 changes: 13 additions & 0 deletions src/clib/u8g_delay.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
# include <Arduino.h>
# endif

/* issue 353 */
#if defined(ARDUINO_ARCH_SAMD)
# include <delay.h>
#endif

# if defined(__AVR__)
# define USE_AVR_DELAY
# elif defined(__PIC32MX)
Expand All @@ -71,6 +76,8 @@
# define USE_AVR_DELAY
#elif defined(__18CXX)
# define USE_PIC18_DELAY
#elif defined(U8G_CYPRESS_PSOC5)
#define USE_PSOC5_DELAY
#elif defined(__arm__)
/* do not define anything, all procedures are expected to be defined outside u8glib */

Expand Down Expand Up @@ -293,6 +300,12 @@ void u8g_10MicroDelay(void)
__delay_cycles(F_CPU/100000UL);
}
#endif
#if defined USE_PSOC5_DELAY
#include <project.h>
void u8g_Delay(uint16_t val) {CyDelay(val);};
void u8g_MicroDelay(void) {CyDelay(1);};
void u8g_10MicroDelay(void) {CyDelay(10);};
#endif


/*== Any other systems: Dummy Delay ==*/
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_dev_lc7981_160x80.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static const uint8_t u8g_dev_lc7981_160x80_init_seq[] PROGMEM = {
U8G_ESC_ADR(1), /* instruction mode */
0x003, /* time division */
U8G_ESC_ADR(0), /* data mode */
0x07f, /* */
0x050, /* Oct 2015: Changed from 7f to 50 (1/80 duty cycle) */

U8G_ESC_ADR(1), /* instruction mode */
0x008, /* display start low */
Expand Down
14 changes: 14 additions & 0 deletions src/clib/u8g_dev_ssd1306_128x32.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ uint8_t u8g_dev_ssd1306_128x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x081);
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* 11 Jul 2015: fixed contrast calculation */
u8g_SetChipSelect(u8g, dev, 0);
return 1;
case U8G_DEV_MSG_SLEEP_ON:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
return 1;
Expand Down Expand Up @@ -268,6 +275,13 @@ uint8_t u8g_dev_ssd1306_128x32_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x081);
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* 11 Jul 2015: fixed contrast calculation */
u8g_SetChipSelect(u8g, dev, 0);
return 1;
case U8G_DEV_MSG_SLEEP_ON:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
return 1;
Expand Down
Loading

0 comments on commit 5e04f7e

Please sign in to comment.