esp8266: modesp: Add status() function for connection status.
This commit is contained in:
parent
b276cf1977
commit
d6f648d04f
@ -105,12 +105,18 @@ STATIC mp_obj_t esp_disconnect() {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_disconnect_obj, esp_disconnect);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_disconnect_obj, esp_disconnect);
|
||||||
|
|
||||||
|
STATIC mp_obj_t esp_status() {
|
||||||
|
return MP_OBJ_NEW_SMALL_INT(wifi_station_get_connect_status());
|
||||||
|
}
|
||||||
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_status_obj, esp_status);
|
||||||
|
|
||||||
STATIC const mp_map_elem_t esp_module_globals_table[] = {
|
STATIC const mp_map_elem_t esp_module_globals_table[] = {
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_esp) },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_esp) },
|
||||||
|
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_connect), (mp_obj_t)&esp_connect_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_connect), (mp_obj_t)&esp_connect_obj },
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_disconnect), (mp_obj_t)&esp_disconnect_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_disconnect), (mp_obj_t)&esp_disconnect_obj },
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_scan), (mp_obj_t)&esp_scan_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_scan), (mp_obj_t)&esp_scan_obj },
|
||||||
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_status), (mp_obj_t)&esp_status_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
STATIC MP_DEFINE_CONST_DICT(esp_module_globals, esp_module_globals_table);
|
STATIC MP_DEFINE_CONST_DICT(esp_module_globals, esp_module_globals_table);
|
||||||
|
@ -45,3 +45,4 @@ Q(esp)
|
|||||||
Q(connect)
|
Q(connect)
|
||||||
Q(disconnect)
|
Q(disconnect)
|
||||||
Q(scan)
|
Q(scan)
|
||||||
|
Q(status)
|
||||||
|
Loading…
Reference in New Issue
Block a user