summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDaniel Campora <daniel@wipy.io>2015-09-27 19:10:09 +0200
committerDaniel Campora <daniel@wipy.io>2015-09-27 19:10:09 +0200
commited6a5b78ad5d6f5aa5ad6a44e686884dc25ab235 (patch)
treef4a595030074aa9d5adbd405b4614f41b1124c8e
parentd5de1bf853f48fc77c400fea80ed684f6bb18fb2 (diff)
downloadmicropython-ed6a5b78ad5d6f5aa5ad6a44e686884dc25ab235.tar.gz
micropython-ed6a5b78ad5d6f5aa5ad6a44e686884dc25ab235.zip
cc3200: Make auth param positional in wlan.connect.
-rw-r--r--cc3200/mods/modwlan.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/cc3200/mods/modwlan.c b/cc3200/mods/modwlan.c
index 1aa4dcd0f6..358daeb6f5 100644
--- a/cc3200/mods/modwlan.c
+++ b/cc3200/mods/modwlan.c
@@ -911,8 +911,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(wlan_scan_obj, wlan_scan);
STATIC mp_obj_t wlan_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
STATIC const mp_arg_t allowed_args[] = {
{ MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ, },
+ { MP_QSTR_auth, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_bssid, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
- { MP_QSTR_auth, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
};
@@ -930,19 +930,13 @@ STATIC mp_obj_t wlan_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
const char *ssid = mp_obj_str_get_data(args[0].u_obj, &ssid_len);
wlan_validate_ssid_len(ssid_len);
- // get the bssid
- const char *bssid = NULL;
- if (args[1].u_obj != mp_const_none) {
- bssid = mp_obj_str_get_str(args[1].u_obj);
- }
-
// get the auth config
uint8_t auth = SL_SEC_TYPE_OPEN;
mp_uint_t key_len = 0;
const char *key = NULL;
- if (args[2].u_obj != mp_const_none) {
+ if (args[1].u_obj != mp_const_none) {
mp_obj_t *sec;
- mp_obj_get_array_fixed_n(args[2].u_obj, 2, &sec);
+ mp_obj_get_array_fixed_n(args[1].u_obj, 2, &sec);
auth = mp_obj_get_int(sec[0]);
key = mp_obj_str_get_data(sec[1], &key_len);
wlan_validate_security(auth, key, key_len);
@@ -956,6 +950,12 @@ STATIC mp_obj_t wlan_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
}
}
+ // get the bssid
+ const char *bssid = NULL;
+ if (args[2].u_obj != mp_const_none) {
+ bssid = mp_obj_str_get_str(args[2].u_obj);
+ }
+
// get the timeout
int32_t timeout = -1;
if (args[3].u_obj != mp_const_none) {