diff --git a/app/modules/spi.c b/app/modules/spi.c index 46394cf7..6a0d2f97 100644 --- a/app/modules/spi.c +++ b/app/modules/spi.c @@ -173,11 +173,12 @@ static int spi_send_recv( lua_State *L ) return spi_generic_send_recv( L, 1 ); } -// Lua: read = spi.recv( id, size ) +// Lua: read = spi.recv( id, size, [default data] ) static int spi_recv( lua_State *L ) { int id = luaL_checkinteger( L, 1 ); int size = luaL_checkinteger( L, 2 ), i; + int def = luaL_optinteger( L, 3, 0xffffffff ); luaL_Buffer b; @@ -189,10 +190,7 @@ static int spi_recv( lua_State *L ) luaL_buffinit( L, &b ); for (i=0; i