From 7e711b0bc7396f4c1690d89900f983db356d7d05 Mon Sep 17 00:00:00 2001 From: kraus Date: Sun, 25 Mar 2018 08:39:25 +0200 Subject: [PATCH] 2.22.7 --- README.md | 2 +- library.properties | 2 +- src/U8g2lib.h | 8 ++++---- src/U8x8lib.h | 17 +++++++++++++---- src/clib/u8x8_d_sh1106_72x40.c | 2 ++ 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ce986f6e..7f4b0db7 100644 --- a/README.md +++ b/README.md @@ -8,5 +8,5 @@ Description: https://github.com/olikraus/u8g2/wiki Issue Tracker: https://github.com/olikraus/u8g2/issues -Download (2.22.6): https://github.com/olikraus/U8g2_Arduino/archive/master.zip +Download (2.22.7): https://github.com/olikraus/U8g2_Arduino/archive/master.zip diff --git a/library.properties b/library.properties index d6ef0910..fac337e8 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=U8g2 -version=2.22.6 +version=2.22.7 author=oliver maintainer=oliver sentence=Monochrome LCD, OLED and eInk Library. Display controller: SSD1305, SSD1306, SSD1309, SSD1322, SSD1325, SSD1327, SSD1329, SSD1606, SSD1607, SH1106, SH1107, T6963, RA8835, LC7981, PCD8544, PCF8812, HX1230, UC1601, UC1604, UC1608, UC1610, UC1611, UC1701, ST7565, ST7567, ST7588, ST75256, NT7534, IST3020, ST7920, LD7032, KS0108, SED1520, SBN1661, IL3820, MAX7219. Interfaces: I2C, SPI, Parallel. diff --git a/src/U8g2lib.h b/src/U8g2lib.h index 7ccf4913..33f20da1 100644 --- a/src/U8g2lib.h +++ b/src/U8g2lib.h @@ -121,9 +121,9 @@ class U8G2 : public Print u8g2_SetDisplayRotation(&u8g2, u8g2_cb); } - void begin(void) { + bool begin(void) { /* note: call to u8x8_utf8_init is not required here, this is done in the setup procedures before */ - initDisplay(); clearDisplay(); setPowerSave(0); } + initDisplay(); clearDisplay(); setPowerSave(0); return 1;} void beginSimple(void) { /* does not clear the display and does not wake up the display */ @@ -132,14 +132,14 @@ class U8G2 : public Print #ifdef U8X8_USE_PINS /* use U8X8_PIN_NONE if a pin is not required */ - void begin(uint8_t menu_select_pin, uint8_t menu_next_pin, uint8_t menu_prev_pin, uint8_t menu_up_pin = U8X8_PIN_NONE, uint8_t menu_down_pin = U8X8_PIN_NONE, uint8_t menu_home_pin = U8X8_PIN_NONE) { + bool begin(uint8_t menu_select_pin, uint8_t menu_next_pin, uint8_t menu_prev_pin, uint8_t menu_up_pin = U8X8_PIN_NONE, uint8_t menu_down_pin = U8X8_PIN_NONE, uint8_t menu_home_pin = U8X8_PIN_NONE) { setMenuSelectPin(menu_select_pin); setMenuNextPin(menu_next_pin); setMenuPrevPin(menu_prev_pin); setMenuUpPin(menu_up_pin); setMenuDownPin(menu_down_pin); setMenuHomePin(menu_home_pin); - begin(); } + return begin(); } #endif /* u8g2 */ diff --git a/src/U8x8lib.h b/src/U8x8lib.h index f69b698f..acdf804c 100644 --- a/src/U8x8lib.h +++ b/src/U8x8lib.h @@ -191,19 +191,19 @@ class U8X8 : public Print void setPowerSave(uint8_t is_enable) { u8x8_SetPowerSave(&u8x8, is_enable); } - void begin(void) { - initDisplay(); clearDisplay(); setPowerSave(0); } + bool begin(void) { + initDisplay(); clearDisplay(); setPowerSave(0); return 1; } #ifdef U8X8_USE_PINS /* use U8X8_PIN_NONE if a pin is not required */ - void begin(uint8_t menu_select_pin, uint8_t menu_next_pin, uint8_t menu_prev_pin, uint8_t menu_up_pin = U8X8_PIN_NONE, uint8_t menu_down_pin = U8X8_PIN_NONE, uint8_t menu_home_pin = U8X8_PIN_NONE) { + bool begin(uint8_t menu_select_pin, uint8_t menu_next_pin, uint8_t menu_prev_pin, uint8_t menu_up_pin = U8X8_PIN_NONE, uint8_t menu_down_pin = U8X8_PIN_NONE, uint8_t menu_home_pin = U8X8_PIN_NONE) { setMenuSelectPin(menu_select_pin); setMenuNextPin(menu_next_pin); setMenuPrevPin(menu_prev_pin); setMenuUpPin(menu_up_pin); setMenuDownPin(menu_down_pin); setMenuHomePin(menu_home_pin); - begin(); } + return begin(); } #endif void setFlipMode(uint8_t mode) { @@ -230,6 +230,9 @@ class U8X8 : public Print void draw2x2Glyph(uint8_t x, uint8_t y, uint8_t encoding) { u8x8_Draw2x2Glyph(&u8x8, x, y, encoding); } + void draw1x2Glyph(uint8_t x, uint8_t y, uint8_t encoding) { + u8x8_Draw1x2Glyph(&u8x8, x, y, encoding); } + void drawString(uint8_t x, uint8_t y, const char *s) { u8x8_DrawString(&u8x8, x, y, s); } @@ -238,9 +241,15 @@ class U8X8 : public Print void draw2x2String(uint8_t x, uint8_t y, const char *s) { u8x8_Draw2x2String(&u8x8, x, y, s); } + + void draw1x2String(uint8_t x, uint8_t y, const char *s) { + u8x8_Draw1x2String(&u8x8, x, y, s); } void draw2x2UTF8(uint8_t x, uint8_t y, const char *s) { u8x8_Draw2x2UTF8(&u8x8, x, y, s); } + + void draw1x2UTF8(uint8_t x, uint8_t y, const char *s) { + u8x8_Draw1x2UTF8(&u8x8, x, y, s); } uint8_t getUTF8Len(const char *s) { return u8x8_GetUTF8Len(&u8x8, s); } diff --git a/src/clib/u8x8_d_sh1106_72x40.c b/src/clib/u8x8_d_sh1106_72x40.c index c69a12aa..f044c509 100644 --- a/src/clib/u8x8_d_sh1106_72x40.c +++ b/src/clib/u8x8_d_sh1106_72x40.c @@ -90,6 +90,7 @@ static const uint8_t u8x8_d_sh1106_72x40_flip0_seq[] = { U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ U8X8_C(0x0a1), /* segment remap a0/a1*/ U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ + U8X8_CA(0x0d3, 12), /* display offset, 0.42 OLED */ U8X8_END_TRANSFER(), /* disable chip */ U8X8_END() /* end of sequence */ }; @@ -98,6 +99,7 @@ static const uint8_t u8x8_d_sh1106_72x40_flip1_seq[] = { U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ U8X8_C(0x0a0), /* segment remap a0/a1*/ U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ + U8X8_CA(0x0d3, 24), /* What is the correct offset in flip 1 mode? */ U8X8_END_TRANSFER(), /* disable chip */ U8X8_END() /* end of sequence */ };