aboutsummaryrefslogtreecommitdiff
path: root/cc3200/mods
diff options
context:
space:
mode:
authordanicampora2015-10-19 20:53:02 +0200
committerdanicampora2015-10-19 21:17:15 +0200
commit9c72c71c05541b946feffb4d43fba6a5c513c9a7 (patch)
treed3a9a4f5307e439b1613f3299bda86960182bc3a /cc3200/mods
parentf4c50f1cfc766974374a8e58bd98e50bef8df3ba (diff)
cc3200: WLAN class can retrieve the existing instance.
Diffstat (limited to 'cc3200/mods')
-rw-r--r--cc3200/mods/modwlan.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/cc3200/mods/modwlan.c b/cc3200/mods/modwlan.c
index 8db89b376..920b0d472 100644
--- a/cc3200/mods/modwlan.c
+++ b/cc3200/mods/modwlan.c
@@ -829,21 +829,22 @@ STATIC mp_obj_t wlan_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_k
mp_arg_val_t args[MP_ARRAY_SIZE(wlan_init_args)];
mp_arg_parse_all(n_args, all_args, &kw_args, MP_ARRAY_SIZE(args), wlan_init_args, args);
- // check the peripheral id
- if (args[0].u_int != 0) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_resource_not_avaliable));
- }
-
// setup the object
wlan_obj_t *self = &wlan_obj;
self->base.type = (mp_obj_t)&mod_network_nic_type_wlan;
- // start the peripheral
- wlan_init_helper(self, &args[1]);
-
- // pass it to the sleep module
+ // give it to the sleep module
pyb_sleep_set_wlan_obj(self);
+ if (n_args > 1 || n_kw > 0) {
+ // check the peripheral id
+ if (args[0].u_int != 0) {
+ nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_resource_not_avaliable));
+ }
+ // start the peripheral
+ wlan_init_helper(self, &args[1]);
+ }
+
return (mp_obj_t)self;
}