Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ports/esp32/modnetwork.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
ESP_EXCEPTIONS(esp_wifi_set_mac(self->if_id, bufinfo.buf));
break;
}
case QS(MP_QSTR_protocol): {
ESP_EXCEPTIONS(esp_wifi_set_protocol(self->if_id, mp_obj_get_int(kwargs->table[i].value)));
break;
}
case QS(MP_QSTR_essid): {
req_if = WIFI_IF_AP;
mp_uint_t len;
Expand Down Expand Up @@ -468,6 +472,11 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
ESP_EXCEPTIONS(esp_wifi_get_mac(self->if_id, mac));
return mp_obj_new_bytes(mac, sizeof(mac));
}
case QS(MP_QSTR_protocol): {
uint8_t protocol_bitmap;
ESP_EXCEPTIONS(esp_wifi_get_protocol(self->if_id, &protocol_bitmap));
return mp_obj_new_int(protocol_bitmap);
}
case QS(MP_QSTR_essid):
req_if = WIFI_IF_AP;
val = mp_obj_new_str((char*)cfg.ap.ssid, cfg.ap.ssid_len, false);
Expand Down Expand Up @@ -545,6 +554,8 @@ STATIC const mp_map_elem_t mp_module_network_globals_table[] = {
MP_OBJ_NEW_SMALL_INT(WIFI_PROTOCOL_11G) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MODE_11N),
MP_OBJ_NEW_SMALL_INT(WIFI_PROTOCOL_11N) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MODE_LR),
MP_OBJ_NEW_SMALL_INT(WIFI_PROTOCOL_LR) },

{ MP_OBJ_NEW_QSTR(MP_QSTR_AUTH_OPEN),
MP_OBJ_NEW_SMALL_INT(WIFI_AUTH_OPEN) },
Expand Down