Allow access to the data pointer from LUA.

This commit is contained in:
slaff 2015-02-16 07:53:43 +00:00
parent b19f583465
commit 3a5e96a857
1 changed files with 5 additions and 4 deletions

View File

@ -184,14 +184,15 @@ static bool tmr_mem_write( lua_State* L)
} }
// Lua: mem_read(start_address, bytes), return the read data from the RTC inner memory // Lua: mem_read(start_address, bytes), return the read data from the RTC inner memory
static void* tmr_mem_read( lua_State* L) static bool tmr_mem_read( lua_State* L)
{ {
uint8_t address = (uint8_t)luaL_checkinteger( L, 1); uint8_t address = (uint8_t)luaL_checkinteger( L, 1);
uint8_t len = (uint8_t)luaL_checkinteger( L, 2); uint8_t len = (uint8_t)luaL_checkinteger( L, 2);
void *des_addr; void *des_addr;
system_rtc_mem_read(address, &des_addr, len); bool ret = system_rtc_mem_read(address, &des_addr, len);
lua_pushlightuserdata(L, des_addr);
return des_addr; return ret;
} }
// Module function map // Module function map