diff options
author | glenn20 <glenn.moloney@gmail.com> | 2022-07-31 18:17:40 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-08-23 16:32:30 +1000 |
commit | 76f2e3e62bd2bc177a62649bae34b67d9bd2c8b1 (patch) | |
tree | e608f9a5c9c7583cb0f97b2b8249eacc96704e8c | |
parent | 98d1c50159fe9427d72ec358ba0219eaebb1d991 (diff) |
esp32/network_wlan: Add support to set/get the wifi protocol.
Add 'protocol' option to WLAN.config() to support setting/getting the wifi
protocol modes: MODE_11G|MODE_11G|MODE_11N.
-rw-r--r-- | ports/esp32/network_wlan.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ports/esp32/network_wlan.c b/ports/esp32/network_wlan.c index 501dc40f2..4f74262af 100644 --- a/ports/esp32/network_wlan.c +++ b/ports/esp32/network_wlan.c @@ -490,6 +490,10 @@ STATIC mp_obj_t network_wlan_config(size_t n_args, const mp_obj_t *args, mp_map_ esp_exceptions(esp_wifi_set_max_tx_power(power)); break; } + case MP_QSTR_protocol: { + esp_exceptions(esp_wifi_set_protocol(self->if_id, mp_obj_get_int(kwargs->table[i].value))); + break; + } default: goto unknown; } @@ -578,6 +582,12 @@ STATIC mp_obj_t network_wlan_config(size_t n_args, const mp_obj_t *args, mp_map_ val = mp_obj_new_float(power * 0.25); break; } + case MP_QSTR_protocol: { + uint8_t protocol_bitmap; + esp_exceptions(esp_wifi_get_protocol(self->if_id, &protocol_bitmap)); + val = MP_OBJ_NEW_SMALL_INT(protocol_bitmap); + break; + } default: goto unknown; } |