diff --git a/ChangeLog b/ChangeLog index a7a2a3e5..a5891a67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -122,4 +122,5 @@ https://github.com/olikraus/u8g2 ChangeLog * Added support for 64128N ST7565 based display (issue 292) * Added extended fonts (_te, unicodes 32-701, issue 284) * Added support for MAX7219 (issue 280) + * Performance optimization for SSD1322/25/27 (issue 302) \ No newline at end of file diff --git a/csrc/u8x8_d_ssd1322.c b/csrc/u8x8_d_ssd1322.c index d98b0d78..4807180a 100644 --- a/csrc/u8x8_d_ssd1322.c +++ b/csrc/u8x8_d_ssd1322.c @@ -215,6 +215,10 @@ uint8_t u8x8_d_ssd1322_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void * y *= 8; + u8x8_cad_SendCmd(u8x8, 0x075 ); /* set row address, moved out of the loop (issue 302) */ + u8x8_cad_SendArg(u8x8, y); + u8x8_cad_SendArg(u8x8, y+7); + do { c = ((u8x8_tile_t *)arg_ptr)->cnt; @@ -226,10 +230,6 @@ uint8_t u8x8_d_ssd1322_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void * u8x8_cad_SendArg(u8x8, x ); /* start */ u8x8_cad_SendArg(u8x8, x+1 ); /* end */ - u8x8_cad_SendCmd(u8x8, 0x075 ); /* set row address */ - u8x8_cad_SendArg(u8x8, y); - u8x8_cad_SendArg(u8x8, y+7); - u8x8_cad_SendCmd(u8x8, 0x05c ); /* write to ram */ u8x8_cad_SendData(u8x8, 32, u8x8_ssd1322_8to32(u8x8, ptr)); @@ -262,7 +262,7 @@ static const u8x8_display_info_t u8x8_ssd1322_256x64_display_info = /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ /* sda_setup_time_ns = */ 50, /* SSD1322: 15ns, but cycle time is 100ns, so use 100/2 */ /* sck_pulse_width_ns = */ 50, /* SSD1322: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ + /* sck_clock_hz = */ 10000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215), 10 MHz (issue 301) */ /* spi_mode = */ 0, /* active high, rising edge */ /* i2c_bus_clock_100kHz = */ 4, /* data_setup_time_ns = */ 10, diff --git a/csrc/u8x8_d_ssd1325.c b/csrc/u8x8_d_ssd1325.c index a679288f..97593936 100644 --- a/csrc/u8x8_d_ssd1325.c +++ b/csrc/u8x8_d_ssd1325.c @@ -199,7 +199,11 @@ static uint8_t u8x8_d_ssd1325_128x64_generic(u8x8_t *u8x8, uint8_t msg, uint8_t y *= 8; y += u8x8->x_offset; /* x_offset is used as y offset for the SSD1325 */ - + + u8x8_cad_SendCmd(u8x8, 0x075 ); /* set row address */ + u8x8_cad_SendArg(u8x8, y); + u8x8_cad_SendArg(u8x8, y+7); + do { c = ((u8x8_tile_t *)arg_ptr)->cnt; @@ -214,9 +218,6 @@ static uint8_t u8x8_d_ssd1325_128x64_generic(u8x8_t *u8x8, uint8_t msg, uint8_t u8x8_cad_SendArg(u8x8, x ); /* start */ u8x8_cad_SendArg(u8x8, x+3 ); /* end */ - u8x8_cad_SendCmd(u8x8, 0x075 ); /* set row address */ - u8x8_cad_SendArg(u8x8, y); - u8x8_cad_SendArg(u8x8, y+7); u8x8_cad_SendData(u8x8, 32, u8x8_ssd1325_8to32(u8x8, ptr)); diff --git a/csrc/u8x8_d_ssd1327.c b/csrc/u8x8_d_ssd1327.c index 369ee8aa..a7cdf4b1 100644 --- a/csrc/u8x8_d_ssd1327.c +++ b/csrc/u8x8_d_ssd1327.c @@ -136,6 +136,10 @@ static uint8_t u8x8_d_ssd1327_96x96_generic(u8x8_t *u8x8, uint8_t msg, uint8_t a y = (((u8x8_tile_t *)arg_ptr)->y_pos); y *= 8; + u8x8_cad_SendCmd(u8x8, 0x075 ); /* set row address, moved out of the loop (issue 302) */ + u8x8_cad_SendArg(u8x8, y); + u8x8_cad_SendArg(u8x8, y+7); + do { @@ -148,10 +152,6 @@ static uint8_t u8x8_d_ssd1327_96x96_generic(u8x8_t *u8x8, uint8_t msg, uint8_t a u8x8_cad_SendArg(u8x8, x ); /* start */ u8x8_cad_SendArg(u8x8, x+3 ); /* end */ - u8x8_cad_SendCmd(u8x8, 0x075 ); /* set row address */ - u8x8_cad_SendArg(u8x8, y); - u8x8_cad_SendArg(u8x8, y+7); - u8x8_cad_SendData(u8x8, 32, u8x8_ssd1327_8to32(u8x8, ptr)); ptr += 8; diff --git a/sys/arduino/u8g2_page_buffer/FPS/FPS.ino b/sys/arduino/u8g2_page_buffer/FPS/FPS.ino index 9ffea951..885b9fa6 100644 --- a/sys/arduino/u8g2_page_buffer/FPS/FPS.ino +++ b/sys/arduino/u8g2_page_buffer/FPS/FPS.ino @@ -204,6 +204,16 @@ U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI Uno 8MHz Clip=32.9 Box=84.1 @=4.7 Pix=9.0 issue 215 U8G2_ST7565_EA_DOGM128_1_4W_HW_SPI Uno 4MHz Clip=32.0 Box=78.5 @=4.7 Pix=8.9 issue 215 + + U8G2_SSD1322_NHD_256X64_1_4W_HW_SPI Uno 8MHz 16 Bit Clip=9.0 Box=10.7 @=2.0 Pix=3.0 issue 302 before optimization + U8G2_SSD1322_NHD_256X64_1_4W_HW_SPI Uno 10MHz 16 Bit Clip=10.9 Box=13.5 @=2.0 Pix=3.2 issue 302 after optimization (runs with 8MHz) + + U8G2_SSD1327_SEEED_96X96_1_HW_I2C Uno Clip=1.2 Box=1.2 @=0.9 Pix=1.0 issue 302 before optimization + U8G2_SSD1327_SEEED_96X96_1_HW_I2C Uno Clip=1.4 Box=1.4 @=1.0 Pix=1.2 issue 302 after optimization + + U8G2_SSD1325_NHD_128X64_1_4W_HW_SPI Uno Clip=18.2 Box=25.1 @=4.0 Pix=6.7 issue 302 before optimization + U8G2_SSD1325_NHD_128X64_1_4W_HW_SPI Uno Clip=19.1 Box=28.3 @=4.1 Pix=7.2 issue 302 after optimization + */