Commit d6f648d0 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

esp8266: modesp: Add status() function for connection status.

parent b276cf19
......@@ -105,12 +105,18 @@ STATIC mp_obj_t 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[] = {
{ 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_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_status), (mp_obj_t)&esp_status_obj },
};
STATIC MP_DEFINE_CONST_DICT(esp_module_globals, esp_module_globals_table);
......
......@@ -45,3 +45,4 @@ Q(esp)
Q(connect)
Q(disconnect)
Q(scan)
Q(status)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment