implement begin()

This commit is contained in:
devsaurus 2015-02-08 21:41:02 +01:00
parent 289885d6e0
commit fdab682776
2 changed files with 15 additions and 1 deletions

View File

@ -375,7 +375,7 @@ They'll be available as `u8g.<font_name>` in Lua.
- [ ] drawBitmap() - [ ] drawBitmap()
- [ ] drawXBM() - [ ] drawXBM()
- [ ] General functions - [ ] General functions
- [ ] begin() - [x] begin()
- [ ] print() - [ ] print()
- [ ] setContrast() - [ ] setContrast()
- [ ] setPrintPos() - [ ] setPrintPos()

View File

@ -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 ) // Lua: u8g.setFont( self, font )
static int lu8g_setFont( lua_State *L ) 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[] = static const LUA_REG_TYPE lu8g_display_map[] =
{ {
{ LSTRKEY( "begin" ), LFUNCVAL( lu8g_begin ) },
{ LSTRKEY( "setFont" ), LFUNCVAL( lu8g_setFont ) }, { LSTRKEY( "setFont" ), LFUNCVAL( lu8g_setFont ) },
{ LSTRKEY( "setFontRefHeightAll" ), LFUNCVAL( lu8g_setFontRefHeightAll ) }, { LSTRKEY( "setFontRefHeightAll" ), LFUNCVAL( lu8g_setFontRefHeightAll ) },
{ LSTRKEY( "setFontRefHeightExtendedText" ), LFUNCVAL( lu8g_setFontRefHeightExtendedText ) }, { LSTRKEY( "setFontRefHeightExtendedText" ), LFUNCVAL( lu8g_setFontRefHeightExtendedText ) },