update to u8g2 2.25.10
- new displays - binding for updateDisplay() and updateDisplayArea() - use user_ptr instead of hal workaround
This commit is contained in:
parent
511bc01dce
commit
5faf76b762
|
@ -5,6 +5,7 @@
|
|||
#include "lauxlib.h"
|
||||
|
||||
#define U8X8_USE_PINS
|
||||
#define U8X8_WITH_USER_PTR
|
||||
#include "u8g2.h"
|
||||
#include "u8x8_nodemcu_hal.h"
|
||||
|
||||
|
@ -534,6 +535,30 @@ static int lu8g2_setPowerSave( lua_State *L )
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lu8g2_updateDisplay( lua_State *L )
|
||||
{
|
||||
GET_U8G2();
|
||||
|
||||
u8g2_UpdateDisplay( u8g2 );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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 ) },
|
||||
|
@ -575,6 +600,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}
|
||||
|
@ -616,11 +643,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 hal member */
|
||||
u8x8->user_ptr = id >= 0 ? (void *)id : NULL;
|
||||
|
||||
setup_fn( u8g2, U8G2_R0, u8x8_byte_nodemcu_i2c, u8x8_gpio_and_delay_nodemcu );
|
||||
|
||||
|
@ -709,11 +736,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 hal member */
|
||||
u8x8->user_ptr = host ? (void *)(host->host) : NULL;
|
||||
|
||||
setup_fn( u8g2, U8G2_R0, u8x8_byte_nodemcu_spi, u8x8_gpio_and_delay_nodemcu );
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
COMPONENT_ADD_INCLUDEDIRS:=include
|
||||
# for u8x8
|
||||
CPPFLAGS+=-DU8X8_USE_PINS
|
||||
CPPFLAGS+=-DU8X8_USE_PINS -DU8X8_WITH_USER_PTR
|
||||
# for ucg
|
||||
CPPFLAGS+=-DUSE_PIN_LIST
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -141,7 +141,7 @@ typedef struct {
|
|||
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:
|
||||
|
@ -168,12 +168,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 = malloc( sizeof ( hal_i2c_t ) )))
|
||||
return 0;
|
||||
hal->id = id;
|
||||
((u8g2_nodemcu_t *)u8x8)->hal = hal;
|
||||
u8x8->user_ptr = hal;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -249,7 +249,7 @@ static void flush_buffer_spi( hal_spi_t *hal )
|
|||
|
||||
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:
|
||||
|
@ -257,12 +257,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 = malloc( sizeof ( hal_spi_t ) )))
|
||||
return 0;
|
||||
hal->host = host;
|
||||
((u8g2_nodemcu_t *)u8x8)->hal = hal;
|
||||
u8x8->user_ptr = hal;
|
||||
|
||||
// set up the spi device
|
||||
spi_device_interface_config_t config;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
COMPONENT_SRCDIRS:=u8g2/src/clib .
|
||||
COMPONENT_ADD_INCLUDEDIRS:=u8g2/src/clib
|
||||
CPPFLAGS+=-DU8X8_USE_PINS
|
||||
CPPFLAGS+=-DU8X8_USE_PINS -DU8X8_WITH_USER_PTR
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d4da8254220adf39db44faa52a0842967095d230
|
||||
Subproject commit 2ee84c8f14adaa8fd1ebfe091c4de348c5474b18
|
|
@ -41,6 +41,11 @@ config U8G2_I2C_SH1108_160X160
|
|||
bool "sh1108_i2c_160x160"
|
||||
default "n"
|
||||
|
||||
config U8G2_I2C_SSD0323_OS128064
|
||||
depends on U8G2_COMM_I2C
|
||||
bool "ssd0323_i2c_os128064"
|
||||
default "n"
|
||||
|
||||
config U8G2_I2C_SSD1305_128X32_NONAME
|
||||
depends on U8G2_COMM_I2C
|
||||
bool "ssd1305_i2c_128x32_noname"
|
||||
|
@ -86,6 +91,16 @@ config U8G2_I2C_SSD1309_128X64_NONAME2
|
|||
bool "ssd1309_i2c_128x64_noname2"
|
||||
default "n"
|
||||
|
||||
config U8G2_I2C_SSD1318_128X96
|
||||
depends on U8G2_COMM_I2C
|
||||
bool "ssd1318_i2c_128x96"
|
||||
default "n"
|
||||
|
||||
config U8G2_I2C_SSD1318_128X96_XCP
|
||||
depends on U8G2_COMM_I2C
|
||||
bool "ssd1318_i2c_128x96_xcp"
|
||||
default "n"
|
||||
|
||||
config U8G2_I2C_SSD1325_NHD_128X64
|
||||
depends on U8G2_COMM_I2C
|
||||
bool "ssd1325_i2c_nhd_128x64"
|
||||
|
@ -297,6 +312,11 @@ config U8G2_SPI_SH1122_256X64
|
|||
bool "sh1122_256x64"
|
||||
default "n"
|
||||
|
||||
config U8G2_SPI_SSD0323_OS128064
|
||||
depends on U8G2_COMM_SPI
|
||||
bool "ssd0323_os128064"
|
||||
default "n"
|
||||
|
||||
config U8G2_SPI_SSD1305_128X32_NONAME
|
||||
depends on U8G2_COMM_SPI
|
||||
bool "ssd1305_128x32_noname"
|
||||
|
@ -342,6 +362,16 @@ config U8G2_SPI_SSD1309_128X64_NONAME2
|
|||
bool "ssd1309_128x64_noname2"
|
||||
default "n"
|
||||
|
||||
config U8G2_SPI_SSD1318_128X96
|
||||
depends on U8G2_COMM_SPI
|
||||
bool "ssd1318_128x96"
|
||||
default "n"
|
||||
|
||||
config U8G2_SPI_SSD1318_128X96_XCP
|
||||
depends on U8G2_COMM_SPI
|
||||
bool "ssd1318_128x96_xcp"
|
||||
default "n"
|
||||
|
||||
config U8G2_SPI_SSD1322_NHD_128X64
|
||||
depends on U8G2_COMM_SPI
|
||||
bool "ssd1322_nhd_128x64"
|
||||
|
@ -392,6 +422,16 @@ config U8G2_SPI_SSD1607_200X200
|
|||
bool "ssd1607_200x200"
|
||||
default "n"
|
||||
|
||||
config U8G2_SPI_SSD1607_GD_200X200
|
||||
depends on U8G2_COMM_SPI
|
||||
bool "ssd1607_gd_200x200"
|
||||
default "n"
|
||||
|
||||
config U8G2_SPI_SSD1607_WS_200X200
|
||||
depends on U8G2_COMM_SPI
|
||||
bool "ssd1607_ws_200x200"
|
||||
default "n"
|
||||
|
||||
config U8G2_SPI_ST7565_64128N
|
||||
depends on U8G2_COMM_SPI
|
||||
bool "st7565_64128n"
|
||||
|
@ -412,6 +452,11 @@ config U8G2_SPI_ST7565_ERC12864
|
|||
bool "st7565_erc12864"
|
||||
default "n"
|
||||
|
||||
config U8G2_SPI_ST7565_ERC12864_ALT
|
||||
depends on U8G2_COMM_SPI
|
||||
bool "st7565_erc12864_alt"
|
||||
default "n"
|
||||
|
||||
config U8G2_SPI_ST7565_LM6059
|
||||
depends on U8G2_COMM_SPI
|
||||
bool "st7565_lm6059"
|
||||
|
|
|
@ -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()`
|
||||
|
|
Loading…
Reference in New Issue