From 530c353ff8bd4ce184851b1b700dd5c93706c7e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Sun, 28 Apr 2019 15:45:04 +0200 Subject: [PATCH] Update u8g2 to v2.25.10 (#2735) * Upgrade u8g2 and add updateDisplayArea bindings * u8g2 2.25.10 * add displays for 2.24.3 and 2.25.10 * remove workaround for hal pointer and make use of u8x8's user_ptr * fix doc * add binding for `updateDisplay()` --- app/include/u8g2_displays.h | 197 +++++++++++++++++--------------- app/modules/u8g2.c | 34 +++++- app/platform/u8x8_nodemcu_hal.c | 15 +-- app/platform/u8x8_nodemcu_hal.h | 1 - app/u8g2lib/Makefile | 2 +- app/u8g2lib/u8g2 | 2 +- docs/modules/u8g2.md | 27 ++++- 7 files changed, 167 insertions(+), 111 deletions(-) diff --git a/app/include/u8g2_displays.h b/app/include/u8g2_displays.h index ba5c3426..b074ef1a 100644 --- a/app/include/u8g2_displays.h +++ b/app/include/u8g2_displays.h @@ -7,50 +7,53 @@ // *************************************************************************** // Enable display drivers // -// Uncomment the U8G2_DISPLAY_TABLE_ENTRY for the device(s) you want to -// compile into the firmware. +// Copy the uncommented U8G2_DISPLAY_TABLE_ENTRY for the device(s) you want to +// compile into the firmware to U8G2_DISPLAY_TABLE_I2C or U8G2_DISPLAY_TABLE_SPI. // Stick to the assignments to *_I2C and *_SPI tables. #ifndef U8G2_DISPLAY_TABLE_I2C_EXTRA // I2C based displays go into here: -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1610_i2c_ea_dogxl160_f, uc1610_i2c_ea_dogxl160) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1325_i2c_nhd_128x64_f, ssd1325_i2c_nhd_128x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_64x48_er_f, ssd1306_i2c_64x48_er) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1608_i2c_erc24064_f, uc1608_i2c_erc24064) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7588_i2c_jlx12864_f, st7588_i2c_jlx12864) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1309_i2c_128x64_noname0_f, ssd1309_i2c_128x64_noname0) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_i2c_ea_dogxl240_f, uc1611_i2c_ea_dogxl240) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1305_i2c_128x32_noname_f, ssd1305_i2c_128x32_noname) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x32_univision_f, ssd1306_i2c_128x32_univision) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1608_i2c_240x128_f, uc1608_i2c_240x128) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ld7032_i2c_60x32_f, ld7032_i2c_60x32) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_i2c_ew50850_f, uc1611_i2c_ew50850) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1604_i2c_jlx19264_f, uc1604_i2c_jlx19264) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1601_i2c_128x32_f, uc1601_i2c_128x32) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1106_i2c_128x64_vcomh0_f, sh1106_i2c_128x64_vcomh0) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_96x16_er_f, ssd1306_i2c_96x16_er) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1106_i2c_128x64_noname_f, sh1106_i2c_128x64_noname) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1107_i2c_64x128_f, sh1107_i2c_64x128) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1107_i2c_seeed_96x96_f, sh1107_i2c_seeed_96x96) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1107_i2c_128x128_f, sh1107_i2c_128x128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1107_i2c_seeed_96x96_f, sh1107_i2c_seeed_96x96) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1108_i2c_160x160_f, sh1108_i2c_160x160) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1122_i2c_256x64_f, sh1122_i2c_256x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x64_vcomh0_f, ssd1306_i2c_128x64_vcomh0) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x64_noname_f, ssd1306_i2c_128x64_noname) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1309_i2c_128x64_noname2_f, ssd1309_i2c_128x64_noname2) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd0323_i2c_os128064_f, ssd0323_i2c_os128064) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1305_i2c_128x32_noname_f, ssd1305_i2c_128x32_noname) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_64x48_er_f, ssd1306_i2c_64x48_er) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_96x16_er_f, ssd1306_i2c_96x16_er) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x32_univision_f, ssd1306_i2c_128x32_univision) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x64_alt0_f, ssd1306_i2c_128x64_alt0) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_i2c_ea_dogm240_f, uc1611_i2c_ea_dogm240) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x64_noname_f, ssd1306_i2c_128x64_noname) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x64_vcomh0_f, ssd1306_i2c_128x64_vcomh0) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1309_i2c_128x64_noname0_f, ssd1309_i2c_128x64_noname0) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1309_i2c_128x64_noname2_f, ssd1309_i2c_128x64_noname2) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1318_i2c_128x96_f, ssd1318_i2c_128x96) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1318_i2c_128x96_xcp_f, ssd1318_i2c_128x96_xcp) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1325_i2c_nhd_128x64_f, ssd1325_i2c_nhd_128x64) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1326_i2c_er_256x32_f, ssd1326_i2c_er_256x32 )\ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1327_i2c_seeed_96x96_f, ssd1327_i2c_seeed_96x96) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1327_i2c_ea_w128128_f, ssd1327_i2c_ea_w128128) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1327_i2c_midas_128x128_f, ssd1327_i2c_midas_128x128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1327_i2c_seeed_96x96_f, ssd1327_i2c_seeed_96x96) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7567_i2c_64x32_f, st7567_i2c_64x32) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7588_i2c_jlx12864_f, st7588_i2c_jlx12864) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_i2c_jlx256128_f, st75256_i2c_jlx256128) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_i2c_jlx256160_f, st75256_i2c_jlx256160) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_i2c_jlx240160_f, st75256_i2c_jlx240160) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_i2c_jlx25664_f, st75256_i2c_jlx25664) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_i2c_jlx172104_f, st75256_i2c_jlx172104) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1601_i2c_128x32_f, uc1601_i2c_128x32) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1604_i2c_jlx19264_f, uc1604_i2c_jlx19264) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1608_i2c_240x128_f, uc1608_i2c_240x128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1608_i2c_erc24064_f, uc1608_i2c_erc24064) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1610_i2c_ea_dogxl160_f, uc1610_i2c_ea_dogxl160) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_i2c_ea_dogm240_f, uc1611_i2c_ea_dogm240) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_i2c_ea_dogxl240_f, uc1611_i2c_ea_dogxl240) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_i2c_ew50850_f, uc1611_i2c_ew50850) \ #define U8G2_DISPLAY_TABLE_I2C \ U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x64_noname_f, ssd1306_i2c_128x64_noname) \ @@ -67,83 +70,89 @@ #ifndef U8G2_DISPLAY_TABLE_SPI_EXTRA // SPI based displays go into here: -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1606_172x72_f, ssd1606_172x72) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1608_240x128_f, uc1608_240x128) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_erc12864_f, st7565_erc12864) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1309_128x64_noname0_f, ssd1309_128x64_noname0) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1601_128x32_f, uc1601_128x32) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1608_erc24064_f, uc1608_erc24064) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_lm6059_f, st7565_lm6059) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_ea_dogxl240_f, uc1611_ea_dogxl240) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_nhd_c12864_f, st7565_nhd_c12864) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_128x64_vcomh0_f, ssd1306_128x64_vcomh0) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1305_128x32_noname_f, ssd1305_128x32_noname) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_max7219_32x8_f, max7219_32x8) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ls013b7dh03_128x128_f, ls013b7dh03_128x128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_hx1230_96x68_f, hx1230_96x68) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_il3820_v2_296x128_f, il3820_v2_296x128) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1610_ea_dogxl160_f, uc1610_ea_dogxl160) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_ea_dogm240_f, uc1611_ea_dogm240) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1604_jlx19264_f, uc1604_jlx19264) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7920_s_192x32_f, st7920_s_192x32) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1325_nhd_128x64_f, ssd1325_nhd_128x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_128x64_noname_f, ssd1306_128x64_noname) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_128x64_alt0_f, ssd1306_128x64_alt0) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sed1520_122x32_f, sed1520_122x32) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_ea_dogm128_f, st7565_ea_dogm128) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ld7032_60x32_f, ld7032_60x32) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1607_200x200_f, ssd1607_200x200) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1309_128x64_noname2_f, ssd1309_128x64_noname2) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1106_128x64_noname_f, sh1106_128x64_noname) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1107_64x128_f, sh1107_64x128) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1107_seeed_96x96_f, sh1107_seeed_96x96) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1107_128x128_f, sh1107_128x128) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1108_160x160_f, sh1108_160x160) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1122_256x64_f, sh1122_256x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_128x32_univision_f, ssd1306_128x32_univision) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7920_s_128x64_f, st7920_s_128x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_64128n_f, st7565_64128n) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1701_ea_dogs102_f, uc1701_ea_dogs102) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_ew50850_f, uc1611_ew50850) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1322_nhd_256x64_f, ssd1322_nhd_256x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1322_nhd_128x64_f, ssd1322_nhd_128x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_ea_dogm132_f, st7565_ea_dogm132) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1329_128x96_noname_f, ssd1329_128x96_noname) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_zolen_128x64_f, st7565_zolen_128x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_jlx256128_f, st75256_jlx256128) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_96x16_er_f, ssd1306_96x16_er) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ist3020_erc19264_f, ist3020_erc19264) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7588_jlx12864_f, st7588_jlx12864) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1326_er_256x32_f, ssd1326_er_256x32 )\ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1327_seeed_96x96_f, ssd1327_seeed_96x96) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1327_ea_w128128_f, ssd1327_ea_w128128) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1327_midas_128x128_f, ssd1327_midas_128x128) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_jlx172104_f, st75256_jlx172104) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_nhd_c12832_f, st7565_nhd_c12832) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_jlx256160_f, st75256_jlx256160) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_jlx240160_f, st75256_jlx240160) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_jlx25664_f, st75256_jlx25664) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_64x48_er_f, ssd1306_64x48_er) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_pcf8812_96x65_f, pcf8812_96x65) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7567_pi_132x64_f, st7567_pi_132x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7567_jlx12864_f, st7567_jlx12864) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7567_enh_dg128064i_f, st7567_enh_dg128064i) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7567_64x32_f, st7567_64x32) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7586s_s028hn118a_f, st7586s_s028hn118a) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7586s_erc240160_f, st7586s_erc240160) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_pcd8544_84x48_f, pcd8544_84x48) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1106_128x64_vcomh0_f, sh1106_128x64_vcomh0) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_nt7534_tg12864r_f, nt7534_tg12864r) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1701_mini12864_f, uc1701_mini12864) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_t6963_240x128_f, t6963_240x128) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_t6963_240x64_f, t6963_240x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_t6963_256x64_f, t6963_256x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_t6963_128x64_f, t6963_128x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_t6963_160x80_f, t6963_160x80) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_lc7981_160x80_f, lc7981_160x80) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_lc7981_160x160_f, lc7981_160x160) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_lc7981_240x128_f, lc7981_240x128) \ // U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_lc7981_240x64_f, lc7981_240x64) \ -// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_hx1230_96x68_f, hx1230_96x68) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_lc7981_240x128_f, lc7981_240x128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ld7032_60x32_f, ld7032_60x32) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ls013b7dh03_128x128_f, ls013b7dh03_128x128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_max7219_32x8_f, max7219_32x8) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_nt7534_tg12864r_f, nt7534_tg12864r) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_pcd8544_84x48_f, pcd8544_84x48) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_pcf8812_96x65_f, pcf8812_96x65) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sed1520_122x32_f, sed1520_122x32) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1107_64x128_f, sh1107_64x128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1106_128x64_noname_f, sh1106_128x64_noname) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1106_128x64_vcomh0_f, sh1106_128x64_vcomh0) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1107_128x128_f, sh1107_128x128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1108_160x160_f, sh1108_160x160) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1107_seeed_96x96_f, sh1107_seeed_96x96) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_sh1122_256x64_f, sh1122_256x64) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd0323_os128064_f, ssd0323_os128064) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1305_128x32_noname_f, ssd1305_128x32_noname) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_64x48_er_f, ssd1306_64x48_er) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_96x16_er_f, ssd1306_96x16_er) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_128x32_univision_f, ssd1306_128x32_univision) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_128x64_alt0_f, ssd1306_128x64_alt0) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_128x64_noname_f, ssd1306_128x64_noname) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_128x64_vcomh0_f, ssd1306_128x64_vcomh0) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1309_128x64_noname0_f, ssd1309_128x64_noname0) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1309_128x64_noname2_f, ssd1309_128x64_noname2) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1318_128x96_f, ssd1318_128x96) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1318_128x96_xcp_f, ssd1318_128x96_xcp) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1322_nhd_128x64_f, ssd1322_nhd_128x64) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1322_nhd_256x64_f, ssd1322_nhd_256x64) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1325_nhd_128x64_f, ssd1325_nhd_128x64) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1326_er_256x32_f, ssd1326_er_256x32 )\ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1327_ea_w128128_f, ssd1327_ea_w128128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1327_midas_128x128_f, ssd1327_midas_128x128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1327_seeed_96x96_f, ssd1327_seeed_96x96) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1329_128x96_noname_f, ssd1329_128x96_noname) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1606_172x72_f, ssd1606_172x72) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1607_200x200_f, ssd1607_200x200) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1607_gd_200x200_f, ssd1607_gd_200x200) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1607_ws_200x200_f, ssd1607_ws_200x200) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_64128n_f, st7565_64128n) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_ea_dogm132_f, st7565_ea_dogm132) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_ea_dogm128_f, st7565_ea_dogm128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_erc12864_f, st7565_erc12864) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_erc12864_alt_f, st7565_erc12864_alt) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_lm6059_f, st7565_lm6059) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_nhd_c12832_f, st7565_nhd_c12832) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_nhd_c12864_f, st7565_nhd_c12864) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7565_zolen_128x64_f, st7565_zolen_128x64) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7567_enh_dg128064i_f, st7567_enh_dg128064i) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7567_64x32_f, st7567_64x32) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7567_jlx12864_f, st7567_jlx12864) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7567_pi_132x64_f, st7567_pi_132x64) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7586s_erc240160_f, st7586s_erc240160) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7586s_s028hn118a_f, st7586s_s028hn118a) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7588_jlx12864_f, st7588_jlx12864) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7920_s_192x32_f, st7920_s_192x32) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st7920_s_128x64_f, st7920_s_128x64) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_jlx25664_f, st75256_jlx25664) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_jlx172104_f, st75256_jlx172104) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_jlx240160_f, st75256_jlx240160) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_jlx256128_f, st75256_jlx256128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_st75256_jlx256160_f, st75256_jlx256160) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_t6963_128x64_f, t6963_128x64) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_t6963_160x80_f, t6963_160x80) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_t6963_240x64_f, t6963_240x64) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_t6963_240x128_f, t6963_240x128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_t6963_256x64_f, t6963_256x64) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1601_128x32_f, uc1601_128x32) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1604_jlx19264_f, uc1604_jlx19264) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1608_240x128_f, uc1608_240x128) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1608_erc24064_f, uc1608_erc24064) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1610_ea_dogxl160_f, uc1610_ea_dogxl160) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_ea_dogm240_f, uc1611_ea_dogm240) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_ea_dogxl240_f, uc1611_ea_dogxl240) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1611_ew50850_f, uc1611_ew50850) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1701_ea_dogs102_f, uc1701_ea_dogs102) \ +// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1701_mini12864_f, uc1701_mini12864) \ #define U8G2_DISPLAY_TABLE_SPI \ U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_128x64_noname_f, ssd1306_128x64_noname) \ diff --git a/app/modules/u8g2.c b/app/modules/u8g2.c index b613b5ea..6af428bd 100644 --- a/app/modules/u8g2.c +++ b/app/modules/u8g2.c @@ -11,6 +11,7 @@ #include "lauxlib.h" #define U8X8_USE_PINS +#define U8X8_WITH_USER_PTR #include "u8g2.h" #include "u8x8_nodemcu_hal.h" @@ -540,6 +541,29 @@ static int lu8g2_setPowerSave( lua_State *L ) return 0; } +static int lu8g2_updateDisplay( lua_State *L ) +{ + GET_U8G2(); + + u8g2_UpdateDisplay( u8g2 ); + +} + +static int lu8g2_updateDisplayArea( lua_State *L ) +{ + GET_U8G2(); + int stack = 1; + + int x = luaL_checkint( L, ++stack ); + int y = luaL_checkint( L, ++stack ); + int w = luaL_checkint( L, ++stack ); + int h = luaL_checkint( L, ++stack ); + + u8g2_UpdateDisplayArea( u8g2, x, y, w, h ); + + return 0; +} + static const LUA_REG_TYPE lu8g2_display_map[] = { { LSTRKEY( "clearBuffer" ), LFUNCVAL( lu8g2_clearBuffer ) }, @@ -581,6 +605,8 @@ static const LUA_REG_TYPE lu8g2_display_map[] = { { LSTRKEY( "setFontRefHeightExtendedText" ), LFUNCVAL( lu8g2_setFontRefHeightExtendedText ) }, { LSTRKEY( "setFontRefHeightText" ), LFUNCVAL( lu8g2_setFontRefHeightText ) }, { LSTRKEY( "setPowerSave" ), LFUNCVAL( lu8g2_setPowerSave ) }, + { LSTRKEY( "updateDispla" ), LFUNCVAL( lu8g2_updateDisplay ) }, + { LSTRKEY( "updateDisplayArea" ), LFUNCVAL( lu8g2_updateDisplayArea ) }, //{ LSTRKEY( "__gc" ), LFUNCVAL( lu8g2_display_free ) }, { LSTRKEY( "__index" ), LROVAL( lu8g2_display_map ) }, {LNILKEY, LNILVAL} @@ -622,11 +648,11 @@ static int ldisplay_i2c( lua_State *L, display_setup_fn_t setup_fn ) u8g2_nodemcu_t *ext_u8g2 = &(ud->u8g2); ud->font_ref = LUA_NOREF; ud->host_ref = LUA_NOREF; - /* the i2c driver id is forwarded in the hal member */ - ext_u8g2->hal = id >= 0 ? (void *)id : NULL; u8g2_t *u8g2 = (u8g2_t *)ext_u8g2; u8x8_t *u8x8 = (u8x8_t *)u8g2; + /* the i2c driver id is forwarded in the user pointer */ + u8x8->user_ptr = id >= 0 ? (void *)id : NULL; setup_fn( u8g2, U8G2_R0, u8x8_byte_nodemcu_i2c, u8x8_gpio_and_delay_nodemcu ); @@ -715,11 +741,11 @@ static int ldisplay_spi( lua_State *L, display_setup_fn_t setup_fn ) u8g2_nodemcu_t *ext_u8g2 = &(ud->u8g2); ud->font_ref = LUA_NOREF; ud->host_ref = host_ref; - /* the spi host id is forwarded in the hal member */ - ext_u8g2->hal = host ? (void *)(host->host) : NULL; u8g2_t *u8g2 = (u8g2_t *)ext_u8g2; u8x8_t *u8x8 = (u8x8_t *)u8g2; + /* the spi host id is forwarded in the user pointer */ + u8x8->user_ptr = host ? (void *)(host->host) : NULL; setup_fn( u8g2, U8G2_R0, u8x8_byte_nodemcu_spi, u8x8_gpio_and_delay_nodemcu ); diff --git a/app/platform/u8x8_nodemcu_hal.c b/app/platform/u8x8_nodemcu_hal.c index 509a01b4..321a3093 100644 --- a/app/platform/u8x8_nodemcu_hal.c +++ b/app/platform/u8x8_nodemcu_hal.c @@ -11,6 +11,7 @@ #include "platform.h" #define U8X8_USE_PINS +#define U8X8_WITH_USER_PTR #include "u8x8_nodemcu_hal.h" // static variables containing info about the i2c link @@ -45,7 +46,7 @@ static void force_flush_buffer(u8x8_t *u8x8) { // spi hal has a buffer that can be flushed if (u8x8->byte_cb == u8x8_byte_nodemcu_spi) { - hal_spi_t *hal = ((u8g2_nodemcu_t *)u8x8)->hal; + hal_spi_t *hal = u8x8->user_ptr; flush_buffer_spi( hal ); } } @@ -164,7 +165,7 @@ uint8_t u8x8_gpio_and_delay_nodemcu(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, uint8_t u8x8_byte_nodemcu_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { uint8_t *data; - hal_i2c_t *hal = ((u8g2_nodemcu_t *)u8x8)->hal; + hal_i2c_t *hal = u8x8->user_ptr; switch(msg) { case U8X8_MSG_BYTE_SEND: @@ -186,12 +187,12 @@ uint8_t u8x8_byte_nodemcu_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void * case U8X8_MSG_BYTE_INIT: { - // the hal member initially contains the i2c id + // the user pointer initially contains the i2c id int id = (int)hal; if (!(hal = c_malloc( sizeof ( hal_i2c_t ) ))) return 0; hal->id = id; - ((u8g2_nodemcu_t *)u8x8)->hal = hal; + u8x8->user_ptr = hal; } break; @@ -229,7 +230,7 @@ uint8_t u8x8_byte_nodemcu_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void * uint8_t u8x8_byte_nodemcu_spi(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { - hal_spi_t *hal = ((u8g2_nodemcu_t *)u8x8)->hal; + hal_spi_t *hal = u8x8->user_ptr; switch(msg) { case U8X8_MSG_BYTE_INIT: @@ -237,12 +238,12 @@ uint8_t u8x8_byte_nodemcu_spi(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void * /* disable chipselect */ u8x8_gpio_SetCS( u8x8, u8x8->display_info->chip_disable_level ); - // the hal member initially contains the spi host id + // the user pointer initially contains the spi host id int host = (int)hal; if (!(hal = c_malloc( sizeof ( hal_spi_t ) ))) return 0; hal->host = host; - ((u8g2_nodemcu_t *)u8x8)->hal = hal; + u8x8->user_ptr = hal; hal->buffer.data = NULL; hal->last_dc = 0; diff --git a/app/platform/u8x8_nodemcu_hal.h b/app/platform/u8x8_nodemcu_hal.h index 22a17402..6557dfdb 100644 --- a/app/platform/u8x8_nodemcu_hal.h +++ b/app/platform/u8x8_nodemcu_hal.h @@ -8,7 +8,6 @@ // extend standard u8g2_t struct with info that's needed in the communication callbacks typedef struct { u8g2_t u8g2; - void *hal; // elements for the overlay display driver struct { diff --git a/app/u8g2lib/Makefile b/app/u8g2lib/Makefile index 1343a949..e1b0b82d 100644 --- a/app/u8g2lib/Makefile +++ b/app/u8g2lib/Makefile @@ -24,7 +24,7 @@ STD_CFLAGS=-std=gnu11 -Wimplicit # makefile at its root level - these are then overridden # for a subtree within the makefile rooted therein # -DEFINES += -DU8X8_USE_PINS -DU8G2_USE_LARGE_FONTS +DEFINES += -DU8X8_USE_PINS -DU8G2_USE_LARGE_FONTS -DU8X8_WITH_USER_PTR ############################################################# # Recursion Magic - Don't touch this!! diff --git a/app/u8g2lib/u8g2 b/app/u8g2lib/u8g2 index d4da8254..2ee84c8f 160000 --- a/app/u8g2lib/u8g2 +++ b/app/u8g2lib/u8g2 @@ -1 +1 @@ -Subproject commit d4da8254220adf39db44faa52a0842967095d230 +Subproject commit 2ee84c8f14adaa8fd1ebfe091c4de348c5474b18 diff --git a/docs/modules/u8g2.md b/docs/modules/u8g2.md index 90b753a1..ad7a90e5 100644 --- a/docs/modules/u8g2.md +++ b/docs/modules/u8g2.md @@ -43,9 +43,11 @@ The NodeMCU firmware supports the following displays in I²C and SPI mode: - sh1106 128x64 - sh1107 - variants 64x128, seeed 96x96, 128x128 - sh1108 160x160 +- ssd0323 os128064 - ssd1305 128x32 - ssd1306 - variants 128x32, 128x64, 64x48, and 96x16 - ssd1309 128x64 +- ssd1318 128x96, 128x96_xcp - ssd1325 128x63 - ssd1326 er 256x32 - ssd1327 - variants 96x96, ea w128128, and midas 128x128 @@ -73,15 +75,15 @@ SPI only: - ssd1322 nhd 256x64 and nhd 128x64 variants - ssd1329 128x96 - ssd1606 172x72 -- ssd1607 200x200 -- st7565 - variants 64128n, dogm128/132, erc12864, lm6059, c12832/c12864, and zolen 128x64 +- ssd1607 200x200, gd_200x200, ws_200x200 +- st7565 - variants 64128n, dogm128/132, erc12864, erc12864_alt, lm6059, c12832/c12864, and zolen 128x64 - st7567 - variants 132x64, jlx12864, and enh_dg128064i - st7586 - s028hn118a and erc240160 variants - st75256 - jlx172104 and jlx256128 variants - t6963 - variants 240x128, 240x64, 256x64, 128x64, and 160x80 - uc1701 - dogs102 and mini12864 variants -This integration uses full "RAM" memory buffer without picture loop and calls u8g2's `begin()` internally when creating a display object. It is based on [v2.23.18](https://github.com/olikraus/U8g2_Arduino/releases/tag/2.23.18). +This integration uses full "RAM" memory buffer without picture loop and calls u8g2's `begin()` internally when creating a display object. It is based on [v2.25.10](https://github.com/olikraus/U8g2_Arduino/releases/tag/2.25.10). ## Overview @@ -165,6 +167,7 @@ Initialize a display via I²C. - `u8g2.sh1107_i2c_seeed_96x96()` - `u8g2.sh1107_i2c_128x128()` - `u8g2.sh1108_i2c_160x160()` +- `u8g2.ssd0323_i2c_os128064()` - `u8g2.ssd1305_i2c_128x32_noname()` - `u8g2.ssd1306_i2c_128x32_univision()` - `u8g2.ssd1306_i2c_128x64_noname()` @@ -174,6 +177,8 @@ Initialize a display via I²C. - `u8g2.ssd1306_i2c_128x64_alt0()` - `u8g2.ssd1306_i2c_64x48_er()` - `u8g2.ssd1306_i2c_96x16_er()` +- `u8g2.ssd1318_i2c_128x96()` +- `u8g2.ssd1318_i2c_128x96_xcp()` - `u8g2.ssd1325_i2c_nhd_128x64()` - `u8g2.ssd1326_i2c_er_256x32()` - `u8g2.ssd1327_i2c_seeed_96x96()` @@ -249,6 +254,7 @@ Initialize a display via Hardware SPI. - `u8g2.sh1107_128x128()` - `u8g2.sh1108_160x160()` - `u8g2.sh1122_256x64()` +- `u8g2.ssd0323_os128064()` - `u8g2.ssd1305_128x32_noname()` - `u8g2.ssd1306_128x32_univision()` - `u8g2.ssd1306_128x64_noname()` @@ -258,6 +264,8 @@ Initialize a display via Hardware SPI. - `u8g2.ssd1306_96x16_er()` - `u8g2.ssd1309_128x64_noname0()` - `u8g2.ssd1309_128x64_noname2()` +- `u8g2.ssd1318_128x96()` +- `u8g2.ssd1318_128x96_xcp()` - `u8g2.ssd1322_nhd_128x64()` - `u8g2.ssd1326_er_256x32()` - `u8g2.ssd1327_ea_w128128()` @@ -269,10 +277,13 @@ Initialize a display via Hardware SPI. - `u8g2.sed1520_122x32()` - `u8g2.ssd1606_172x72()` - `u8g2.ssd1607_200x200()` +- `u8g2.ssd1607_gd_200x200()` +- `u8g2.ssd1607_ws_200x200()` - `u8g2.st7565_64128n()` - `u8g2.st7565_ea_dogm128()` - `u8g2.st7565_ea_dogm132()` - `u8g2.st7565_erc12864()` +- `u8g2.st7565_erc12864_alt()` - `u8g2.st7565_lm6059()` - `u8g2.st7565_nhd_c12832()` - `u8g2.st7565_nhd_c12864()` @@ -590,3 +601,13 @@ See [u8g2 setFontRefHeightText()](https://github.com/olikraus/u8g2/wiki/u8g2refe Activate or disable power save mode of the display. See [u8g2 setPowerSave()](https://github.com/olikraus/u8g2/wiki/u8g2reference#setpowersave). + +## u8g2.disp:updateDisplay() +Updates the display. + +See [u8g2 updateDisplay()](https://github.com/olikraus/u8g2/wiki/u8g2reference#updateDisplay). + +## u8g2.disp:updateDisplayArea() +Updates the specified rectangle area of the display. + +See [u8g2 updateDisplayArea()](https://github.com/olikraus/u8g2/wiki/u8g2reference#updateDisplayArea).