diff --git a/cppsrc/U8x8lib.cpp b/cppsrc/U8x8lib.cpp index e646896e2..f88095867 100644 --- a/cppsrc/U8x8lib.cpp +++ b/cppsrc/U8x8lib.cpp @@ -1074,3 +1074,19 @@ void u8x8_SetPin_KS0108(u8x8_t *u8x8, uint8_t d0, uint8_t d1, uint8_t d2, uint8_ u8x8_SetPin(u8x8, U8X8_PIN_CS2, cs2); u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); } + +void u8x8_SetPin_SED1520(u8x8_t *u8x8, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t dc, uint8_t e1, uint8_t e2, uint8_t reset) +{ + u8x8_SetPin(u8x8, U8X8_PIN_D0, d0); + u8x8_SetPin(u8x8, U8X8_PIN_D1, d1); + u8x8_SetPin(u8x8, U8X8_PIN_D2, d2); + u8x8_SetPin(u8x8, U8X8_PIN_D3, d3); + u8x8_SetPin(u8x8, U8X8_PIN_D4, d4); + u8x8_SetPin(u8x8, U8X8_PIN_D5, d5); + u8x8_SetPin(u8x8, U8X8_PIN_D6, d6); + u8x8_SetPin(u8x8, U8X8_PIN_D7, d7); + u8x8_SetPin(u8x8, U8X8_PIN_E, e1); + u8x8_SetPin(u8x8, U8X8_PIN_CS, e2); + u8x8_SetPin(u8x8, U8X8_PIN_DC, dc); + u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); +} \ No newline at end of file diff --git a/cppsrc/U8x8lib.h b/cppsrc/U8x8lib.h index 05ad0a4a5..20cda5f96 100644 --- a/cppsrc/U8x8lib.h +++ b/cppsrc/U8x8lib.h @@ -110,6 +110,7 @@ void u8x8_SetPin_HW_I2C(u8x8_t *u8x8, uint8_t reset, uint8_t clock = U8X8_PIN_NO void u8x8_SetPin_8Bit_6800(u8x8_t *u8x8, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t enable, uint8_t cs, uint8_t dc, uint8_t reset); void u8x8_SetPin_8Bit_8080(u8x8_t *u8x8, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t wr, uint8_t cs, uint8_t dc, uint8_t reset); void u8x8_SetPin_KS0108(u8x8_t *u8x8, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t enable, uint8_t dc, uint8_t cs0, uint8_t cs1, uint8_t cs2, uint8_t reset); +void u8x8_SetPin_SED1520(u8x8_t *u8x8, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t dc, uint8_t e1, uint8_t e2, uint8_t reset); //void u8x8_Setup_4Wire_SW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset); //void u8x8_Setup_3Wire_SW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset); diff --git a/csrc/u8x8.h b/csrc/u8x8.h index 8fa69dc0d..c1d398855 100644 --- a/csrc/u8x8.h +++ b/csrc/u8x8.h @@ -610,6 +610,7 @@ void u8x8_byte_set_ks0108_cs(u8x8_t *u8x8, uint8_t arg) U8X8_NOINLINE; uint8_t u8x8_byte_ks0108(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_byte_ssd13xx_sw_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); /* OBSOLETE! */ uint8_t u8x8_byte_sw_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); +uint8_t u8x8_byte_sed1520(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); /*==========================================*/ @@ -651,8 +652,8 @@ uint8_t u8x8_byte_sw_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_p #define U8X8_MSG_GPIO_D5 U8X8_MSG_GPIO(U8X8_PIN_D5) #define U8X8_MSG_GPIO_D6 U8X8_MSG_GPIO(U8X8_PIN_D6) #define U8X8_MSG_GPIO_D7 U8X8_MSG_GPIO(U8X8_PIN_D7) -#define U8X8_MSG_GPIO_E U8X8_MSG_GPIO(U8X8_PIN_E) -#define U8X8_MSG_GPIO_CS U8X8_MSG_GPIO(U8X8_PIN_CS) +#define U8X8_MSG_GPIO_E U8X8_MSG_GPIO(U8X8_PIN_E) // used as E1 for the SED1520 +#define U8X8_MSG_GPIO_CS U8X8_MSG_GPIO(U8X8_PIN_CS) // used as E2 for the SED1520 #define U8X8_MSG_GPIO_DC U8X8_MSG_GPIO(U8X8_PIN_DC) #define U8X8_MSG_GPIO_RESET U8X8_MSG_GPIO(U8X8_PIN_RESET) #define U8X8_MSG_GPIO_I2C_CLOCK U8X8_MSG_GPIO(U8X8_PIN_I2C_CLOCK) diff --git a/csrc/u8x8_byte.c b/csrc/u8x8_byte.c index 2aaaa9e60..a737ce512 100644 --- a/csrc/u8x8_byte.c +++ b/csrc/u8x8_byte.c @@ -371,6 +371,64 @@ uint8_t u8x8_byte_ks0108(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_p } +/* sed1520 or sbn1661 + U8X8_MSG_GPIO_E --> E1 + U8X8_MSG_GPIO_CS --> E2 +*/ +uint8_t u8x8_byte_sed1520(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) +{ + uint8_t i, b; + uint8_t *data; + static uint8_t enable_pin; + + switch(msg) + { + case U8X8_MSG_BYTE_SEND: + data = (uint8_t *)arg_ptr; + while( arg_int > 0 ) + { + b = *data; + data++; + arg_int--; + for( i = U8X8_MSG_GPIO_D0; i <= U8X8_MSG_GPIO_D7; i++ ) + { + u8x8_gpio_call(u8x8, i, b&1); + b >>= 1; + } + + u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_NANO, u8x8->display_info->data_setup_time_ns); + u8x8_gpio_call(u8x8, enable_pin, 1); + u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_NANO, u8x8->display_info->write_pulse_width_ns); + u8x8_gpio_call(u8x8, enable_pin, 0); + } + break; + + case U8X8_MSG_BYTE_INIT: + /* disable chipselect */ + u8x8_gpio_SetCS(u8x8, u8x8->display_info->chip_disable_level); + /* ensure that the enable signals are low */ + u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_E, 0); + u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_CS, 0); + enable_pin = U8X8_MSG_GPIO_E; + break; + case U8X8_MSG_BYTE_SET_DC: + u8x8_gpio_SetDC(u8x8, arg_int); + break; + case U8X8_MSG_BYTE_START_TRANSFER: + /* cs lines are not supported for the SED1520/SBN1661 */ + /* instead, this will select the E1 or E2 line */ + enable_pin = U8X8_MSG_GPIO_E; + if ( arg_int != 0 ) + enable_pin = U8X8_MSG_GPIO_CS; + break; + case U8X8_MSG_BYTE_END_TRANSFER: + break; + default: + return 0; + } + return 1; +} + /*=========================================*/ diff --git a/sys/arduino/u8g2_page_buffer/HelloWorld/HelloWorld.ino b/sys/arduino/u8g2_page_buffer/HelloWorld/HelloWorld.ino index d618dbdf4..8a8b155d5 100644 --- a/sys/arduino/u8g2_page_buffer/HelloWorld/HelloWorld.ino +++ b/sys/arduino/u8g2_page_buffer/HelloWorld/HelloWorld.ino @@ -57,7 +57,7 @@ // U8g2 Contructor List (Picture Loop Page Buffer) // The complete list is available here: https://github.com/olikraus/u8g2/wiki/u8g2setupcpp // Please update the pin numbers according to your setup. Use U8X8_PIN_NONE if the reset pin is not connected -//U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); +U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 12, /* dc=*/ 4, /* reset=*/ 6); // Arduboy (Production, Kickstarter Edition) //U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_SSD1306_128X64_NONAME_1_3W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* reset=*/ 8); diff --git a/tools/codebuild/codebuild.c b/tools/codebuild/codebuild.c index b8a5d3725..14cae7e41 100644 --- a/tools/codebuild/codebuild.c +++ b/tools/codebuild/codebuild.c @@ -26,6 +26,7 @@ #define COM_ST7920SPI 0x0020 /* mostly identical to COM_4WSPI, but does not use DC */ #define COM_UART 0x0040 #define COM_KS0108 0x0080 /* mostly identical to 6800 mode, but has more chip select lines */ +#define COM_SED1520 0x0100 struct interface { @@ -585,7 +586,7 @@ struct controller controller_list[] = }, { - "sbn1661", 16, 4, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_001", "", COM_KS0108, + "sbn1661", 16, 4, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_001", "", COM_SED1520, "", /* is_generate_u8g2_class= */ 1, { { "122x32" }, @@ -593,7 +594,7 @@ struct controller controller_list[] = }, }, { - "sed1520", 16, 4, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_001", "", COM_KS0108, + "sed1520", 16, 4, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_001", "", COM_SED1520, "", /* is_generate_u8g2_class= */ 1, { { "122x32" }, @@ -885,6 +886,17 @@ struct interface interface_list[] = "cs, dc [, reset]", "uC specific" }, + /* 13 */ + { + "", + "u8x8_SetPin_SED1520", + "u8x8_byte_sed1520", + "u8x8_gpio_and_delay_arduino", + "uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t dc, uint8_t e1, uint8_t e2, uint8_t reset", + "d0, d1, d2, d3, d4, d5, d6, d7, dc, e1, e2, reset", + "d0, d1, d2, d3, d4, d5, d6, d7, dc, e1, e2, reset", + "u8x8_byte_sed1520" + }, @@ -1241,6 +1253,10 @@ void do_display(int controller_idx, int display_idx, const char *postfix) { do_display_interface(controller_idx, display_idx, postfix, 11); /* KS0108 6800 parallel mode */ } + if ( controller_list[controller_idx].com & COM_SED1520 ) + { + do_display_interface(controller_idx, display_idx, postfix, 13); + } } @@ -1473,6 +1489,10 @@ void do_md_controller_list(void) { do_md_display_interface(controller_idx, display_idx, 11); /* KS0108 */ } + if ( controller_list[controller_idx].com & COM_SED1520 ) + { + do_md_display_interface(controller_idx, display_idx, 13); /* SED1520 */ + } display_idx++; } diff --git a/tools/inoupdate/page_buffer.ino b/tools/inoupdate/page_buffer.ino index 3142d6ad3..e5e58ac33 100644 --- a/tools/inoupdate/page_buffer.ino +++ b/tools/inoupdate/page_buffer.ino @@ -77,6 +77,8 @@ //U8G2_LC7981_160X80_1_6800 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect RW with GND //U8G2_LC7981_160X160_1_6800 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect RW with GND //U8G2_LC7981_240X128_1_6800 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect RW with GND + +//U8G2_SED1520_122X32_1 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*dc=*/ 17, /*e1=*/ 14, /*e2=*/ 15, /* reset=*/ U8X8_PIN_NONE); // Set R/W to low! //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 //U8G2_T6963_256X64_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 //U8G2_SED1330_240X128_1_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 17, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect /RD = E with +5V, enable is /WR = RW, FG with GND, 14=Uno Pin A0