Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
a379b6ed
Commit
a379b6ed
authored
May 17, 2015
by
Daniel Campora
Browse files
cc3200: Add optional timeout param to WLAN.connect().
parent
fb9e4cf4
Changes
2
Hide whitespace changes
Inline
Side-by-side
cc3200/mods/modwlan.c
View file @
a379b6ed
...
...
@@ -187,7 +187,7 @@ STATIC void wlan_servers_start (void);
STATIC
void
wlan_servers_stop
(
void
);
STATIC
void
wlan_get_sl_mac
(
void
);
STATIC
modwlan_Status_t
wlan_do_connect
(
const
char
*
ssid
,
uint32_t
ssid_len
,
const
char
*
bssid
,
uint8_t
sec
,
const
char
*
key
,
uint32_t
key_len
);
const
char
*
key
,
uint32_t
key_len
,
uint32_t
timeout
);
STATIC
void
wlan_lpds_callback_enable
(
mp_obj_t
self_in
);
STATIC
void
wlan_lpds_callback_disable
(
mp_obj_t
self_in
);
STATIC
bool
wlan_scan_result_is_unique
(
const
mp_obj_list_t
*
nets
,
_u8
*
bssid
);
...
...
@@ -579,7 +579,7 @@ STATIC void wlan_servers_stop (void) {
}
STATIC
modwlan_Status_t
wlan_do_connect
(
const
char
*
ssid
,
uint32_t
ssid_len
,
const
char
*
bssid
,
uint8_t
sec
,
const
char
*
key
,
uint32_t
key_len
)
{
const
char
*
key
,
uint32_t
key_len
,
uint32_t
timeout
)
{
SlSecParams_t
secParams
;
secParams
.
Key
=
(
_i8
*
)
key
;
secParams
.
KeyLen
=
((
key
!=
NULL
)
?
key_len
:
0
);
...
...
@@ -591,7 +591,7 @@ STATIC modwlan_Status_t wlan_do_connect (const char* ssid, uint32_t ssid_len, co
while
(
!
IS_CONNECTED
(
wlan_obj
.
status
))
{
HAL_Delay
(
5
);
wlan_update
();
if
(
++
waitForConnectionMs
>=
MODWLAN_TIMEOUT_MS
)
{
if
(
++
waitForConnectionMs
>=
timeout
)
{
return
MODWLAN_ERROR_TIMEOUT
;
}
}
...
...
@@ -735,6 +735,7 @@ STATIC mp_obj_t wlan_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
{
MP_QSTR_security
,
MP_ARG_KW_ONLY
|
MP_ARG_INT
,
{.
u_int
=
SL_SEC_TYPE_OPEN
}
},
{
MP_QSTR_key
,
MP_ARG_KW_ONLY
|
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_timeout
,
MP_ARG_KW_ONLY
|
MP_ARG_INT
,
{.
u_int
=
MODWLAN_TIMEOUT_MS
}
},
};
// check for correct wlan mode
...
...
@@ -775,6 +776,9 @@ STATIC mp_obj_t wlan_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
bssid
=
mp_obj_str_get_str
(
args
[
3
].
u_obj
);
}
// get the timeout
uint32_t
timeout
=
MAX
(
args
[
4
].
u_int
,
0
);
if
(
GET_STATUS_BIT
(
wlan_obj
.
status
,
STATUS_BIT_CONNECTION
))
{
if
(
0
==
sl_WlanDisconnect
())
{
while
(
IS_CONNECTED
(
wlan_obj
.
status
))
{
...
...
@@ -786,8 +790,7 @@ STATIC mp_obj_t wlan_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
// connect to the requested access point
modwlan_Status_t
status
;
status
=
wlan_do_connect
(
ssid
,
ssid_len
,
bssid
,
sec
,
key
,
key_len
);
// TODO: make the timeout a parameter so that is configurable
status
=
wlan_do_connect
(
ssid
,
ssid_len
,
bssid
,
sec
,
key
,
key_len
,
timeout
);
if
(
status
==
MODWLAN_ERROR_TIMEOUT
)
{
nlr_raise
(
mp_obj_new_exception_msg
(
&
mp_type_OSError
,
mpexception_os_operation_failed
));
}
...
...
cc3200/mods/pybpin.c
View file @
a379b6ed
...
...
@@ -755,7 +755,7 @@ STATIC void EXTI_Handler(uint port) {
MAP_GPIOIntClear
(
port
,
bits
);
// might be that we have more than one Pin interrupt triggered at the same time
// therefore we must loop through all the 8 possible bits
// therefore we must loop through all
of
the 8 possible bits
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
uint32_t
bit
=
(
1
<<
i
);
if
(
bit
&
bits
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment