added more displays:

sh1106_128x64_i2c
    ssd1306_64x48_i2c
    ssd1309_128x64_i2c
    ssd1327_96x96_gr_i2c
    uc1611_dogm240_i2c
    uc1611_dogxl240_i2c
    ld7032_60x32_hw_spi
    pcd8544_84x48_hw_spi
    pcf8812_96x65_hw_spi
    sh1106_128x64_hw_spi
    ssd1306_64x48_hw_spi
    ssd1309_128x64_hw_spi
    ssd1322_nhd31oled_bw_hw_spi
    ssd1322_nhd31oled_gr_hw_spi
    ssd1325_nhd27oled_bw_hw_spi
    ssd1325_nhd27oled_gr_hw_spi
    ssd1327_96x96_gr_hw_spi
    ssd1351_128x128_332_hw_spi
    ssd1351_128x128gh_332_hw_spi
    ssd1351_128x128_hicolor_hw_spi
    ssd1351_128x128gh_hicolor_hw_spi
    ssd1353_160x128_332_hw_spi
    ssd1353_160x128_hicolor_hw_spi
    st7565_64128n_hw_spi
    st7565_dogm128_hw_spi
    st7565_dogm132_hw_spi
    st7565_lm6059_hw_spi
    st7565_lm6063_hw_spi
    st7565_nhd_c12832_hw_spi
    st7565_nhd_c12864_hw_spi
    uc1601_c128032_hw_spi
    uc1608_240x128_hw_spi
    uc1608_240x64_hw_spi
    uc1610_dogxl160_bw_hw_spi
    uc1610_dogxl160_gr_hw_spi
    uc1611_dogm240_hw_spi
    uc1611_dogxl240_hw_spi
    uc1701_dogs102_hw_spi
    uc1701_mini12864_hw_spi
This commit is contained in:
devsaurus 2015-07-20 23:11:13 +02:00
parent ce271f24f7
commit 6fd106afac
6 changed files with 52 additions and 13 deletions

View File

@ -403,7 +403,7 @@ SSD1306 via SPI:
cs = 8 -- GPIO15, pull-down 10k to GND cs = 8 -- GPIO15, pull-down 10k to GND
dc = 4 -- GPIO2 dc = 4 -- GPIO2
res = 0 -- GPIO16, RES is optional YMMV 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. This object provides all of u8glib's methods to control the display.

View File

@ -23,14 +23,53 @@
// Stick to the assignments to *_I2C and *_SPI tables. // Stick to the assignments to *_I2C and *_SPI tables.
// //
// I2C based displays go into here: // 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 \ #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: // SPI based displays go into here:
#define U8G_DISPLAY_TABLE_SPI \ #define U8G_DISPLAY_TABLE_SPI \
U8G_DISPLAY_TABLE_ENTRY(ssd1306_128x64_hw_spi, ssd1306_128x64_spi) \ // U8G_DISPLAY_TABLE_ENTRY(ld7032_60x32_hw_spi) \
// U8G_DISPLAY_TABLE_ENTRY(pcd8544_84x48_hw_spi, pcd8544_84x48_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 #undef U8G_DISPLAY_TABLE_ENTRY
// //
// *************************************************************************** // ***************************************************************************

View File

@ -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. // I2C based devices will use this function template to implement the Lua binding.
#undef U8G_DISPLAY_TABLE_ENTRY #undef U8G_DISPLAY_TABLE_ENTRY
#define U8G_DISPLAY_TABLE_ENTRY(device, lua_api_name) \ #define U8G_DISPLAY_TABLE_ENTRY(device) \
static int lu8g_ ## lua_api_name( lua_State *L ) \ static int lu8g_ ## device( lua_State *L ) \
{ \ { \
unsigned addr = luaL_checkinteger( L, 1 ); \ 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. // SPI based devices will use this function template to implement the Lua binding.
#undef U8G_DISPLAY_TABLE_ENTRY #undef U8G_DISPLAY_TABLE_ENTRY
#define U8G_DISPLAY_TABLE_ENTRY(device, lua_api_name) \ #define U8G_DISPLAY_TABLE_ENTRY(device) \
static int lu8g_ ## lua_api_name( lua_State *L ) \ static int lu8g_ ## device( lua_State *L ) \
{ \ { \
unsigned cs = luaL_checkinteger( L, 1 ); \ unsigned cs = luaL_checkinteger( L, 1 ); \
if (cs == 0) \ if (cs == 0) \
@ -1108,7 +1108,7 @@ static const LUA_REG_TYPE lu8g_display_map[] =
const LUA_REG_TYPE lu8g_map[] = const LUA_REG_TYPE lu8g_map[] =
{ {
#undef U8G_DISPLAY_TABLE_ENTRY #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_I2C
U8G_DISPLAY_TABLE_SPI U8G_DISPLAY_TABLE_SPI

View File

@ -31,7 +31,7 @@ function init_spi_display()
local res = 0 -- GPIO16 local res = 0 -- GPIO16
spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0) 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 end

View File

@ -30,7 +30,7 @@ function init_spi_display()
local res = 0 -- GPIO16 local res = 0 -- GPIO16
spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0) 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 end

View File

@ -31,7 +31,7 @@ function init_spi_display()
local res = 0 -- GPIO16 local res = 0 -- GPIO16
spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0) 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 end