diff --git a/cppsrc/U8g2lib.h b/cppsrc/U8g2lib.h index a8d33a04..002936fa 100644 --- a/cppsrc/U8g2lib.h +++ b/cppsrc/U8g2lib.h @@ -16013,6 +16013,132 @@ class U8G2_UC1698_160X160_F_8080 : public U8G2 { u8x8_SetPin_8Bit_8080(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); } }; +class U8G2_UC1698_240X64_1_4W_SW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_1_4W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_1(&u8g2, rotation, u8x8_byte_arduino_4wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_SW_SPI(getU8x8(), clock, data, cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_1_4W_HW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_1_4W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_1(&u8g2, rotation, u8x8_byte_arduino_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_1_2ND_4W_HW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_1_2ND_4W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_1(&u8g2, rotation, u8x8_byte_arduino_2nd_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_1_3W_SW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_1_3W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_1(&u8g2, rotation, u8x8_byte_arduino_3wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_SW_SPI(getU8x8(), clock, data, cs, reset); + } +}; +class U8G2_UC1698_240X64_1_3W_HW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_1_3W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_1(&u8g2, rotation, u8x8_byte_arduino_3wire_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_HW_SPI(getU8x8(), cs, reset); + } +}; +class U8G2_UC1698_240X64_1_6800 : public U8G2 { + public: U8G2_UC1698_240X64_1_6800(const u8g2_cb_t *rotation, 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 = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_1(&u8g2, rotation, u8x8_byte_8bit_6800mode, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_8Bit_6800(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_1_8080 : public U8G2 { + public: U8G2_UC1698_240X64_1_8080(const u8g2_cb_t *rotation, 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 = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_1(&u8g2, rotation, u8x8_byte_arduino_8bit_8080mode, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_8Bit_8080(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_2_4W_SW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_2_4W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_2(&u8g2, rotation, u8x8_byte_arduino_4wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_SW_SPI(getU8x8(), clock, data, cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_2_4W_HW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_2_4W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_2(&u8g2, rotation, u8x8_byte_arduino_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_2_2ND_4W_HW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_2_2ND_4W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_2(&u8g2, rotation, u8x8_byte_arduino_2nd_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_2_3W_SW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_2_3W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_2(&u8g2, rotation, u8x8_byte_arduino_3wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_SW_SPI(getU8x8(), clock, data, cs, reset); + } +}; +class U8G2_UC1698_240X64_2_3W_HW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_2_3W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_2(&u8g2, rotation, u8x8_byte_arduino_3wire_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_HW_SPI(getU8x8(), cs, reset); + } +}; +class U8G2_UC1698_240X64_2_6800 : public U8G2 { + public: U8G2_UC1698_240X64_2_6800(const u8g2_cb_t *rotation, 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 = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_2(&u8g2, rotation, u8x8_byte_8bit_6800mode, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_8Bit_6800(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_2_8080 : public U8G2 { + public: U8G2_UC1698_240X64_2_8080(const u8g2_cb_t *rotation, 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 = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_2(&u8g2, rotation, u8x8_byte_arduino_8bit_8080mode, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_8Bit_8080(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_F_4W_SW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_F_4W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_f(&u8g2, rotation, u8x8_byte_arduino_4wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_SW_SPI(getU8x8(), clock, data, cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_F_4W_HW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_F_4W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_f(&u8g2, rotation, u8x8_byte_arduino_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_F_2ND_4W_HW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_F_2ND_4W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_f(&u8g2, rotation, u8x8_byte_arduino_2nd_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_F_3W_SW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_F_3W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_f(&u8g2, rotation, u8x8_byte_arduino_3wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_SW_SPI(getU8x8(), clock, data, cs, reset); + } +}; +class U8G2_UC1698_240X64_F_3W_HW_SPI : public U8G2 { + public: U8G2_UC1698_240X64_F_3W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_f(&u8g2, rotation, u8x8_byte_arduino_3wire_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_HW_SPI(getU8x8(), cs, reset); + } +}; +class U8G2_UC1698_240X64_F_6800 : public U8G2 { + public: U8G2_UC1698_240X64_F_6800(const u8g2_cb_t *rotation, 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 = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_f(&u8g2, rotation, u8x8_byte_8bit_6800mode, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_8Bit_6800(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); + } +}; +class U8G2_UC1698_240X64_F_8080 : public U8G2 { + public: U8G2_UC1698_240X64_F_8080(const u8g2_cb_t *rotation, 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 = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_uc1698_240x64_f(&u8g2, rotation, u8x8_byte_arduino_8bit_8080mode, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_8Bit_8080(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); + } +}; class U8G2_ST7511_AVD_320X240_1_4W_SW_SPI : public U8G2 { public: U8G2_ST7511_AVD_320X240_1_4W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { u8g2_Setup_st7511_avd_320x240_1(&u8g2, rotation, u8x8_byte_arduino_4wire_sw_spi, u8x8_gpio_and_delay_arduino); diff --git a/cppsrc/U8x8lib.h b/cppsrc/U8x8lib.h index dbb8216b..0a799165 100644 --- a/cppsrc/U8x8lib.h +++ b/cppsrc/U8x8lib.h @@ -5607,6 +5607,48 @@ class U8X8_UC1698_160X160_8080 : public U8X8 { u8x8_SetPin_8Bit_8080(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); } }; +class U8X8_UC1698_240X64_4W_SW_SPI : public U8X8 { + public: U8X8_UC1698_240X64_4W_SW_SPI(uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8X8() { + u8x8_Setup(getU8x8(), u8x8_d_uc1698_240x64, u8x8_cad_001, u8x8_byte_arduino_4wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_SW_SPI(getU8x8(), clock, data, cs, dc, reset); + } +}; +class U8X8_UC1698_240X64_4W_HW_SPI : public U8X8 { + public: U8X8_UC1698_240X64_4W_HW_SPI(uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8X8() { + u8x8_Setup(getU8x8(), u8x8_d_uc1698_240x64, u8x8_cad_001, u8x8_byte_arduino_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8X8_UC1698_240X64_2ND_4W_HW_SPI : public U8X8 { + public: U8X8_UC1698_240X64_2ND_4W_HW_SPI(uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8X8() { + u8x8_Setup(getU8x8(), u8x8_d_uc1698_240x64, u8x8_cad_001, u8x8_byte_arduino_2nd_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8X8_UC1698_240X64_3W_SW_SPI : public U8X8 { + public: U8X8_UC1698_240X64_3W_SW_SPI(uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8X8() { + u8x8_Setup(getU8x8(), u8x8_d_uc1698_240x64, u8x8_cad_001, u8x8_byte_arduino_3wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_SW_SPI(getU8x8(), clock, data, cs, reset); + } +}; +class U8X8_UC1698_240X64_3W_HW_SPI : public U8X8 { + public: U8X8_UC1698_240X64_3W_HW_SPI(uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8X8() { + u8x8_Setup(getU8x8(), u8x8_d_uc1698_240x64, u8x8_cad_001, u8x8_byte_arduino_3wire_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_HW_SPI(getU8x8(), cs, reset); + } +}; +class U8X8_UC1698_240X64_6800 : public U8X8 { + public: U8X8_UC1698_240X64_6800(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 = U8X8_PIN_NONE) : U8X8() { + u8x8_Setup(getU8x8(), u8x8_d_uc1698_240x64, u8x8_cad_001, u8x8_byte_8bit_6800mode, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_8Bit_6800(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); + } +}; +class U8X8_UC1698_240X64_8080 : public U8X8 { + public: U8X8_UC1698_240X64_8080(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 = U8X8_PIN_NONE) : U8X8() { + u8x8_Setup(getU8x8(), u8x8_d_uc1698_240x64, u8x8_cad_001, u8x8_byte_arduino_8bit_8080mode, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_8Bit_8080(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); + } +}; class U8X8_ST7511_AVD_320X240_4W_SW_SPI : public U8X8 { public: U8X8_ST7511_AVD_320X240_4W_SW_SPI(uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8X8() { u8x8_Setup(getU8x8(), u8x8_d_st7511_avd_320x240, u8x8_cad_011, u8x8_byte_arduino_4wire_sw_spi, u8x8_gpio_and_delay_arduino); diff --git a/csrc/u8g2.h b/csrc/u8g2.h index 79156def..e387dd79 100644 --- a/csrc/u8g2.h +++ b/csrc/u8g2.h @@ -1274,6 +1274,9 @@ void u8g2_Setup_uc1611_i2c_ids4073_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8 void u8g2_Setup_uc1698_160x160_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_uc1698_160x160_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_uc1698_160x160_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); +void u8g2_Setup_uc1698_240x64_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); +void u8g2_Setup_uc1698_240x64_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); +void u8g2_Setup_uc1698_240x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_st7511_avd_320x240_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_st7511_avd_320x240_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_st7511_avd_320x240_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); diff --git a/csrc/u8g2_d_setup.c b/csrc/u8g2_d_setup.c index 66b01774..bb06646a 100644 --- a/csrc/u8g2_d_setup.c +++ b/csrc/u8g2_d_setup.c @@ -5215,6 +5215,34 @@ void u8g2_Setup_uc1698_160x160_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_m buf = u8g2_m_20_20_f(&tile_buf_height); u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation); } +/* uc1698 */ +/* uc1698 1 */ +void u8g2_Setup_uc1698_240x64_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) +{ + uint8_t tile_buf_height; + uint8_t *buf; + u8g2_SetupDisplay(u8g2, u8x8_d_uc1698_240x64, u8x8_cad_001, byte_cb, gpio_and_delay_cb); + buf = u8g2_m_30_8_1(&tile_buf_height); + u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation); +} +/* uc1698 2 */ +void u8g2_Setup_uc1698_240x64_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) +{ + uint8_t tile_buf_height; + uint8_t *buf; + u8g2_SetupDisplay(u8g2, u8x8_d_uc1698_240x64, u8x8_cad_001, byte_cb, gpio_and_delay_cb); + buf = u8g2_m_30_8_2(&tile_buf_height); + u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation); +} +/* uc1698 f */ +void u8g2_Setup_uc1698_240x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) +{ + uint8_t tile_buf_height; + uint8_t *buf; + u8g2_SetupDisplay(u8g2, u8x8_d_uc1698_240x64, u8x8_cad_001, byte_cb, gpio_and_delay_cb); + buf = u8g2_m_30_8_f(&tile_buf_height); + u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation); +} /* st7511 */ /* st7511 1 */ void u8g2_Setup_st7511_avd_320x240_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) diff --git a/csrc/u8x8.h b/csrc/u8x8.h index 29870e96..8a3a5889 100644 --- a/csrc/u8x8.h +++ b/csrc/u8x8.h @@ -1032,6 +1032,7 @@ uint8_t u8x8_d_uc1638_160x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void * uint8_t u8x8_d_uc1638_192x96(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_d_uc1638_240x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_d_uc1698_160x160(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); +uint8_t u8x8_d_uc1698_240x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_d_ks0108_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_d_ks0108_erm19264(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_d_t7932_150x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); /* t7932 and hd44102 are compatible */ diff --git a/csrc/u8x8_d_uc1698.c b/csrc/u8x8_d_uc1698.c index bed0f61a..a7375c2b 100644 --- a/csrc/u8x8_d_uc1698.c +++ b/csrc/u8x8_d_uc1698.c @@ -109,6 +109,7 @@ uint8_t u8x8_d_uc1698u_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void * u8x8_cad_SendCmd(u8x8,x); y = ((u8x8_tile_t *)arg_ptr)->y_pos; + y+=40; y = y<<3; u8x8_cad_SendCmd(u8x8,0xF5); //start y u8x8_cad_SendCmd(u8x8,y); @@ -356,4 +357,258 @@ uint8_t u8x8_d_uc1698_160x160(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void * } } return 1; -} \ No newline at end of file +} + +/*=====================================================*/ +/* 240x64 display + + Notes: + The above 160x160 had been a great inital code template for the below 240x64 display, + however i did several improvements + - The window size is now maximized to avoid any line breaks by the display + - The row/col position is set for each horizontal row + - I think the below common2 is more portable and could be reused. + - If the y-offset differs, it could be passed/changed via function arguments +*/ + + + +uint8_t u8x8_d_uc1698u_common2(u8x8_t *u8x8, uint8_t y_offset, uint8_t msg, uint8_t arg_int, void *arg_ptr) +{ + uint8_t x, y, c, r; + uint8_t *ptr; + uint8_t arr_4k[4]; + + switch(msg) + { + case U8X8_MSG_DISPLAY_DRAW_TILE: + u8x8_cad_StartTransfer(u8x8); + + x = ((u8x8_tile_t *)arg_ptr)->x_pos; + // in u8g2 horizontal mode, x is always 0 + //x = x<<3; // Fast multiplication by 8 with shift + //x /= 3; //The X-axis is addressed using 1 RAM cell. 1 cell is 3 pixels in 4k RGB format. + x += u8x8->x_offset; + + y = ((u8x8_tile_t *)arg_ptr)->y_pos; + y = y<<3; + y += y_offset; + + c = ((u8x8_tile_t *)arg_ptr)->cnt; + ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; + + do + { + + for( r = 0; r < 8; r++ ) + { + u8x8_cad_SendCmd(u8x8,((x>>0)&0x0F)|0x00); + u8x8_cad_SendCmd(u8x8,((x>>4)&0x0F)|0x10); + u8x8_cad_SendCmd(u8x8,((y>>0)&0x0F)|0x60); + u8x8_cad_SendCmd(u8x8,((y>>4)&0x0F)|0x70); + for (uint16_t i=0; i> 4]; + + arr_4k[3] = low[1]; + arr_4k[2] = low[0]; + arr_4k[1] = high[1]; + arr_4k[0] = high[0]; + + u8x8_cad_SendData(u8x8, 4, arr_4k); + ptr++; + } + y++; + } + arg_int--; + } while( arg_int > 0 ); + + + u8x8_cad_EndTransfer(u8x8); + break; + /* handled in the calling procedure + case U8X8_MSG_DISPLAY_SETUP_MEMORY: + u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1611_128x64_display_info); + break; + case U8X8_MSG_DISPLAY_INIT: + u8x8_d_helper_display_init(u8x8); + u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_init_seq); + break; + */ +#ifdef U8X8_WITH_SET_CONTRAST + case U8X8_MSG_DISPLAY_SET_CONTRAST: + u8x8_cad_StartTransfer(u8x8); + u8x8_cad_SendCmd(u8x8, 0x081 ); + u8x8_cad_SendArg(u8x8, arg_int ); /* uc1611 has range from 0 to 255 */ + u8x8_cad_EndTransfer(u8x8); + break; +#endif + default: + return 0; + } + return 1; +} + + +static const u8x8_display_info_t u8x8_uc1698u_240x64_display_info = +{ + /* chip_enable_level = */ 0, /* use CS0 of the UC1698 */ + /* chip_disable_level = */ 1, + + /* post_chip_enable_wait_ns = */ 10, /* uc1611 datasheet, page 60, actually 0 */ + /* pre_chip_disable_wait_ns = */ 10, /* uc1611 datasheet, page 60, actually 0 */ + /* reset_pulse_width_ms = */ 20, + /* post_reset_wait_ms = */ 200, /* uc1611 datasheet, page 67 */ + /* sda_setup_time_ns = */ 10, /* uc1611 datasheet, page 64, actually 0 */ + /* sck_pulse_width_ns = */ 60, /* half of cycle time */ + /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ + /* spi_mode = */ 0, /* active high, rising edge */ + /* i2c_bus_clock_100kHz = */ 4, + /* data_setup_time_ns = */ 30, /* uc1611 datasheet, page 60 */ + /* write_pulse_width_ns = */ 80, /* uc1611 datasheet, page 60 */ + /* tile_width = */ 30, /* width of 30*8=240 pixel */ + /* tile_height = */ 8, + /* default_x_offset = */ 0, + /* flipmode_x_offset = */ 0, + /* pixel_width = */ 240, + /* pixel_height = */ 64 +}; + +/* +System Reset: E2H --> DONE +Set Temp. Compensation: 24H --> DONE +Set up LCD format specific parameters MX,MY,etc(double-byte command): C0H,04H --> FLIP0 +Set line rate: A3H --> DONE +Set Pump Control (internal Vlcd): 2FH --> DONE +Set Isolation Clock Front (3 bytes command): 82H, 13H, 01H --> DONE +Set Isolation Clock Back (3 bytes command): 82H, 14H, 00H --> DONE +Set LCD Bias Ratio: EAH +LCD Specific Operation Voltage Setting (double-byte command): 81H, 90H --> DONE +Set RAM Address Control: 80H --> DOES NOT MAKE SENSE +Set Page Addr. MSB: 72H --> DONE +Set Page Addr. LSB : 60H --> DONE +Set Column Addr. LSB: 00H --> DONE +Set Column Addr.MSB: 10H --> DONE +Window Program Enable : F8H --> NOT REQURED +Window Starting Column (double-byte command): F4H , 00H --> NOT REQURED +Window Ending Column (double-byte command): F6H, 9FH --> NOT REQURED +Set one bit for one pixel: D1H --> DONE +Set Display Enable: A9H +*/ + +static const uint8_t u8x8_d_uc1698u_240x64_init_seq[] = { + + U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ + U8X8_C(0x0e2), /* system reset */ + U8X8_DLY(10), + + /*power control*/ + U8X8_C(0x0e9), //Bias Ratio:1/10 bias + U8X8_C(0x02b), //power control set as internal power + U8X8_C(0x024), //set temperate compensation as 0% + U8X8_C(0x081), //electronic potentionmeter + U8X8_C(0x096), //start contrast level + + /*display control*/ + U8X8_C(0x0a4), //all pixel off + U8X8_C(0x0a6), //inverse display off + + /*lcd control*/ + U8X8_C(0x0c4), //Set LCD Maping Control (MY=1, MX=0) + + + + U8X8_C(0x0a1), //line rate 15.2klps + U8X8_C(0x0d1), //rgb-rgb + +// U8X8_C(0x0d6), //64k color mode + U8X8_C(0x0d5), //4k color mode + + U8X8_C(0x084), //12:partial display control disable + + + /*n-line inversion*/ + U8X8_C(0x0c8), + U8X8_C(0x010), //enable NIV + + /*com scan fuction*/ + U8X8_C(0x0da), //enable FRC,PWM,LRM sequence + + /* window covers the complete RAM*/ + U8X8_C(0x0f4), //wpc0:column + U8X8_C(0), // + U8X8_C(0x0f6), //wpc1 + U8X8_C(127), // + + U8X8_C(0x0f5), //wpp0:row + U8X8_C(0), //start from 0 + U8X8_C(0x0f7), //wpp1 + U8X8_C(159), //end 160 + + U8X8_C(0x0f8), //inside window mode + + U8X8_C(0x089), //RAM control /** Draw right then down **/ + + + /*scroll line*/ + U8X8_C(0x040), //low bit of scroll line + U8X8_C(0x050), //high bit of scroll line + + U8X8_C(0x090), //14:FLT,FLB set + U8X8_C(0x000), + + /*partial display*/ + U8X8_C(0x084), //12,set partial display control:off + U8X8_C(0x0f1), //com end + U8X8_C(0x09f), //160 + U8X8_C(0x0f2), //display start + U8X8_C(0x000), //0 + U8X8_C(0x0f3), //display end + U8X8_C(0x0a0), //160 + + U8X8_C(0x0ac), //display OFF,select on/off mode.Green Enhance mode disable + + U8X8_END_TRANSFER(), /* disable chip */ + U8X8_END() /* end of sequence */ +}; + +uint8_t u8x8_d_uc1698_240x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) +{ + /* call common procedure first and handle messages there */ + if ( u8x8_d_uc1698u_common2(u8x8, /* y offset */ 12*8, msg, arg_int, arg_ptr) == 0 ) + { + /* msg not handled, then try here */ + switch(msg) + { + case U8X8_MSG_DISPLAY_SETUP_MEMORY: + u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1698u_240x64_display_info); + break; + case U8X8_MSG_DISPLAY_INIT: + u8x8_d_helper_display_init(u8x8); + u8x8_cad_SendSequence(u8x8, u8x8_d_uc1698u_240x64_init_seq); + break; + case U8X8_MSG_DISPLAY_SET_POWER_SAVE: + if ( arg_int == 0 ) + u8x8_cad_SendSequence(u8x8, u8x8_d_uc1698u_powersave0_seq); + else + u8x8_cad_SendSequence(u8x8, u8x8_d_uc1698u_powersave1_seq); + break; + case U8X8_MSG_DISPLAY_SET_FLIP_MODE: + if ( arg_int == 0 ) + { + u8x8_cad_SendSequence(u8x8, u8x8_d_uc1698u_flip0_seq); + u8x8->x_offset = u8x8->display_info->default_x_offset; + } + else + { + u8x8_cad_SendSequence(u8x8, u8x8_d_uc1698u_flip1_seq); + u8x8->x_offset = u8x8->display_info->flipmode_x_offset; + } + break; + default: + return 0; /* msg unknown */ + } + } + return 1; +} diff --git a/tools/codebuild/codebuild.c b/tools/codebuild/codebuild.c index bde5c510..52e4a994 100644 --- a/tools/codebuild/codebuild.c +++ b/tools/codebuild/codebuild.c @@ -1423,6 +1423,15 @@ struct controller controller_list[] = } }, + { + "uc1698", 30, 8, "u8g2_ll_hvline_horizontal_right_lsb", "u8x8_cad_001", "", COM_4WSPI|COM_3WSPI|COM_6800|COM_8080, + "", /* is_generate_u8g2_class= */ 1, + { + { "240x64" }, + { NULL } + } + }, + { "st7511", 40, 30, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_011", "", COM_4WSPI|COM_3WSPI|COM_6800|COM_8080, "", /* is_generate_u8g2_class= */ 1,