Skip to content

Commit ed6a5b7

Browse files
author
Daniel Campora
committed
cc3200: Make auth param positional in wlan.connect.
1 parent d5de1bf commit ed6a5b7

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

cc3200/mods/modwlan.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(wlan_scan_obj, wlan_scan);
911911
STATIC mp_obj_t wlan_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
912912
STATIC const mp_arg_t allowed_args[] = {
913913
{ MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ, },
914+
{ MP_QSTR_auth, MP_ARG_OBJ, {.u_obj = mp_const_none} },
914915
{ MP_QSTR_bssid, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
915-
{ MP_QSTR_auth, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
916916
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
917917
};
918918

@@ -930,19 +930,13 @@ STATIC mp_obj_t wlan_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
930930
const char *ssid = mp_obj_str_get_data(args[0].u_obj, &ssid_len);
931931
wlan_validate_ssid_len(ssid_len);
932932

933-
// get the bssid
934-
const char *bssid = NULL;
935-
if (args[1].u_obj != mp_const_none) {
936-
bssid = mp_obj_str_get_str(args[1].u_obj);
937-
}
938-
939933
// get the auth config
940934
uint8_t auth = SL_SEC_TYPE_OPEN;
941935
mp_uint_t key_len = 0;
942936
const char *key = NULL;
943-
if (args[2].u_obj != mp_const_none) {
937+
if (args[1].u_obj != mp_const_none) {
944938
mp_obj_t *sec;
945-
mp_obj_get_array_fixed_n(args[2].u_obj, 2, &sec);
939+
mp_obj_get_array_fixed_n(args[1].u_obj, 2, &sec);
946940
auth = mp_obj_get_int(sec[0]);
947941
key = mp_obj_str_get_data(sec[1], &key_len);
948942
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_
956950
}
957951
}
958952

953+
// get the bssid
954+
const char *bssid = NULL;
955+
if (args[2].u_obj != mp_const_none) {
956+
bssid = mp_obj_str_get_str(args[2].u_obj);
957+
}
958+
959959
// get the timeout
960960
int32_t timeout = -1;
961961
if (args[3].u_obj != mp_const_none) {

0 commit comments

Comments
 (0)