Commit 1cd47c63 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

esp8266: modesp: Add disconnect() function to disconnect from WiFi AP.

parent 5f64dc55
......@@ -99,10 +99,17 @@ STATIC mp_obj_t esp_connect(mp_obj_t ssid_in, mp_obj_t passwd_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_connect_obj, esp_connect);
STATIC mp_obj_t esp_disconnect() {
error_check(wifi_station_disconnect(), "Cannot disconnect from AP");
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_disconnect_obj, esp_disconnect);
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 },
};
......
......@@ -43,4 +43,5 @@ Q(hard_reset)
Q(esp)
Q(connect)
Q(disconnect)
Q(scan)
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