Skip to content

Commit

Permalink
allow radio.enabled to be settable
Browse files Browse the repository at this point in the history
  • Loading branch information
dhalbert committed Dec 4, 2020
1 parent fb90f51 commit 57fa6be
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion shared-bindings/wifi/Radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,19 @@ STATIC mp_obj_t wifi_radio_get_enabled(mp_obj_t self) {
}
MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_enabled_obj, wifi_radio_get_enabled);

static mp_obj_t wifi_radio_set_enabled(mp_obj_t self, mp_obj_t value) {
const bool enabled = mp_obj_is_true(value);

common_hal_wifi_radio_set_enabled(self, enabled);

return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(wifi_radio_set_enabled_obj, wifi_radio_set_enabled);

const mp_obj_property_t wifi_radio_enabled_obj = {
.base.type = &mp_type_property,
.proxy = { (mp_obj_t)&wifi_radio_get_enabled_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&wifi_radio_set_enabled_obj,
(mp_obj_t)&mp_const_none_obj },
};

Expand Down

0 comments on commit 57fa6be

Please sign in to comment.