From b4782134c31da8d909daf5dd0354d08299d7a315 Mon Sep 17 00:00:00 2001 From: olikraus Date: Sat, 2 Jul 2016 09:43:17 +0200 Subject: [PATCH] t6963 --- csrc/u8x8_d_t6963.c | 35 ++++++++++++++----- .../HelloWorld/HelloWorld.ino | 8 +++-- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/csrc/u8x8_d_t6963.c b/csrc/u8x8_d_t6963.c index eecf88ef..c06e35ab 100644 --- a/csrc/u8x8_d_t6963.c +++ b/csrc/u8x8_d_t6963.c @@ -50,8 +50,9 @@ static const uint8_t u8x8_d_t6963_init_seq[] = { U8X8_AAC(0x00,0x00,0x022), /* low, high, set offset */ U8X8_AAC(0x00,0x00,0x040), /* low, high, set text home */ U8X8_AAC(240/8,0x00,0x041), /* low, high, set text columns */ - U8X8_AAC(0x00,0x00,0x042), /* low, high, graphics home */ + U8X8_AAC(0x00,0x00,0x042), /* low, high, graphics home */ U8X8_AAC(240/8,0x00,0x043), /* low, high, graphics columns */ + U8X8_DLY(2), /* delay 2ms */ // mode set // 0x080: Internal CG, OR Mode // 0x081: Internal CG, EXOR Mode @@ -72,11 +73,21 @@ static const uint8_t u8x8_d_t6963_init_seq[] = { // 0x09f: Graphic on, text on, cursor on, blink on U8X8_C(0x098), /* mode register: Display Mode, Graphics on, Text off, Cursor off */ U8X8_AAC(0x00,0x00,0x024), /* low, high, set adr pointer */ + + U8X8_C(0x0b0), /* autowrite start */ + U8X8_D1(255), + U8X8_D1(255), + U8X8_D1(255), + U8X8_D1(255), + U8X8_D1(255), + U8X8_D1(255), + U8X8_D1(255), + U8X8_D1(255), + U8X8_C(0x0b2), /* autowrite reset */ - U8X8_DLY(2), /* delay 2ms */ - + U8X8_DLY(100), U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ + U8X8_DLY(100), }; static const uint8_t u8x8_d_t6963_powersave0_seq[] = { @@ -121,7 +132,9 @@ uint8_t u8x8_d_t6963_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *ar y*=8; y*= u8x8->display_info->tile_width; /* x = ((u8x8_tile_t *)arg_ptr)->x_pos; x is ignored... no u8x8 support */ + //u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, 200, NULL); /* extra dely required */ u8x8_cad_StartTransfer(u8x8); + //u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, 200, NULL); /* extra dely required */ /* Tile structure is reused here for the t6963, however u8x8 is not supported tile_ptr points to data which has cnt*8 bytes (same as SSD1306 tiles) @@ -137,13 +150,19 @@ uint8_t u8x8_d_t6963_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *ar u8x8_cad_SendArg(u8x8, y&255); u8x8_cad_SendArg(u8x8, y>>8); u8x8_cad_SendCmd(u8x8, 0x024 ); /* set adr */ + u8x8_cad_SendCmd(u8x8, 0x0b0 ); /* auto write start */ - c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ + + //c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes, send one line of data */ + + u8x8_cad_SendCmd(u8x8, 0x0b2 ); /* auto write reset */ ptr += u8x8->display_info->tile_width; + y += u8x8->display_info->tile_width; } u8x8_cad_EndTransfer(u8x8); + //u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, 200, NULL); /* extra dely required */ break; default: @@ -154,10 +173,10 @@ uint8_t u8x8_d_t6963_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *ar static const u8x8_display_info_t u8x8_t6963_240x128_display_info = { - /* chip_enable_level = */ 1, - /* chip_disable_level = */ 0, + /* chip_enable_level = */ 0, + /* chip_disable_level = */ 1, - /* post_chip_enable_wait_ns = */ 10, /* T6963 Datasheet p30 */ + /* post_chip_enable_wait_ns = */ 110, /* T6963 Datasheet p30 */ /* pre_chip_disable_wait_ns = */ 100, /* T6963 Datasheet p30 */ /* reset_pulse_width_ms = */ 1, /* post_reset_wait_ms = */ 6, diff --git a/sys/arduino/u8g2_page_buffer/HelloWorld/HelloWorld.ino b/sys/arduino/u8g2_page_buffer/HelloWorld/HelloWorld.ino index 63f17d89..0c661f66 100644 --- a/sys/arduino/u8g2_page_buffer/HelloWorld/HelloWorld.ino +++ b/sys/arduino/u8g2_page_buffer/HelloWorld/HelloWorld.ino @@ -81,7 +81,7 @@ //U8G2_ST7565_EA_DOGM128_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_ST7565_NHD_C12832_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_ST7565_NHD_C12832_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); -U8G2_T6963_240X128_1_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 17, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect RD with +5V, FGx with GND +U8G2_T6963_240X128_1_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 17, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect RD with +5V, FS0 and FS1 with GND // End of constructor list @@ -89,7 +89,11 @@ U8G2_T6963_240X128_1_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 17 void setup(void) { + pinMode(18, OUTPUT); + digitalWrite(18, 1); + u8g2.begin(); + } void loop(void) { @@ -98,6 +102,6 @@ void loop(void) { u8g2.setFont(u8g2_font_ncenB14_tr); u8g2.drawStr(0,24,"Hello World!"); } while ( u8g2.nextPage() ); - delay(1000); + //delay(1000); }