Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
02ea74d8
Commit
02ea74d8
authored
Dec 22, 2015
by
Damien George
Committed by
Paul Sokolovsky
Mar 02, 2016
Browse files
esp8266: Add network.ifconfig().
parent
1febaf3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
esp8266/modnetwork.c
View file @
02ea74d8
...
...
@@ -136,6 +136,19 @@ STATIC mp_obj_t esp_mac(mp_uint_t n_args, const mp_obj_t *args) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
esp_mac_obj
,
0
,
1
,
esp_mac
);
STATIC
mp_obj_t
esp_ifconfig
(
void
)
{
struct
ip_info
info
;
wifi_get_ip_info
(
STATION_IF
,
&
info
);
mp_obj_t
ifconfig
[
4
]
=
{
netutils_format_ipv4_addr
((
uint8_t
*
)
&
info
.
ip
,
NETUTILS_BIG
),
netutils_format_ipv4_addr
((
uint8_t
*
)
&
info
.
netmask
,
NETUTILS_BIG
),
netutils_format_ipv4_addr
((
uint8_t
*
)
&
info
.
gw
,
NETUTILS_BIG
),
MP_OBJ_NEW_QSTR
(
MP_QSTR_
),
// no DNS server
};
return
mp_obj_new_tuple
(
4
,
ifconfig
);
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_0
(
esp_ifconfig_obj
,
esp_ifconfig
);
STATIC
const
mp_map_elem_t
mp_module_network_globals_table
[]
=
{
{
MP_OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW_QSTR
(
MP_QSTR_network
)
},
// MicroPython "network" module interface requires it to contains classes
...
...
@@ -149,6 +162,7 @@ STATIC const mp_map_elem_t mp_module_network_globals_table[] = {
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_scan
),
(
mp_obj_t
)
&
esp_scan_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_isconnected
),
(
mp_obj_t
)
&
esp_isconnected_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_mac
),
(
mp_obj_t
)
&
esp_mac_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_ifconfig
),
(
mp_obj_t
)
&
esp_ifconfig_obj
},
#if MODNETWORK_INCLUDE_CONSTANTS
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_STAT_IDLE
),
...
...
esp8266/qstrdefsport.h
View file @
02ea74d8
...
...
@@ -103,6 +103,7 @@ Q(scan)
Q
(
status
)
Q
(
isconnected
)
Q
(
mac
)
Q
(
ifconfig
)
Q
(
STAT_IDLE
)
Q
(
STAT_CONNECTING
)
Q
(
STAT_WRONG_PASSWORD
)
...
...
Write
Preview
Supports
Markdown
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