Skip to content

Commit

Permalink
esp8266: modesp: Add status() function for connection status.
Browse files Browse the repository at this point in the history
  • Loading branch information
pfalcon committed Feb 4, 2015
1 parent b276cf1 commit d6f648d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions esp8266/modesp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions esp8266/qstrdefsport.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ Q(esp)
Q(connect)
Q(disconnect)
Q(scan)
Q(status)

0 comments on commit d6f648d

Please sign in to comment.