From 94ebfe23188001290c1d0bc3c0560bb074819b84 Mon Sep 17 00:00:00 2001 From: kraus Date: Sun, 4 Dec 2022 21:44:40 +0100 Subject: [PATCH] 2.34.6 --- README.md | 2 +- examples/page_buffer/FlipMode/FlipMode.ino | 7 ++- extras/ChangeLog | 4 +- library.properties | 2 +- src/U8x8lib.cpp | 5 ++ src/clib/mui.h | 2 + src/clib/u8x8.h | 1 + src/clib/u8x8_d_ssd1305.c | 64 ++++++++++++++++++++++ src/clib/u8x8_d_ssd1306_96x40.c | 2 +- 9 files changed, 82 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a8431f84..19b76eb0 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.34.5): https://github.com/olikraus/U8g2_Arduino/archive/master.zip +Download (2.34.6): https://github.com/olikraus/U8g2_Arduino/archive/master.zip diff --git a/examples/page_buffer/FlipMode/FlipMode.ino b/examples/page_buffer/FlipMode/FlipMode.ino index a858f3b7..b67a9a1f 100644 --- a/examples/page_buffer/FlipMode/FlipMode.ino +++ b/examples/page_buffer/FlipMode/FlipMode.ino @@ -89,7 +89,7 @@ //U8G2_SH1107_SEEED_96X96_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_SH1107_HJR_OEL1M0201_96X96_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_SH1107_TK078F288_80X128_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); -U8G2_SH1108_128X160_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); +//U8G2_SH1108_128X160_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_SH1108_160X160_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_SH1122_256X64_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Enable U8G2_16BIT in u8g2.h //U8G2_SH1122_256X64_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Enable U8G2_16BIT in u8g2.h @@ -348,11 +348,12 @@ void draw(const char *s) do { u8g2.drawStr(2,15,"Hello World!"); u8g2.drawStr(2,30,s); - u8g2.drawFrame(0,0,u8g2.getDisplayWidth(),u8g2.getDisplayHeight() ); u8g2.drawStr(2, 45, u8x8_u16toa(u8g2.getDisplayWidth(), 5)); u8g2.drawStr(2, 60, u8x8_u16toa(u8g2.getDisplayHeight(), 5)); - + + u8g2.drawFrame(0,0,u8g2.getDisplayWidth(),u8g2.getDisplayHeight() ); + } while ( u8g2.nextPage() ); delay(2000); } diff --git a/extras/ChangeLog b/extras/ChangeLog index e33a7a94..7ddfba8c 100644 --- a/extras/ChangeLog +++ b/extras/ChangeLog @@ -300,6 +300,8 @@ https://github.com/olikraus/u8g2 ChangeLog * Changed SPI mode for SH1106 from 3 to 0 (issue 1901) 2022-xx-xx v2.34.xx olikraus@gmail.com * SSD1327 ZJY M150 128x128 (issue 1960) - * SSD1316 96x32 (1938) + * SSD1316 96x32 (issue 1938) + * SH1108 128x160 (issue 1998) + * SSD1306 96x39 (issue 1959) \ No newline at end of file diff --git a/library.properties b/library.properties index 1078952d..d590c450 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=U8g2 -version=2.34.5 +version=2.34.6 author=oliver maintainer=oliver sentence=Monochrome LCD, OLED and eInk Library. Display controller: SSD1305, SSD1306, SSD1309, SSD1312, SSD1316, SSD1318, SSD1320, SSD1322, SSD1325, SSD1327, SSD1329, SSD1606, SSD1607, SH1106, SH1107, SH1108, SH1122, T6963, RA8835, LC7981, PCD8544, PCF8812, HX1230, UC1601, UC1604, UC1608, UC1610, UC1611, UC1617, UC1638, UC1701, ST7511, ST7528, ST7565, ST7567, ST7571, ST7586, ST7588, ST75160, ST75256, ST75320, NT7534, ST7920, IST3020, IST3088, IST7920, LD7032, KS0108, KS0713, HD44102, T7932, SED1520, SBN1661, IL3820, MAX7219, GP1287, GP1247, GU800. Interfaces: I2C, SPI, Parallel. diff --git a/src/U8x8lib.cpp b/src/U8x8lib.cpp index ac9e82c1..b26f955b 100644 --- a/src/U8x8lib.cpp +++ b/src/U8x8lib.cpp @@ -50,6 +50,11 @@ # include # else # include +# ifdef U8X8_HAVE_2ND_HW_I2C +# if defined(MINICORE) && defined(__AVR_ATmega328PB__) +# include +# endif +# endif # endif #endif /* U8X8_HAVE_HW_I2C */ diff --git a/src/clib/mui.h b/src/clib/mui.h index 15fa3a30..a878b7c1 100644 --- a/src/clib/mui.h +++ b/src/clib/mui.h @@ -219,7 +219,9 @@ struct muif_struct /* must be smaller than or equal to 255 */ +#ifndef MUI_MAX_TEXT_LEN #define MUI_MAX_TEXT_LEN 41 +#endif #define MUI_MENU_CACHE_CNT 2 diff --git a/src/clib/u8x8.h b/src/clib/u8x8.h index f5fb3d6c..ecd186a9 100644 --- a/src/clib/u8x8.h +++ b/src/clib/u8x8.h @@ -831,6 +831,7 @@ uint8_t u8x8_d_uc1701_ea_dogs102(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, voi uint8_t u8x8_d_uc1701_mini12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_d_ssd1305_128x32_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_d_ssd1305_128x32_adafruit(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); +/*uint8_t u8x8_d_ssd1305_128x32_waveshare(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);*/ uint8_t u8x8_d_ssd1305_128x64_adafruit(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_d_ssd1305_128x64_raystar(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_d_ssd1306_128x64_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); diff --git a/src/clib/u8x8_d_ssd1305.c b/src/clib/u8x8_d_ssd1305.c index 324b36db..d5e6f96e 100644 --- a/src/clib/u8x8_d_ssd1305.c +++ b/src/clib/u8x8_d_ssd1305.c @@ -224,6 +224,70 @@ uint8_t u8x8_d_ssd1305_128x32_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, return 1; } +/*================================================*/ +/* issue 2002: Waveshare */ + +#ifdef SAME_AS_ADAFRUIT +/* timing from SSD1306 */ +static const u8x8_display_info_t u8x8_ssd1305_128x32_waveshare_display_info = +{ + /* chip_enable_level = */ 0, + /* chip_disable_level = */ 1, + + /* post_chip_enable_wait_ns = */ 20, + /* pre_chip_disable_wait_ns = */ 10, + /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ + /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ + /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ + /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ + /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ + /* spi_mode = */ 0, /* active high, rising edge */ + /* i2c_bus_clock_100kHz = */ 4, + /* data_setup_time_ns = */ 40, + /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ + /* tile_width = */ 16, + /* tile_hight = */ 4, + /* default_x_offset = */ 4, + /* flipmode_x_offset = */ 0, + /* pixel_width = */ 128, + /* pixel_height = */ 32 +}; + +uint8_t u8x8_d_ssd1305_128x32_waveshare(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) +{ + + if ( u8x8_d_ssd1305_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) + return 1; + + switch(msg) + { + case U8X8_MSG_DISPLAY_SET_FLIP_MODE: + if ( arg_int == 0 ) + { + u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x32_flip0_seq); + u8x8->x_offset = u8x8->display_info->default_x_offset; + } + else + { + u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x32_flip1_seq); + u8x8->x_offset = u8x8->display_info->flipmode_x_offset; + } + break; + case U8X8_MSG_DISPLAY_INIT: + u8x8_d_helper_display_init(u8x8); + u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x32_noname_init_seq); + break; + case U8X8_MSG_DISPLAY_SETUP_MEMORY: + u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1305_128x32_waveshare_display_info); + break; + default: + return 0; + } + return 1; +} +#endif + + /*================================================*/ /* adafruit 128x32 SSD1305 OLED, https://www.adafruit.com/product/2675 */ /* issue 724 */ diff --git a/src/clib/u8x8_d_ssd1306_96x40.c b/src/clib/u8x8_d_ssd1306_96x40.c index a506fe10..95b1bea0 100644 --- a/src/clib/u8x8_d_ssd1306_96x40.c +++ b/src/clib/u8x8_d_ssd1306_96x40.c @@ -256,7 +256,7 @@ static const uint8_t u8x8_d_ssd1306_96x39_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_C(0x041), /* set display start line to 1 */ + U8X8_C(0x07f), /* set display start line to -1 (not exactly sure why...) */ U8X8_END_TRANSFER(), /* disable chip */ U8X8_END() /* end of sequence */ };