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.
diff --git a/ports/esp32/network_wlan.c b/ports/esp32/network_wlan.c
index 501dc40..4f74262 100644
--- a/ports/esp32/network_wlan.c
+++ b/ports/esp32/network_wlan.c
@@ -490,6 +490,10 @@
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 @@
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;
}