From 00db2ef09e7d0c616300dedd623dc5cce6ce4fa4 Mon Sep 17 00:00:00 2001 From: olikraus Date: Thu, 18 Aug 2016 21:15:10 +0200 Subject: [PATCH] 2.3.0 --- examples/page_buffer/FPS/FPS.ino | 7 +++++++ extras/ChangeLog | 4 +++- library.properties | 2 +- src/U8x8lib.cpp | 18 +++++++++++++++++- src/clib/u8x8.h | 2 +- src/clib/u8x8_d_st7920.c | 6 +++++- src/clib/u8x8_d_uc1701_mini12864.c | 10 +++++----- 7 files changed, 39 insertions(+), 10 deletions(-) diff --git a/examples/page_buffer/FPS/FPS.ino b/examples/page_buffer/FPS/FPS.ino index 896a3334..0896f719 100644 --- a/examples/page_buffer/FPS/FPS.ino +++ b/examples/page_buffer/FPS/FPS.ino @@ -150,6 +150,13 @@ 25. June 2016 U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI HW SPI FPS: Clip=56.4 Box=114.1 @=8.6 Pix=12.9 U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI HW SPI FPS: Clip=27.7 Box=87.7 @=4.3 Pix=7.1 + + 18. Aug 2016 + U8G2_ST7920_128X64_1_HW_SPI Uno FPS: Clip=13.2 Box=11.5 @=3.7 Pix=5.9 + U8G2_ST7920_128X64_1_SW_SPI Uno FPS: Clip=1.2 Box=1.2 @=0.9 Pix=1.1 + + U8G2_ST7920_128X64_1_SW_SPI Due FPS: Clip=3.1 Box=3.1 @=2.8 Pix=2.9 + U8G2_ST7920_128X64_1_HW_SPI Due FPS: Clip=26.2 Box=25.8 @=13.9 Pix=15.3 */ diff --git a/extras/ChangeLog b/extras/ChangeLog index 3572918b..64a4351e 100644 --- a/extras/ChangeLog +++ b/extras/ChangeLog @@ -31,5 +31,7 @@ https://github.com/olikraus/u8g2 ChangeLog * Fixed SSD1306 I2C procedures (mirror pixel in last tile column, issue 44) * Experimental support für mini12864 (pull request) * Use beginTransaction for SPI. This requires Arduino 1.6.0 - +2016-08-18 v2.3.x olikraus@gmail.com + * MINI12874; Fixed HW Flip Mode (pull request 49) + * Fixed ST7920 HW SPI with very fast uC, issue 50 diff --git a/library.properties b/library.properties index 9288ccc5..2f246ed3 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=U8g2 -version=2.2.7 +version=2.3.0 author=oliver maintainer=oliver sentence=Library for monochrome LCDs and OLEDs. Successor of U8glib. diff --git a/src/U8x8lib.cpp b/src/U8x8lib.cpp index 2d970599..04c88145 100644 --- a/src/U8x8lib.cpp +++ b/src/U8x8lib.cpp @@ -74,7 +74,23 @@ extern "C" uint8_t u8x8_gpio_and_delay_arduino(u8x8_t *u8x8, uint8_t msg, uint8_ } break; - + +#ifndef __AVR__ + /* this case is not compiled for any AVR, because AVR uC are so slow */ + /* that this delay does not matter */ + case U8X8_MSG_DELAY_NANO: + delayMicroseconds(arg_int==0?0:1); + break; +#endif + + case U8X8_MSG_DELAY_10MICRO: + /* not used at the moment */ + break; + + case U8X8_MSG_DELAY_100NANO: + /* not used at the moment */ + break; + case U8X8_MSG_DELAY_MILLI: delay(arg_int); break; diff --git a/src/clib/u8x8.h b/src/clib/u8x8.h index cb388ecc..953b6ab5 100644 --- a/src/clib/u8x8.h +++ b/src/clib/u8x8.h @@ -79,7 +79,7 @@ U8X8_MSG_DELAY_MILLI U8X8_MSG_DELAY_10MICRO U8X8_MSG_DELAY_100NANO - + U8X8_MSG_DELAY_NANO */ #ifndef _U8X8_H diff --git a/src/clib/u8x8_d_st7920.c b/src/clib/u8x8_d_st7920.c index b71adfea..d73feece 100644 --- a/src/clib/u8x8_d_st7920.c +++ b/src/clib/u8x8_d_st7920.c @@ -123,13 +123,16 @@ uint8_t u8x8_d_st7920_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *a */ c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; /* data ptr to the tiles */ + /* The following byte is sent to allow the ST7920 to sync up with the data */ + /* it solves some issues with garbage data */ + u8x8_cad_SendCmd(u8x8, 0x03e ); /* enable extended mode */ for( i = 0; i < 8; i++ ) { u8x8_cad_SendCmd(u8x8, 0x03e ); /* enable extended mode */ u8x8_cad_SendCmd(u8x8, 0x080 | (y+i) ); /* y pos */ u8x8_cad_SendCmd(u8x8, 0x080 | x ); /* set x pos */ c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ - + u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, 200, NULL); /* extra dely required */ u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes, send one line of data */ ptr += c; @@ -181,6 +184,7 @@ static const u8x8_display_info_t u8x8_st7920_128x64_display_info = /* sda_setup_time_ns = */ 20, /* sck_pulse_width_ns = */ 140, /* datasheet ST7920 */ /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ + /* ST7920+Due work with 1MHz but not with 2MHz, ST7920+Uno works with 2MHz */ /* spi_mode = */ 1, /* active high, rising edge */ /* i2c_bus_clock_100kHz = */ 4, /* data_setup_time_ns = */ 30, diff --git a/src/clib/u8x8_d_uc1701_mini12864.c b/src/clib/u8x8_d_uc1701_mini12864.c index 9bc6e9b0..0b6740b5 100644 --- a/src/clib/u8x8_d_uc1701_mini12864.c +++ b/src/clib/u8x8_d_uc1701_mini12864.c @@ -82,16 +82,16 @@ static const uint8_t u8x8_d_uc1701_mini12864_powersave1_seq[] = { static const uint8_t u8x8_d_uc1701_mini12864_flip0_seq[] = { U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ + U8X8_C(0x0a0), /* segment remap a0/a1*/ + U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ U8X8_END_TRANSFER(), /* disable chip */ U8X8_END() /* end of sequence */ }; static const uint8_t u8x8_d_uc1701_mini12864_flip1_seq[] = { U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ + U8X8_C(0x0a1), /* segment remap a0/a1*/ + U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ U8X8_END_TRANSFER(), /* disable chip */ U8X8_END() /* end of sequence */ }; @@ -116,7 +116,7 @@ static const u8x8_display_info_t u8x8_uc1701_display_info = /* tile_width = */ 16, /* width of 16*8=128 pixel */ /* tile_hight = */ 8, /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 30, + /* flipmode_x_offset = */ 4, /* pixel_width = */ 128, /* pixel_height = */ 64 };