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
900c43d5
Commit
900c43d5
authored
Apr 26, 2015
by
dnc40085
Browse files
Add setphymode and getphymode to wifi module
parent
d5731dd9
Changes
1
Show whitespace changes
Inline
Side-by-side
app/modules/wifi.c
View file @
900c43d5
...
@@ -157,6 +157,29 @@ static int wifi_getmode( lua_State* L )
...
@@ -157,6 +157,29 @@ static int wifi_getmode( lua_State* L )
return
1
;
return
1
;
}
}
// Lua: wifi.setphymode(mode)
static
int
wifi_setphymode
(
lua_State
*
L
)
{
unsigned
mode
;
mode
=
luaL_checkinteger
(
L
,
1
);
if
(
mode
!=
PHY_MODE_11B
&&
mode
!=
PHY_MODE_11G
&&
mode
!=
PHY_MODE_11N
)
return
luaL_error
(
L
,
"wrong arg type"
);
wifi_set_phy_mode
(
(
uint8_t
)
mode
);
mode
=
(
unsigned
)
wifi_get_phy_mode
();
lua_pushinteger
(
L
,
mode
);
return
1
;
}
// Lua: wifi.getphymode()
static
int
wifi_getphymode
(
lua_State
*
L
)
{
unsigned
mode
;
mode
=
(
unsigned
)
wifi_get_phy_mode
();
lua_pushinteger
(
L
,
mode
);
return
1
;
}
// Lua: mac = wifi.xx.getmac()
// Lua: mac = wifi.xx.getmac()
static
int
wifi_getmac
(
lua_State
*
L
,
uint8_t
mode
)
static
int
wifi_getmac
(
lua_State
*
L
,
uint8_t
mode
)
...
@@ -524,6 +547,8 @@ const LUA_REG_TYPE wifi_map[] =
...
@@ -524,6 +547,8 @@ const LUA_REG_TYPE wifi_map[] =
{
{
{
LSTRKEY
(
"setmode"
),
LFUNCVAL
(
wifi_setmode
)
},
{
LSTRKEY
(
"setmode"
),
LFUNCVAL
(
wifi_setmode
)
},
{
LSTRKEY
(
"getmode"
),
LFUNCVAL
(
wifi_getmode
)
},
{
LSTRKEY
(
"getmode"
),
LFUNCVAL
(
wifi_getmode
)
},
{
LSTRKEY
(
"setphymode"
),
LFUNCVAL
(
wifi_setphymode
)
},
{
LSTRKEY
(
"getphymode"
),
LFUNCVAL
(
wifi_getphymode
)
},
{
LSTRKEY
(
"startsmart"
),
LFUNCVAL
(
wifi_start_smart
)
},
{
LSTRKEY
(
"startsmart"
),
LFUNCVAL
(
wifi_start_smart
)
},
{
LSTRKEY
(
"stopsmart"
),
LFUNCVAL
(
wifi_exit_smart
)
},
{
LSTRKEY
(
"stopsmart"
),
LFUNCVAL
(
wifi_exit_smart
)
},
{
LSTRKEY
(
"sleeptype"
),
LFUNCVAL
(
wifi_sleeptype
)
},
{
LSTRKEY
(
"sleeptype"
),
LFUNCVAL
(
wifi_sleeptype
)
},
...
...
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