From 9f816225cb3f0b971142c4b05ee6c706bb32033b Mon Sep 17 00:00:00 2001 From: olikraus Date: Mon, 29 Jan 2018 23:44:50 +0100 Subject: [PATCH] patch postfix #418 --- cppsrc/U8g2lib.h | 18 +++++++++--------- csrc/u8g2.h | 9 ++++++--- csrc/u8g2_d_memory.c | 18 ++++++++++++++++++ csrc/u8g2_d_setup.c | 18 +++++++++--------- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/cppsrc/U8g2lib.h b/cppsrc/U8g2lib.h index fbfacae7..e75170d1 100644 --- a/cppsrc/U8g2lib.h +++ b/cppsrc/U8g2lib.h @@ -1544,55 +1544,55 @@ class U8G2_SH1107_64X128_F_8080 : public U8G2 { }; class U8G2_SH1107_64X128_1_SW_I2C : public U8G2 { public: U8G2_SH1107_64X128_1_SW_I2C(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t reset = U8X8_PIN_NONE) : U8G2() { - u8g2_Setup_sh1107_i2c_128x64_1(&u8g2, rotation, u8x8_byte_sw_i2c, u8x8_gpio_and_delay_arduino); + u8g2_Setup_sh1107_i2c_64x128_1(&u8g2, rotation, u8x8_byte_sw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_SW_I2C(getU8x8(), clock, data, reset); } }; class U8G2_SH1107_64X128_1_HW_I2C : public U8G2 { public: U8G2_SH1107_64X128_1_HW_I2C(const u8g2_cb_t *rotation, uint8_t reset = U8X8_PIN_NONE, uint8_t clock = U8X8_PIN_NONE, uint8_t data = U8X8_PIN_NONE) : U8G2() { - u8g2_Setup_sh1107_i2c_128x64_1(&u8g2, rotation, u8x8_byte_arduino_hw_i2c, u8x8_gpio_and_delay_arduino); + u8g2_Setup_sh1107_i2c_64x128_1(&u8g2, rotation, u8x8_byte_arduino_hw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_HW_I2C(getU8x8(), reset, clock, data); } }; class U8G2_SH1107_64X128_1_2ND_HW_I2C : public U8G2 { public: U8G2_SH1107_64X128_1_2ND_HW_I2C(const u8g2_cb_t *rotation, uint8_t reset = U8X8_PIN_NONE) : U8G2() { - u8g2_Setup_sh1107_i2c_128x64_1(&u8g2, rotation, u8x8_byte_arduino_2nd_hw_i2c, u8x8_gpio_and_delay_arduino); + u8g2_Setup_sh1107_i2c_64x128_1(&u8g2, rotation, u8x8_byte_arduino_2nd_hw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_HW_I2C(getU8x8(), reset); } }; class U8G2_SH1107_64X128_2_SW_I2C : public U8G2 { public: U8G2_SH1107_64X128_2_SW_I2C(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t reset = U8X8_PIN_NONE) : U8G2() { - u8g2_Setup_sh1107_i2c_128x64_2(&u8g2, rotation, u8x8_byte_sw_i2c, u8x8_gpio_and_delay_arduino); + u8g2_Setup_sh1107_i2c_64x128_2(&u8g2, rotation, u8x8_byte_sw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_SW_I2C(getU8x8(), clock, data, reset); } }; class U8G2_SH1107_64X128_2_HW_I2C : public U8G2 { public: U8G2_SH1107_64X128_2_HW_I2C(const u8g2_cb_t *rotation, uint8_t reset = U8X8_PIN_NONE, uint8_t clock = U8X8_PIN_NONE, uint8_t data = U8X8_PIN_NONE) : U8G2() { - u8g2_Setup_sh1107_i2c_128x64_2(&u8g2, rotation, u8x8_byte_arduino_hw_i2c, u8x8_gpio_and_delay_arduino); + u8g2_Setup_sh1107_i2c_64x128_2(&u8g2, rotation, u8x8_byte_arduino_hw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_HW_I2C(getU8x8(), reset, clock, data); } }; class U8G2_SH1107_64X128_2_2ND_HW_I2C : public U8G2 { public: U8G2_SH1107_64X128_2_2ND_HW_I2C(const u8g2_cb_t *rotation, uint8_t reset = U8X8_PIN_NONE) : U8G2() { - u8g2_Setup_sh1107_i2c_128x64_2(&u8g2, rotation, u8x8_byte_arduino_2nd_hw_i2c, u8x8_gpio_and_delay_arduino); + u8g2_Setup_sh1107_i2c_64x128_2(&u8g2, rotation, u8x8_byte_arduino_2nd_hw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_HW_I2C(getU8x8(), reset); } }; class U8G2_SH1107_64X128_F_SW_I2C : public U8G2 { public: U8G2_SH1107_64X128_F_SW_I2C(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t reset = U8X8_PIN_NONE) : U8G2() { - u8g2_Setup_sh1107_i2c_128x64_f(&u8g2, rotation, u8x8_byte_sw_i2c, u8x8_gpio_and_delay_arduino); + u8g2_Setup_sh1107_i2c_64x128_f(&u8g2, rotation, u8x8_byte_sw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_SW_I2C(getU8x8(), clock, data, reset); } }; class U8G2_SH1107_64X128_F_HW_I2C : public U8G2 { public: U8G2_SH1107_64X128_F_HW_I2C(const u8g2_cb_t *rotation, uint8_t reset = U8X8_PIN_NONE, uint8_t clock = U8X8_PIN_NONE, uint8_t data = U8X8_PIN_NONE) : U8G2() { - u8g2_Setup_sh1107_i2c_128x64_f(&u8g2, rotation, u8x8_byte_arduino_hw_i2c, u8x8_gpio_and_delay_arduino); + u8g2_Setup_sh1107_i2c_64x128_f(&u8g2, rotation, u8x8_byte_arduino_hw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_HW_I2C(getU8x8(), reset, clock, data); } }; class U8G2_SH1107_64X128_F_2ND_HW_I2C : public U8G2 { public: U8G2_SH1107_64X128_F_2ND_HW_I2C(const u8g2_cb_t *rotation, uint8_t reset = U8X8_PIN_NONE) : U8G2() { - u8g2_Setup_sh1107_i2c_128x64_f(&u8g2, rotation, u8x8_byte_arduino_2nd_hw_i2c, u8x8_gpio_and_delay_arduino); + u8g2_Setup_sh1107_i2c_64x128_f(&u8g2, rotation, u8x8_byte_arduino_2nd_hw_i2c, u8x8_gpio_and_delay_arduino); u8x8_SetPin_HW_I2C(getU8x8(), reset); } }; diff --git a/csrc/u8g2.h b/csrc/u8g2.h index eb651dfe..78115c91 100644 --- a/csrc/u8g2.h +++ b/csrc/u8g2.h @@ -424,6 +424,9 @@ uint8_t *u8g2_m_16_4_f(uint8_t *page_cnt); uint8_t *u8g2_m_16_8_1(uint8_t *page_cnt); uint8_t *u8g2_m_16_8_2(uint8_t *page_cnt); uint8_t *u8g2_m_16_8_f(uint8_t *page_cnt); +uint8_t *u8g2_m_8_16_1(uint8_t *page_cnt); +uint8_t *u8g2_m_8_16_2(uint8_t *page_cnt); +uint8_t *u8g2_m_8_16_f(uint8_t *page_cnt); uint8_t *u8g2_m_12_12_1(uint8_t *page_cnt); uint8_t *u8g2_m_12_12_2(uint8_t *page_cnt); uint8_t *u8g2_m_12_12_f(uint8_t *page_cnt); @@ -567,9 +570,9 @@ void u8g2_Setup_sh1106_i2c_128x64_winstar_f(u8g2_t *u8g2, const u8g2_cb_t *rotat void u8g2_Setup_sh1107_64x128_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_sh1107_64x128_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_sh1107_64x128_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); -void u8g2_Setup_sh1107_i2c_128x64_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); -void u8g2_Setup_sh1107_i2c_128x64_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); -void u8g2_Setup_sh1107_i2c_128x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); +void u8g2_Setup_sh1107_i2c_64x128_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); +void u8g2_Setup_sh1107_i2c_64x128_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); +void u8g2_Setup_sh1107_i2c_64x128_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_sh1107_seeed_96x96_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_sh1107_seeed_96x96_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_sh1107_seeed_96x96_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_memory.c b/csrc/u8g2_d_memory.c index e9417b0f..b2a7ef47 100644 --- a/csrc/u8g2_d_memory.c +++ b/csrc/u8g2_d_memory.c @@ -39,6 +39,24 @@ uint8_t *u8g2_m_16_8_f(uint8_t *page_cnt) *page_cnt = 8; return buf; } +uint8_t *u8g2_m_8_16_1(uint8_t *page_cnt) +{ + static uint8_t buf[64]; + *page_cnt = 1; + return buf; +} +uint8_t *u8g2_m_8_16_2(uint8_t *page_cnt) +{ + static uint8_t buf[128]; + *page_cnt = 2; + return buf; +} +uint8_t *u8g2_m_8_16_f(uint8_t *page_cnt) +{ + static uint8_t buf[1024]; + *page_cnt = 16; + return buf; +} uint8_t *u8g2_m_12_12_1(uint8_t *page_cnt) { static uint8_t buf[96]; diff --git a/csrc/u8g2_d_setup.c b/csrc/u8g2_d_setup.c index 340262b0..1d4ec0ba 100644 --- a/csrc/u8g2_d_setup.c +++ b/csrc/u8g2_d_setup.c @@ -370,7 +370,7 @@ void u8g2_Setup_sh1107_64x128_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_ms uint8_t tile_buf_height; uint8_t *buf; u8g2_SetupDisplay(u8g2, u8x8_d_sh1107_64x128, u8x8_cad_001, byte_cb, gpio_and_delay_cb); - buf = u8g2_m_16_8_1(&tile_buf_height); + buf = u8g2_m_8_16_1(&tile_buf_height); u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); } /* sh1107 2 */ @@ -379,7 +379,7 @@ void u8g2_Setup_sh1107_64x128_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_ms uint8_t tile_buf_height; uint8_t *buf; u8g2_SetupDisplay(u8g2, u8x8_d_sh1107_64x128, u8x8_cad_001, byte_cb, gpio_and_delay_cb); - buf = u8g2_m_16_8_2(&tile_buf_height); + buf = u8g2_m_8_16_2(&tile_buf_height); u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); } /* sh1107 f */ @@ -388,35 +388,35 @@ void u8g2_Setup_sh1107_64x128_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_ms uint8_t tile_buf_height; uint8_t *buf; u8g2_SetupDisplay(u8g2, u8x8_d_sh1107_64x128, u8x8_cad_001, byte_cb, gpio_and_delay_cb); - buf = u8g2_m_16_8_f(&tile_buf_height); + buf = u8g2_m_8_16_f(&tile_buf_height); u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); } /* sh1107 */ /* sh1107 1 */ -void u8g2_Setup_sh1107_i2c_128x64_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) +void u8g2_Setup_sh1107_i2c_64x128_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_sh1107_64x128, u8x8_cad_ssd13xx_i2c, byte_cb, gpio_and_delay_cb); - buf = u8g2_m_16_8_1(&tile_buf_height); + buf = u8g2_m_8_16_1(&tile_buf_height); u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); } /* sh1107 2 */ -void u8g2_Setup_sh1107_i2c_128x64_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) +void u8g2_Setup_sh1107_i2c_64x128_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_sh1107_64x128, u8x8_cad_ssd13xx_i2c, byte_cb, gpio_and_delay_cb); - buf = u8g2_m_16_8_2(&tile_buf_height); + buf = u8g2_m_8_16_2(&tile_buf_height); u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); } /* sh1107 f */ -void u8g2_Setup_sh1107_i2c_128x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) +void u8g2_Setup_sh1107_i2c_64x128_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_sh1107_64x128, u8x8_cad_ssd13xx_i2c, byte_cb, gpio_and_delay_cb); - buf = u8g2_m_16_8_f(&tile_buf_height); + buf = u8g2_m_8_16_f(&tile_buf_height); u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); } /* sh1107 */