diff --git a/README.md b/README.md index a1fc54eb..df4cd504 100644 --- a/README.md +++ b/README.md @@ -403,7 +403,7 @@ SSD1306 via SPI: cs = 8 -- GPIO15, pull-down 10k to GND dc = 4 -- GPIO2 res = 0 -- GPIO16, RES is optional YMMV -disp = u8g.ssd1306_128x64_spi(cs, dc, res) +disp = u8g.ssd1306_128x64_hw_spi(cs, dc, res) ``` This object provides all of u8glib's methods to control the display. diff --git a/app/include/u8g_config.h b/app/include/u8g_config.h index 381cb5fd..bf332255 100644 --- a/app/include/u8g_config.h +++ b/app/include/u8g_config.h @@ -23,14 +23,53 @@ // Stick to the assignments to *_I2C and *_SPI tables. // // I2C based displays go into here: -#define U8G_DISPLAY_TABLE_ENTRY(device, lua_api_name) +#define U8G_DISPLAY_TABLE_ENTRY(device) #define U8G_DISPLAY_TABLE_I2C \ - U8G_DISPLAY_TABLE_ENTRY(ssd1306_128x64_i2c, ssd1306_128x64_i2c) +// U8G_DISPLAY_TABLE_ENTRY(sh1106_128x64_i2c) \ + U8G_DISPLAY_TABLE_ENTRY(ssd1306_128x64_i2c) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1306_64x48_i2c) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1309_128x64_i2c) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1327_96x96_gr_i2c) \ +// U8G_DISPLAY_TABLE_ENTRY(uc1611_dogm240_i2c) \ +// U8G_DISPLAY_TABLE_ENTRY(uc1611_dogxl240_i2c) \ // SPI based displays go into here: #define U8G_DISPLAY_TABLE_SPI \ - U8G_DISPLAY_TABLE_ENTRY(ssd1306_128x64_hw_spi, ssd1306_128x64_spi) \ -// U8G_DISPLAY_TABLE_ENTRY(pcd8544_84x48_hw_spi, pcd8544_84x48_spi) +// U8G_DISPLAY_TABLE_ENTRY(ld7032_60x32_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(pcd8544_84x48_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(pcf8812_96x65_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(sh1106_128x64_hw_spi) \ + U8G_DISPLAY_TABLE_ENTRY(ssd1306_128x64_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1306_64x48_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1309_128x64_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1322_nhd31oled_bw_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1322_nhd31oled_gr_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1325_nhd27oled_bw_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1325_nhd27oled_gr_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1327_96x96_gr_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1351_128x128_332_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1351_128x128gh_332_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1351_128x128_hicolor_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1351_128x128gh_hicolor_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1353_160x128_332_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(ssd1353_160x128_hicolor_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(st7565_64128n_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(st7565_dogm128_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(st7565_dogm132_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(st7565_lm6059_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(st7565_lm6063_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(st7565_nhd_c12832_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(st7565_nhd_c12864_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(uc1601_c128032_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(uc1608_240x128_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(uc1608_240x64_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(uc1610_dogxl160_bw_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(uc1610_dogxl160_gr_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(uc1611_dogm240_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(uc1611_dogxl240_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(uc1701_dogs102_hw_spi) \ +// U8G_DISPLAY_TABLE_ENTRY(uc1701_mini12864_hw_spi) \ + #undef U8G_DISPLAY_TABLE_ENTRY // // *************************************************************************** diff --git a/app/modules/u8g.c b/app/modules/u8g.c index 64327e10..0d07f9d4 100644 --- a/app/modules/u8g.c +++ b/app/modules/u8g.c @@ -986,8 +986,8 @@ static int lu8g_close_display( lua_State *L ) // // I2C based devices will use this function template to implement the Lua binding. #undef U8G_DISPLAY_TABLE_ENTRY -#define U8G_DISPLAY_TABLE_ENTRY(device, lua_api_name) \ - static int lu8g_ ## lua_api_name( lua_State *L ) \ +#define U8G_DISPLAY_TABLE_ENTRY(device) \ + static int lu8g_ ## device( lua_State *L ) \ { \ unsigned addr = luaL_checkinteger( L, 1 ); \ \ @@ -1014,8 +1014,8 @@ U8G_DISPLAY_TABLE_I2C // // SPI based devices will use this function template to implement the Lua binding. #undef U8G_DISPLAY_TABLE_ENTRY -#define U8G_DISPLAY_TABLE_ENTRY(device, lua_api_name) \ - static int lu8g_ ## lua_api_name( lua_State *L ) \ +#define U8G_DISPLAY_TABLE_ENTRY(device) \ + static int lu8g_ ## device( lua_State *L ) \ { \ unsigned cs = luaL_checkinteger( L, 1 ); \ if (cs == 0) \ @@ -1108,7 +1108,7 @@ static const LUA_REG_TYPE lu8g_display_map[] = const LUA_REG_TYPE lu8g_map[] = { #undef U8G_DISPLAY_TABLE_ENTRY -#define U8G_DISPLAY_TABLE_ENTRY(device, lua_api_name) { LSTRKEY( #lua_api_name ), LFUNCVAL ( lu8g_ ##lua_api_name ) }, +#define U8G_DISPLAY_TABLE_ENTRY(device) { LSTRKEY( #device ), LFUNCVAL ( lu8g_ ##device ) }, U8G_DISPLAY_TABLE_I2C U8G_DISPLAY_TABLE_SPI diff --git a/lua_examples/u8glib/u8g_bitmaps.lua b/lua_examples/u8glib/u8g_bitmaps.lua index f85907fe..77b9f380 100644 --- a/lua_examples/u8glib/u8g_bitmaps.lua +++ b/lua_examples/u8glib/u8g_bitmaps.lua @@ -31,7 +31,7 @@ function init_spi_display() local res = 0 -- GPIO16 spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0) - disp = u8g.ssd1306_128x64_spi(cs, dc, res) + disp = u8g.ssd1306_128x64_hw_spi(cs, dc, res) end diff --git a/lua_examples/u8glib/u8g_graphics_test.lua b/lua_examples/u8glib/u8g_graphics_test.lua index 02920f5a..bc21b1bd 100644 --- a/lua_examples/u8glib/u8g_graphics_test.lua +++ b/lua_examples/u8glib/u8g_graphics_test.lua @@ -30,7 +30,7 @@ function init_spi_display() local res = 0 -- GPIO16 spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0) - disp = u8g.ssd1306_128x64_spi(cs, dc, res) + disp = u8g.ssd1306_128x64_hw_spi(cs, dc, res) end diff --git a/lua_examples/u8glib/u8g_rotation.lua b/lua_examples/u8glib/u8g_rotation.lua index 7c78c297..c142ce73 100644 --- a/lua_examples/u8glib/u8g_rotation.lua +++ b/lua_examples/u8glib/u8g_rotation.lua @@ -31,7 +31,7 @@ function init_spi_display() local res = 0 -- GPIO16 spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0) - disp = u8g.ssd1306_128x64_spi(cs, dc, res) + disp = u8g.ssd1306_128x64_hw_spi(cs, dc, res) end