From fdab68277685675cb84b101176bc5703ff472098 Mon Sep 17 00:00:00 2001 From: devsaurus Date: Sun, 8 Feb 2015 21:41:02 +0100 Subject: [PATCH] implement begin() --- README.md | 2 +- app/modules/u8g.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3973a2f9..97ff9282 100644 --- a/README.md +++ b/README.md @@ -375,7 +375,7 @@ They'll be available as `u8g.` in Lua. - [ ] drawBitmap() - [ ] drawXBM() - [ ] General functions - - [ ] begin() + - [x] begin() - [ ] print() - [ ] setContrast() - [ ] setPrintPos() diff --git a/app/modules/u8g.c b/app/modules/u8g.c index 75636bae..e3ae55e8 100644 --- a/app/modules/u8g.c +++ b/app/modules/u8g.c @@ -58,6 +58,19 @@ static void lu8g_get_int_args( lua_State *L, uint8_t stack, uint8_t num, u8g_uin } +// Lua: u8g.begin( self ) +static int lu8g_begin( lua_State *L ) +{ + lu8g_userdata_t *lud; + + if ((lud = get_lud( L )) == NULL) + return 0; + + u8g_Begin( lud ); + + return 0; +} + // Lua: u8g.setFont( self, font ) static int lu8g_setFont( lua_State *L ) { @@ -871,6 +884,7 @@ static int lu8g_ssd1306_128x64_i2c( lua_State *L ) static const LUA_REG_TYPE lu8g_display_map[] = { + { LSTRKEY( "begin" ), LFUNCVAL( lu8g_begin ) }, { LSTRKEY( "setFont" ), LFUNCVAL( lu8g_setFont ) }, { LSTRKEY( "setFontRefHeightAll" ), LFUNCVAL( lu8g_setFontRefHeightAll ) }, { LSTRKEY( "setFontRefHeightExtendedText" ), LFUNCVAL( lu8g_setFontRefHeightExtendedText ) },