Allow access to the data pointer from LUA.
This commit is contained in:
parent
b19f583465
commit
3a5e96a857
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue