@@ -139,13 +139,19 @@ MP_PROPERTY_GETSET(wifi_radio_hostname_obj,
139139
140140//| mac_address: ReadableBuffer
141141//| """MAC address for the station. When the address is altered after interface is connected
142- //| the changes would only be reflected once the interface reconnects."""
142+ //| the changes would only be reflected once the interface reconnects.
143+ //|
144+ //| **Limitations:** Not settable on RP2040 CYW43 boards, such as Pi Pico W.
145+ //| """
146+
147+
143148STATIC mp_obj_t _wifi_radio_get_mac_address (mp_obj_t self_in ) {
144149 wifi_radio_obj_t * self = MP_OBJ_TO_PTR (self_in );
145150 return MP_OBJ_FROM_PTR (common_hal_wifi_radio_get_mac_address (self ));
146151}
147152MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_mac_address_obj , _wifi_radio_get_mac_address );
148153
154+ #if CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS
149155STATIC mp_obj_t wifi_radio_set_mac_address (mp_obj_t self_in , mp_obj_t mac_address_in ) {
150156 mp_buffer_info_t mac_address ;
151157 mp_get_buffer_raise (mac_address_in , & mac_address , MP_BUFFER_READ );
@@ -160,10 +166,16 @@ STATIC mp_obj_t wifi_radio_set_mac_address(mp_obj_t self_in, mp_obj_t mac_addres
160166 return mp_const_none ;
161167}
162168MP_DEFINE_CONST_FUN_OBJ_2 (wifi_radio_set_mac_address_obj , wifi_radio_set_mac_address );
169+ #endif
163170
171+ #if CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS
164172MP_PROPERTY_GETSET (wifi_radio_mac_address_obj ,
165173 (mp_obj_t )& wifi_radio_get_mac_address_obj ,
166174 (mp_obj_t )& wifi_radio_set_mac_address_obj );
175+ #else
176+ MP_PROPERTY_GETTER (wifi_radio_mac_address_obj ,
177+ (mp_obj_t )& wifi_radio_get_mac_address_obj );
178+ #endif
167179
168180//| tx_power: float
169181//| """Wifi transmission power, in dBm."""
@@ -187,13 +199,17 @@ MP_PROPERTY_GETSET(wifi_radio_tx_power_obj,
187199
188200//| mac_address_ap: ReadableBuffer
189201//| """MAC address for the AP. When the address is altered after interface is started
190- //| the changes would only be reflected once the interface restarts."""
202+ //| the changes would only be reflected once the interface restarts.
203+ //|
204+ //| **Limitations:** Not settable on RP2040 CYW43 boards, such as Pi Pico W.
205+ //| """
191206STATIC mp_obj_t wifi_radio_get_mac_address_ap (mp_obj_t self_in ) {
192207 wifi_radio_obj_t * self = MP_OBJ_TO_PTR (self_in );
193208 return MP_OBJ_FROM_PTR (common_hal_wifi_radio_get_mac_address_ap (self ));
194209}
195210MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_mac_address_ap_obj , wifi_radio_get_mac_address_ap );
196211
212+ #if CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS
197213STATIC mp_obj_t wifi_radio_set_mac_address_ap (mp_obj_t self_in , mp_obj_t mac_address_in ) {
198214 mp_buffer_info_t mac_address ;
199215 mp_get_buffer_raise (mac_address_in , & mac_address , MP_BUFFER_READ );
@@ -208,10 +224,16 @@ STATIC mp_obj_t wifi_radio_set_mac_address_ap(mp_obj_t self_in, mp_obj_t mac_add
208224 return mp_const_none ;
209225}
210226MP_DEFINE_CONST_FUN_OBJ_2 (wifi_radio_set_mac_address_ap_obj , wifi_radio_set_mac_address_ap );
227+ #endif
211228
229+ #if CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS
212230MP_PROPERTY_GETSET (wifi_radio_mac_address_ap_obj ,
213231 (mp_obj_t )& wifi_radio_get_mac_address_ap_obj ,
214232 (mp_obj_t )& wifi_radio_set_mac_address_ap_obj );
233+ #else
234+ MP_PROPERTY_GETTER (wifi_radio_mac_address_ap_obj ,
235+ (mp_obj_t )& wifi_radio_get_mac_address_ap_obj );
236+ #endif
215237
216238//| def start_scanning_networks(
217239//| self, *, start_channel: int = 1, stop_channel: int = 11
0 commit comments