Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
3dd1ac37
Commit
3dd1ac37
authored
Mar 27, 2015
by
HuangRui
Browse files
Move node.readvdd33 to adc.readvdd33, fix #162.
parent
f4223f0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/modules/adc.c
View file @
3dd1ac37
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include "lrotable.h"
#include "lrotable.h"
#include "c_types.h"
#include "c_types.h"
#include "user_interface.h"
// Lua: read(id) , return system adc
// Lua: read(id) , return system adc
static
int
adc_sample
(
lua_State
*
L
)
static
int
adc_sample
(
lua_State
*
L
)
...
@@ -19,12 +20,33 @@ static int adc_sample( lua_State* L )
...
@@ -19,12 +20,33 @@ static int adc_sample( lua_State* L )
return
1
;
return
1
;
}
}
// Lua: readvdd33()
static
int
adc_readvdd33
(
lua_State
*
L
)
{
uint32_t
vdd33
=
0
;
if
(
STATION_MODE
==
wifi_get_opmode
())
{
// Bug fix
wifi_set_opmode
(
STATIONAP_MODE
);
vdd33
=
readvdd33
();
wifi_set_opmode
(
STATION_MODE
);
}
else
{
vdd33
=
readvdd33
();
}
lua_pushinteger
(
L
,
vdd33
);
return
1
;
}
// Module function map
// Module function map
#define MIN_OPT_LEVEL 2
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
#include "lrodefs.h"
const
LUA_REG_TYPE
adc_map
[]
=
const
LUA_REG_TYPE
adc_map
[]
=
{
{
{
LSTRKEY
(
"read"
),
LFUNCVAL
(
adc_sample
)
},
{
LSTRKEY
(
"read"
),
LFUNCVAL
(
adc_sample
)
},
{
LSTRKEY
(
"readvdd33"
),
LFUNCVAL
(
adc_readvdd33
)
},
#if LUA_OPTIMIZE_MEMORY > 0
#if LUA_OPTIMIZE_MEMORY > 0
#endif
#endif
...
...
app/modules/node.c
View file @
3dd1ac37
...
@@ -100,13 +100,15 @@ static int node_chipid( lua_State* L )
...
@@ -100,13 +100,15 @@ static int node_chipid( lua_State* L )
lua_pushinteger
(
L
,
id
);
lua_pushinteger
(
L
,
id
);
return
1
;
return
1
;
}
}
// deprecated, moved to adc module
// Lua: readvdd33()
// Lua: readvdd33()
static
int
node_readvdd33
(
lua_State
*
L
)
//
static int node_readvdd33( lua_State* L )
{
//
{
uint32_t
vdd33
=
readvdd33
();
//
uint32_t vdd33 = readvdd33();
lua_pushinteger
(
L
,
vdd33
);
//
lua_pushinteger(L, vdd33);
return
1
;
//
return 1;
}
//
}
// Lua: flashid()
// Lua: flashid()
static
int
node_flashid
(
lua_State
*
L
)
static
int
node_flashid
(
lua_State
*
L
)
...
@@ -430,7 +432,8 @@ const LUA_REG_TYPE node_map[] =
...
@@ -430,7 +432,8 @@ const LUA_REG_TYPE node_map[] =
#endif
#endif
{
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
)
},
// Moved to adc module, use adc.readvdd33()
// { LSTRKEY( "readvdd33" ), LFUNCVAL( node_readvdd33) },
{
LSTRKEY
(
"compile"
),
LFUNCVAL
(
node_compile
)
},
{
LSTRKEY
(
"compile"
),
LFUNCVAL
(
node_compile
)
},
{
LSTRKEY
(
"CPU80MHZ"
),
LNUMVAL
(
CPU80MHZ
)
},
{
LSTRKEY
(
"CPU80MHZ"
),
LNUMVAL
(
CPU80MHZ
)
},
{
LSTRKEY
(
"CPU160MHZ"
),
LNUMVAL
(
CPU160MHZ
)
},
{
LSTRKEY
(
"CPU160MHZ"
),
LNUMVAL
(
CPU160MHZ
)
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment