From 6b1154de77401460c269d744e3152034dc2bec26 Mon Sep 17 00:00:00 2001 From: olikraus Date: Wed, 22 Jan 2025 21:47:12 +0100 Subject: [PATCH] 2.36.4 --- README.md | 2 +- library.json | 2 +- library.properties | 2 +- src/U8x8lib.h | 6 +++--- src/clib/u8g2_d_setup.c | 6 +++--- src/clib/u8x8.h | 5 +++-- src/clib/u8x8_cad.c | 47 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 59 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4abed048..ccfaee57 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.36.3): https://github.com/olikraus/U8g2_Arduino/archive/master.zip +Download (2.36.4): https://github.com/olikraus/U8g2_Arduino/archive/master.zip diff --git a/library.json b/library.json index 55f26658..f15eb490 100644 --- a/library.json +++ b/library.json @@ -7,7 +7,7 @@ "type": "git", "url": "https://github.com/olikraus/u8g2.git" }, - "version": "2.36.3", + "version": "2.36.4", "license": "BSD-2-Clause", "authors": { "name": "Oliver Kraus", diff --git a/library.properties b/library.properties index f7d5ff1a..bd96ea92 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=U8g2 -version=2.36.3 +version=2.36.4 author=oliver maintainer=oliver sentence=Monochrome LCD, OLED and eInk Library. Display controller: SSD1305, SSD1306, SSD1309, SSD1312, SSD1316, SSD1318, SSD1320, SSD1322, SSD1325, SSD1327, SSD1329, SSD1362, SSD1363, SSD1606, SSD1607, SH1106, SH1107, SH1108, SH1122, T6963, RA8835, LC7981, PCD8544, PCF8812, HX1230, UC1601, UC1604, UC1608, UC1610, UC1611, UC1617, UC1628, UC1638, UC1701, ST7302, ST7511, ST7528, ST7539, ST7565, ST7567, ST7571, ST7586, ST7588, ST75160, ST75161, ST75256, ST75320, NT7534, ST7920, IST3020, IST3088, IST7920, LD7032, KS0108, KS0713, HD44102, T7932, SSD1312, SED1330, SED1520, SBN1661, IL3820, MAX7219, GP1287, GP1247, GP1294, GU800. Interfaces: I2C, SPI, Parallel. diff --git a/src/U8x8lib.h b/src/U8x8lib.h index 7f08a59d..ebbac8f6 100644 --- a/src/U8x8lib.h +++ b/src/U8x8lib.h @@ -9155,19 +9155,19 @@ class U8X8_SSD1363_256X128_8080 : public U8X8 { }; class U8X8_SSD1363_256X128_SW_I2C : public U8X8 { public: U8X8_SSD1363_256X128_SW_I2C(uint8_t clock, uint8_t data, uint8_t reset = U8X8_PIN_NONE) : U8X8() { - u8x8_Setup(getU8x8(), u8x8_d_ssd1363_256x128, u8x8_cad_ssd13xx_fast_i2c, u8x8_byte_arduino_sw_i2c, u8x8_gpio_and_delay_arduino); + u8x8_Setup(getU8x8(), u8x8_d_ssd1363_256x128, u8x8_cad_011_ssd13xx_i2c, u8x8_byte_arduino_sw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_SW_I2C(getU8x8(), clock, data, reset); } }; class U8X8_SSD1363_256X128_HW_I2C : public U8X8 { public: U8X8_SSD1363_256X128_HW_I2C(uint8_t reset = U8X8_PIN_NONE, uint8_t clock = U8X8_PIN_NONE, uint8_t data = U8X8_PIN_NONE) : U8X8() { - u8x8_Setup(getU8x8(), u8x8_d_ssd1363_256x128, u8x8_cad_ssd13xx_fast_i2c, u8x8_byte_arduino_hw_i2c, u8x8_gpio_and_delay_arduino); + u8x8_Setup(getU8x8(), u8x8_d_ssd1363_256x128, u8x8_cad_011_ssd13xx_i2c, u8x8_byte_arduino_hw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_HW_I2C(getU8x8(), reset, clock, data); } }; class U8X8_SSD1363_256X128_2ND_HW_I2C : public U8X8 { public: U8X8_SSD1363_256X128_2ND_HW_I2C(uint8_t reset = U8X8_PIN_NONE) : U8X8() { - u8x8_Setup(getU8x8(), u8x8_d_ssd1363_256x128, u8x8_cad_ssd13xx_fast_i2c, u8x8_byte_arduino_2nd_hw_i2c, u8x8_gpio_and_delay_arduino); + u8x8_Setup(getU8x8(), u8x8_d_ssd1363_256x128, u8x8_cad_011_ssd13xx_i2c, u8x8_byte_arduino_2nd_hw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_HW_I2C(getU8x8(), reset); } }; diff --git a/src/clib/u8g2_d_setup.c b/src/clib/u8g2_d_setup.c index e25f18f2..58a194e4 100644 --- a/src/clib/u8g2_d_setup.c +++ b/src/clib/u8g2_d_setup.c @@ -8597,7 +8597,7 @@ void u8g2_Setup_ssd1363_i2c_256x128_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u { uint8_t tile_buf_height; uint8_t *buf; - u8g2_SetupDisplay(u8g2, u8x8_d_ssd1363_256x128, u8x8_cad_ssd13xx_fast_i2c, byte_cb, gpio_and_delay_cb); + u8g2_SetupDisplay(u8g2, u8x8_d_ssd1363_256x128, u8x8_cad_011_ssd13xx_i2c, byte_cb, gpio_and_delay_cb); buf = u8g2_m_32_16_1(&tile_buf_height); u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); } @@ -8606,7 +8606,7 @@ void u8g2_Setup_ssd1363_i2c_256x128_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u { uint8_t tile_buf_height; uint8_t *buf; - u8g2_SetupDisplay(u8g2, u8x8_d_ssd1363_256x128, u8x8_cad_ssd13xx_fast_i2c, byte_cb, gpio_and_delay_cb); + u8g2_SetupDisplay(u8g2, u8x8_d_ssd1363_256x128, u8x8_cad_011_ssd13xx_i2c, byte_cb, gpio_and_delay_cb); buf = u8g2_m_32_16_2(&tile_buf_height); u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); } @@ -8615,7 +8615,7 @@ void u8g2_Setup_ssd1363_i2c_256x128_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u { uint8_t tile_buf_height; uint8_t *buf; - u8g2_SetupDisplay(u8g2, u8x8_d_ssd1363_256x128, u8x8_cad_ssd13xx_fast_i2c, byte_cb, gpio_and_delay_cb); + u8g2_SetupDisplay(u8g2, u8x8_d_ssd1363_256x128, u8x8_cad_011_ssd13xx_i2c, byte_cb, gpio_and_delay_cb); buf = u8g2_m_32_16_f(&tile_buf_height); u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); } diff --git a/src/clib/u8x8.h b/src/clib/u8x8.h index d3f91098..3b2c158b 100644 --- a/src/clib/u8x8.h +++ b/src/clib/u8x8.h @@ -663,8 +663,9 @@ uint8_t u8x8_cad_001(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_cad_011(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_cad_100(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_cad_st7920_spi(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); -uint8_t u8x8_cad_ssd13xx_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); -uint8_t u8x8_cad_ssd13xx_fast_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); +uint8_t u8x8_cad_ssd13xx_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); /* CAD=001 */ +uint8_t u8x8_cad_011_ssd13xx_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); /* CAD=011 */ +uint8_t u8x8_cad_ssd13xx_fast_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); /* CAD=001 */ uint8_t u8x8_cad_st75256_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_cad_ld7032_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_cad_uc16xx_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); /* CAD=001 */ diff --git a/src/clib/u8x8_cad.c b/src/clib/u8x8_cad.c index e73f93e1..5df0525b 100644 --- a/src/clib/u8x8_cad.c +++ b/src/clib/u8x8_cad.c @@ -480,6 +480,7 @@ static void u8x8_i2c_data_transfer(u8x8_t *u8x8, uint8_t arg_int, void *arg_ptr) } /* classic version: will put a start/stop condition around each command and arg */ +/* implements CAD = 001 */ uint8_t u8x8_cad_ssd13xx_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { uint8_t *p; @@ -530,6 +531,52 @@ uint8_t u8x8_cad_ssd13xx_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *a } + +/* classic version: will put a start/stop condition around each command and arg */ +/* implements CAD = 011 for the SSD1363 */ +uint8_t u8x8_cad_011_ssd13xx_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) +{ + uint8_t *p; + switch(msg) + { + case U8X8_MSG_CAD_SEND_CMD: + u8x8_byte_StartTransfer(u8x8); + u8x8_byte_SendByte(u8x8, 0x000); + u8x8_byte_SendByte(u8x8, arg_int); + u8x8_byte_EndTransfer(u8x8); + break; + case U8X8_MSG_CAD_SEND_ARG: + u8x8_byte_StartTransfer(u8x8); + u8x8_byte_SendByte(u8x8, 0x040); + u8x8_byte_SendByte(u8x8, arg_int); + u8x8_byte_EndTransfer(u8x8); + break; + case U8X8_MSG_CAD_SEND_DATA: + p = (uint8_t *)arg_ptr; + while( arg_int > 24 ) + { + u8x8_i2c_data_transfer(u8x8, 24, p); + arg_int-=24; + p+=24; + } + u8x8_i2c_data_transfer(u8x8, arg_int, p); + break; + case U8X8_MSG_CAD_INIT: + /* apply default i2c adr if required so that the start transfer msg can use this */ + if ( u8x8->i2c_address == 255 ) + u8x8->i2c_address = 0x078; + return u8x8->byte_cb(u8x8, msg, arg_int, arg_ptr); + case U8X8_MSG_CAD_START_TRANSFER: + case U8X8_MSG_CAD_END_TRANSFER: + /* cad transfer commands are ignored */ + break; + default: + return 0; + } + return 1; +} + + /* fast version with reduced data start/stops, issue 735 */ uint8_t u8x8_cad_ssd13xx_fast_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) {