From 0b02c4df39c9573c7d4450f0538c6bf2f974cf80 Mon Sep 17 00:00:00 2001 From: kraus Date: Sun, 27 Mar 2022 11:05:12 +0200 Subject: [PATCH] bugfix #1806 --- csrc/u8x8_d_ssd1306_128x64_noname.c | 34 ++++++++++++++++++- csrc/u8x8_display.c | 3 +- .../u8g2_full_buffer/U8g2Logo/U8g2Logo.ino | 2 +- .../u8g2_page_buffer/FlipMode/FlipMode.ino | 2 +- .../u8g2_page_buffer/U8g2Logo/U8g2Logo.ino | 1 - 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/csrc/u8x8_d_ssd1306_128x64_noname.c b/csrc/u8x8_d_ssd1306_128x64_noname.c index acf02cb0..139ffc49 100644 --- a/csrc/u8x8_d_ssd1306_128x64_noname.c +++ b/csrc/u8x8_d_ssd1306_128x64_noname.c @@ -172,6 +172,38 @@ static const uint8_t u8x8_d_sh1106_128x64_winstar_init_seq[] = { U8X8_END() /* end of sequence */ }; +static const uint8_t u8x8_d_ssd1312_128x64_noname_init_seq[] = { + + U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ + + + U8X8_C(0x0ae), /* display off */ + U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ + U8X8_CA(0x0a8, 0x03f), /* multiplex ratio */ + U8X8_CA(0x0d3, 0x000), /* display offset */ + U8X8_C(0x040), /* set display start line to 0 */ + U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable, SSD1306 only, should be removed for SH1106 */ + U8X8_CA(0x020, 0x000), /* horizontal addressing mode */ + + U8X8_C(0x0a1), /* segment remap a0/a1*/ + U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ + + U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ + + U8X8_CA(0x081, 0x0cf), /* [2] set contrast control */ + U8X8_CA(0x0d9, 0x0f1), /* [2] pre-charge period 0x022/f1*/ + U8X8_CA(0x0db, 0x040), /* vcomh deselect level */ + // if vcomh is 0, then this will give the biggest range for contrast control issue #98 + // restored the old values for the noname constructor, because vcomh=0 will not work for all OLEDs, #116 + + U8X8_C(0x02e), /* Deactivate scroll */ + U8X8_C(0x0a4), /* output ram to display */ + U8X8_C(0x0a6), /* none inverted normal display mode */ + + U8X8_END_TRANSFER(), /* disable chip */ + U8X8_END() /* end of sequence */ +}; + static const uint8_t u8x8_d_ssd1306_128x64_noname_powersave0_seq[] = { U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ @@ -363,7 +395,7 @@ uint8_t u8x8_d_ssd1312_128x64_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, break; case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_init_seq); + u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1312_128x64_noname_init_seq); /* update 27 mar 2022 */ break; case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_128x64_noname_display_info); diff --git a/csrc/u8x8_display.c b/csrc/u8x8_display.c index 61dd2cd7..e4df772f 100644 --- a/csrc/u8x8_display.c +++ b/csrc/u8x8_display.c @@ -134,7 +134,8 @@ void u8x8_InitInterface(u8x8_t *u8x8) */ void u8x8_InitDisplay(u8x8_t *u8x8) { - u8x8->display_cb(u8x8, U8X8_MSG_DISPLAY_INIT, 0, NULL); + u8x8->display_cb(u8x8, U8X8_MSG_DISPLAY_INIT, 0, NULL); /* this will call u8x8_d_helper_display_init() and send the init seqence to the display */ + /* u8x8->display_cb(u8x8, U8X8_MSG_DISPLAY_SET_FLIP_MODE, 0, NULL); */ /* It would make sense to call flip mode 0 here after U8X8_MSG_DISPLAY_INIT */ } void u8x8_SetPowerSave(u8x8_t *u8x8, uint8_t is_enable) diff --git a/sys/arduino/u8g2_full_buffer/U8g2Logo/U8g2Logo.ino b/sys/arduino/u8g2_full_buffer/U8g2Logo/U8g2Logo.ino index 02bdea8c..e2708186 100644 --- a/sys/arduino/u8g2_full_buffer/U8g2Logo/U8g2Logo.ino +++ b/sys/arduino/u8g2_full_buffer/U8g2Logo/U8g2Logo.ino @@ -75,7 +75,7 @@ //U8G2_SSD1306_102X64_EA_OLEDS102_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // same as the NONAME variant, but may solve the "every 2nd line skipped" problem //U8G2_SSD1312_128X64_NONAME_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_SSD1312_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ 8); -//U8G2_SSD1312_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); +U8G2_SSD1312_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); //U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); //U8G2_SH1106_128X64_VCOMH0_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // same as the NONAME variant, but maximizes setContrast() range diff --git a/sys/arduino/u8g2_page_buffer/FlipMode/FlipMode.ino b/sys/arduino/u8g2_page_buffer/FlipMode/FlipMode.ino index be7c76e0..43a453fd 100644 --- a/sys/arduino/u8g2_page_buffer/FlipMode/FlipMode.ino +++ b/sys/arduino/u8g2_page_buffer/FlipMode/FlipMode.ino @@ -71,7 +71,7 @@ //U8G2_SSD1306_102X64_EA_OLEDS102_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // same as the NONAME variant, but may solve the "every 2nd line skipped" problem //U8G2_SSD1312_128X64_NONAME_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_SSD1312_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ 8); -//U8G2_SSD1312_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); +U8G2_SSD1312_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); //U8G2_SH1106_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_SH1106_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); //U8G2_SH1106_128X64_VCOMH0_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // same as the NONAME variant, but maximizes setContrast() range diff --git a/sys/arduino/u8g2_page_buffer/U8g2Logo/U8g2Logo.ino b/sys/arduino/u8g2_page_buffer/U8g2Logo/U8g2Logo.ino index 3b1c2c59..bab8cbb6 100644 --- a/sys/arduino/u8g2_page_buffer/U8g2Logo/U8g2Logo.ino +++ b/sys/arduino/u8g2_page_buffer/U8g2Logo/U8g2Logo.ino @@ -346,7 +346,6 @@ void setup(void) { u8g2.begin(); - u8g2.setFlipMode(0); } void drawLogo(void)