Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
b8377260
Commit
b8377260
authored
Jul 20, 2015
by
devsaurus
Browse files
simplify device/display macros
parent
05e3267f
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/include/u8g_config.h
View file @
b8377260
...
@@ -23,14 +23,14 @@
...
@@ -23,14 +23,14 @@
// 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,
display,
lua_api_name)
#define U8G_DISPLAY_TABLE_ENTRY(device, lua_api_name)
#define U8G_DISPLAY_TABLE_I2C \
#define U8G_DISPLAY_TABLE_I2C \
U8G_DISPLAY_TABLE_ENTRY(ssd1306_128x64_i2c,
ssd1306_128x64,
ssd1306_128x64_i2c)
U8G_DISPLAY_TABLE_ENTRY(ssd1306_128x64_i2c, ssd1306_128x64_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
, ssd1306_128x64_spi)
\
U8G_DISPLAY_TABLE_ENTRY(ssd1306_128x64_hw_spi, ssd1306_128x64
_spi)
\
// U8G_DISPLAY_TABLE_ENTRY(pcd8544_84x48_hw_spi,
pcd8544_84x48,
pcd8544_84x48_spi)
// U8G_DISPLAY_TABLE_ENTRY(pcd8544_84x48_hw_spi, pcd8544_84x48_spi)
#undef U8G_DISPLAY_TABLE_ENTRY
#undef U8G_DISPLAY_TABLE_ENTRY
//
//
// ***************************************************************************
// ***************************************************************************
...
...
app/modules/u8g.c
View file @
b8377260
...
@@ -986,8 +986,7 @@ static int lu8g_close_display( lua_State *L )
...
@@ -986,8 +986,7 @@ 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, display, lua_api_name) \
#define U8G_DISPLAY_TABLE_ENTRY(device, lua_api_name) \
uint8_t u8g_dev_ ## display ## _fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg); \
static int lu8g_ ## lua_api_name( lua_State *L ) \
static int lu8g_ ## lua_api_name( lua_State *L ) \
{ \
{ \
unsigned addr = luaL_checkinteger( L, 1 ); \
unsigned addr = luaL_checkinteger( L, 1 ); \
...
@@ -1015,8 +1014,7 @@ U8G_DISPLAY_TABLE_I2C
...
@@ -1015,8 +1014,7 @@ 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, display, lua_api_name) \
#define U8G_DISPLAY_TABLE_ENTRY(device, lua_api_name) \
uint8_t u8g_dev_ ## display ## _fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg); \
static int lu8g_ ## lua_api_name( lua_State *L ) \
static int lu8g_ ## lua_api_name( lua_State *L ) \
{ \
{ \
unsigned cs = luaL_checkinteger( L, 1 ); \
unsigned cs = luaL_checkinteger( L, 1 ); \
...
@@ -1110,7 +1108,7 @@ static const LUA_REG_TYPE lu8g_display_map[] =
...
@@ -1110,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,
display,
lua_api_name) { LSTRKEY( #lua_api_name ), LFUNCVAL ( lu8g_ ##lua_api_name ) },
#define U8G_DISPLAY_TABLE_ENTRY(device, lua_api_name) { LSTRKEY( #lua_api_name ), LFUNCVAL ( lu8g_ ##lua_api_name ) },
U8G_DISPLAY_TABLE_I2C
U8G_DISPLAY_TABLE_I2C
U8G_DISPLAY_TABLE_SPI
U8G_DISPLAY_TABLE_SPI
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment