Skip to content

Commit 0e96d1b

Browse files
committed
cc3200: Add parameter to wlan_stop() for custom timeout values.
1 parent f382f44 commit 0e96d1b

6 files changed

Lines changed: 11 additions & 14 deletions

File tree

cc3200/mods/modpyb.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,8 @@ extern OsiTaskHandle xSimpleLinkSpawnTaskHndl;
8282
/// Resets the pyboard in a manner similar to pushing the external RESET
8383
/// button.
8484
STATIC mp_obj_t pyb_hard_reset(void) {
85-
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
86-
// disable wlan services
87-
wlan_stop_servers();
88-
#endif
89-
wlan_stop();
85+
// disable wlan
86+
wlan_stop(SL_STOP_TIMEOUT_LONG);
9087
// perform a SoC reset
9188
PRCMSOCReset();
9289
return mp_const_none;

cc3200/mods/modwlan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ void wlan_update(void) {
529529
}
530530

531531
// call this function to disable the complete WLAN subsystem before a system reset
532-
void wlan_stop (void) {
532+
void wlan_stop (uint32_t timeout) {
533533
if (wlan_obj.mode >= 0) {
534534
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
535535
// Stop all other processes using the wlan engine
@@ -539,7 +539,7 @@ void wlan_stop (void) {
539539
#endif
540540
sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
541541
wlan_obj.mode = -1;
542-
sl_Stop(SL_STOP_TIMEOUT);
542+
sl_Stop(MAX(timeout, SL_STOP_TIMEOUT));
543543
}
544544
}
545545

cc3200/mods/modwlan.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define SIMPLELINK_SPAWN_TASK_PRIORITY 3
3434
#define SIMPLELINK_TASK_STACK_SIZE 2048
3535
#define SL_STOP_TIMEOUT 35
36+
#define SL_STOP_TIMEOUT_LONG 255
3637

3738
/******************************************************************************
3839
DEFINE TYPES
@@ -56,7 +57,7 @@ extern void wlan_init0 (void);
5657
extern modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ssid_len, uint8_t sec,
5758
const char *key, uint8_t key_len, uint8_t channel);
5859
extern void wlan_first_start (void);
59-
extern void wlan_stop (void);
60+
extern void wlan_stop (uint32_t timeout);
6061
extern void wlan_get_mac (uint8_t *macAddress);
6162
extern void wlan_get_ip (uint32_t *ip);
6263
extern void wlan_stop_servers (void);

cc3200/mods/pybpin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,12 @@ STATIC void pin_extint_enable (mp_obj_t self_in) {
331331
MAP_PRCMHibernateWakeupSourceDisable(hib_pin);
332332
}
333333
}
334-
// if idx is invalid, the the pin supports active interrupts for sure
334+
// if idx is invalid, the pin supports active interrupts for sure
335335
if (idx >= PYBPIN_NUM_WAKE_PINS || pybpin_wake_pin[idx].active) {
336336
MAP_GPIOIntClear(self->port, self->bit);
337337
MAP_GPIOIntEnable(self->port, self->bit);
338338
}
339-
// in case in was enabled before
339+
// in case it was enabled before
340340
else if (idx < PYBPIN_NUM_WAKE_PINS && !pybpin_wake_pin[idx].active) {
341341
MAP_GPIOIntDisable(self->port, self->bit);
342342
}

cc3200/mods/pybsleep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ STATIC mp_obj_t pyb_sleep_hibernate (mp_obj_t self_in) {
613613
return mp_const_none;
614614
}
615615
}
616-
wlan_stop();
616+
wlan_stop(SL_STOP_TIMEOUT);
617617
pybsleep_flash_powerdown();
618618
MAP_PRCMHibernateEnter();
619619
return mp_const_none;

cc3200/mptask.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,8 @@ void TASK_Micropython (void *pvParameters) {
246246
// wait for all bus transfers to complete
247247
HAL_Delay(50);
248248

249-
// disable wlan services
250-
wlan_stop_servers();
251-
wlan_stop();
249+
// disable wlan
250+
wlan_stop(SL_STOP_TIMEOUT_LONG);
252251

253252
// de-initialize the stdio uart
254253
if (pyb_stdio_uart) {

0 commit comments

Comments
 (0)