|
@@ -414,6 +414,13 @@ static int node_setcpufreq(lua_State* L)
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+// Lua: code = bootreason()
|
|
|
+static int node_bootreason (lua_State *L)
|
|
|
+{
|
|
|
+ lua_pushnumber (L, rtc_get_reset_reason ());
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
// Module function map
|
|
|
#define MIN_OPT_LEVEL 2
|
|
|
#include "lrodefs.h"
|
|
@@ -438,6 +445,7 @@ const LUA_REG_TYPE node_map[] =
|
|
|
{ LSTRKEY( "CPU80MHZ" ), LNUMVAL( CPU80MHZ ) },
|
|
|
{ LSTRKEY( "CPU160MHZ" ), LNUMVAL( CPU160MHZ ) },
|
|
|
{ LSTRKEY( "setcpufreq" ), LFUNCVAL( node_setcpufreq) },
|
|
|
+ { LSTRKEY( "bootreason" ), LFUNCVAL( node_bootreason) },
|
|
|
// Combined to dsleep(us, option)
|
|
|
// { LSTRKEY( "dsleepsetoption" ), LFUNCVAL( node_deepsleep_setoption) },
|
|
|
#if LUA_OPTIMIZE_MEMORY > 0
|