Browse Source

cc3200: Add parameter to wlan_stop() for custom timeout values.

pull/1082/merge
danicampora 10 years ago
parent
commit
0e96d1b3f1
  1. 7
      cc3200/mods/modpyb.c
  2. 4
      cc3200/mods/modwlan.c
  3. 3
      cc3200/mods/modwlan.h
  4. 4
      cc3200/mods/pybpin.c
  5. 2
      cc3200/mods/pybsleep.c
  6. 5
      cc3200/mptask.c

7
cc3200/mods/modpyb.c

@ -82,11 +82,8 @@ extern OsiTaskHandle xSimpleLinkSpawnTaskHndl;
/// Resets the pyboard in a manner similar to pushing the external RESET
/// button.
STATIC mp_obj_t pyb_hard_reset(void) {
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
// disable wlan services
wlan_stop_servers();
#endif
wlan_stop();
// disable wlan
wlan_stop(SL_STOP_TIMEOUT_LONG);
// perform a SoC reset
PRCMSOCReset();
return mp_const_none;

4
cc3200/mods/modwlan.c

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

3
cc3200/mods/modwlan.h

@ -33,6 +33,7 @@
#define SIMPLELINK_SPAWN_TASK_PRIORITY 3
#define SIMPLELINK_TASK_STACK_SIZE 2048
#define SL_STOP_TIMEOUT 35
#define SL_STOP_TIMEOUT_LONG 255
/******************************************************************************
DEFINE TYPES
@ -56,7 +57,7 @@ extern void wlan_init0 (void);
extern modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ssid_len, uint8_t sec,
const char *key, uint8_t key_len, uint8_t channel);
extern void wlan_first_start (void);
extern void wlan_stop (void);
extern void wlan_stop (uint32_t timeout);
extern void wlan_get_mac (uint8_t *macAddress);
extern void wlan_get_ip (uint32_t *ip);
extern void wlan_stop_servers (void);

4
cc3200/mods/pybpin.c

@ -331,12 +331,12 @@ STATIC void pin_extint_enable (mp_obj_t self_in) {
MAP_PRCMHibernateWakeupSourceDisable(hib_pin);
}
}
// if idx is invalid, the the pin supports active interrupts for sure
// if idx is invalid, the pin supports active interrupts for sure
if (idx >= PYBPIN_NUM_WAKE_PINS || pybpin_wake_pin[idx].active) {
MAP_GPIOIntClear(self->port, self->bit);
MAP_GPIOIntEnable(self->port, self->bit);
}
// in case in was enabled before
// in case it was enabled before
else if (idx < PYBPIN_NUM_WAKE_PINS && !pybpin_wake_pin[idx].active) {
MAP_GPIOIntDisable(self->port, self->bit);
}

2
cc3200/mods/pybsleep.c

@ -613,7 +613,7 @@ STATIC mp_obj_t pyb_sleep_hibernate (mp_obj_t self_in) {
return mp_const_none;
}
}
wlan_stop();
wlan_stop(SL_STOP_TIMEOUT);
pybsleep_flash_powerdown();
MAP_PRCMHibernateEnter();
return mp_const_none;

5
cc3200/mptask.c

@ -246,9 +246,8 @@ soft_reset_exit:
// wait for all bus transfers to complete
HAL_Delay(50);
// disable wlan services
wlan_stop_servers();
wlan_stop();
// disable wlan
wlan_stop(SL_STOP_TIMEOUT_LONG);
// de-initialize the stdio uart
if (pyb_stdio_uart) {

Loading…
Cancel
Save