Commit f4214294 authored by alonewolfx2's avatar alonewolfx2
Browse files

new sleep set options added (from 0.9.5 sdk)

usage:
-- no wakeup until rst pin to low 
node.dsleep(0) 

-- 4 mean no RF after deepsleep.
node.dsleepsetoption(4)
parent db5614a0
...@@ -26,12 +26,24 @@ static int node_deepsleep( lua_State* L ) ...@@ -26,12 +26,24 @@ static int node_deepsleep( lua_State* L )
{ {
s32 us; s32 us;
us = luaL_checkinteger( L, 1 ); us = luaL_checkinteger( L, 1 );
if ( us <= 0 ) // if ( us <= 0 )
if ( us < 0 )
return luaL_error( L, "wrong arg range" ); return luaL_error( L, "wrong arg range" );
system_deep_sleep( us ); system_deep_sleep( us );
return 0; return 0;
} }
// Lua: dsleep_set_options
static int node_deepsleep_setoption( lua_State* L )
{
s32 option;
option = luaL_checkinteger( L, 1 );
if ( option < 0 || option > 4)
return luaL_error( L, "wrong arg range" );
else
deep_sleep_set_option( option );
return 0;
}
// Lua: info() // Lua: info()
static int node_info( lua_State* L ) static int node_info( lua_State* L )
{ {
...@@ -295,6 +307,7 @@ const LUA_REG_TYPE node_map[] = ...@@ -295,6 +307,7 @@ const LUA_REG_TYPE node_map[] =
{ LSTRKEY( "input" ), LFUNCVAL( node_input ) }, { LSTRKEY( "input" ), LFUNCVAL( node_input ) },
{ LSTRKEY( "output" ), LFUNCVAL( node_output ) }, { LSTRKEY( "output" ), LFUNCVAL( node_output ) },
{ LSTRKEY( "readvdd33" ), LFUNCVAL( node_readvdd33) }, { LSTRKEY( "readvdd33" ), LFUNCVAL( node_readvdd33) },
{ LSTRKEY( "dsleepsetoption" ), LFUNCVAL( node_deepsleep_setoption) },
#if LUA_OPTIMIZE_MEMORY > 0 #if LUA_OPTIMIZE_MEMORY > 0
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment