From 4af087312211a5d699c86c3e64fb7ba99200ecbd Mon Sep 17 00:00:00 2001 From: alonewolfx2 Date: Mon, 26 Jan 2015 12:17:15 +0200 Subject: [PATCH] for reading internal vdd33 pin voltage. example usage and result ``` print(node.readvdd33()) 3348 > ``` --- app/modules/node.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/modules/node.c b/app/modules/node.c index 929aedd2..e4ac69be 100644 --- a/app/modules/node.c +++ b/app/modules/node.c @@ -53,6 +53,13 @@ static int node_chipid( lua_State* L ) lua_pushinteger(L, id); return 1; } +// Lua: readvdd33() +static int node_readvdd33( lua_State* L ) +{ + uint32_t vdd33 = readvdd33(); + lua_pushinteger(L, vdd33); + return 1; +} // Lua: flashid() static int node_flashid( lua_State* L ) @@ -287,6 +294,7 @@ const LUA_REG_TYPE node_map[] = { LSTRKEY( "led" ), LFUNCVAL( node_led ) }, { LSTRKEY( "input" ), LFUNCVAL( node_input ) }, { LSTRKEY( "output" ), LFUNCVAL( node_output ) }, + { LSTRKEY( "readvdd33" ), LFUNCVAL( node_readvdd33) }, #if LUA_OPTIMIZE_MEMORY > 0 #endif