Commit f4decdc4 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

cc3200: Switch from HAL_Delay() to mp_hal_delay_ms().

parent eb099b98
......@@ -187,7 +187,7 @@ static unsigned int CardSelect (DiskInfo_t *sDiskInfo) {
}
// Delay 250ms for the card to become ready
HAL_Delay (250);
mp_hal_delay_ms(250);
return ulRet;
}
......
......@@ -108,7 +108,7 @@ uint32_t HAL_GetTick(void) {
return HAL_tickCount;
}
void HAL_Delay(uint32_t delay) {
void mp_hal_delay_ms(uint32_t delay) {
// only if we are not within interrupt context and interrupts are enabled
if ((HAL_NVIC_INT_CTRL_REG & HAL_VECTACTIVE_MASK) == 0 && query_irq() == IRQ_STATE_ENABLED) {
#ifdef USE_FREERTOS
......@@ -193,7 +193,7 @@ int mp_hal_stdin_rx_chr(void) {
}
}
}
HAL_Delay(1);
mp_hal_delay_ms(1);
}
}
......
......@@ -63,7 +63,7 @@ extern void HAL_SystemInit (void);
extern void HAL_SystemDeInit (void);
extern void HAL_IncrementTick(void);
extern uint32_t HAL_GetTick(void);
extern void HAL_Delay(uint32_t delay);
extern void mp_hal_delay_ms(uint32_t delay);
extern NORETURN void mp_hal_raise(int errno);
extern void mp_hal_set_interrupt_char (int c);
......
......@@ -125,7 +125,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(time_time_obj, time_time);
STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) {
int32_t sleep_s = mp_obj_get_int(seconds_o);
if (sleep_s > 0) {
HAL_Delay(sleep_s * 1000);
mp_hal_delay_ms(sleep_s * 1000);
}
return mp_const_none;
}
......@@ -134,7 +134,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_obj, time_sleep);
STATIC mp_obj_t time_sleep_ms (mp_obj_t ms_in) {
mp_int_t ms = mp_obj_get_int(ms_in);
if (ms > 0) {
HAL_Delay(ms);
mp_hal_delay_ms(ms);
}
return mp_const_none;
}
......
......@@ -691,7 +691,7 @@ STATIC void wlan_sl_disconnect (void) {
// other return-codes
if (0 == sl_WlanDisconnect()) {
while (IS_CONNECTED(wlan_obj.status)) {
HAL_Delay(MODWLAN_CONNECTION_WAIT_MS);
mp_hal_delay_ms(MODWLAN_CONNECTION_WAIT_MS);
wlan_update();
}
}
......@@ -711,7 +711,7 @@ STATIC modwlan_Status_t wlan_do_connect (const char* ssid, uint32_t ssid_len, co
// wait for the WLAN Event
uint32_t waitForConnectionMs = 0;
while (timeout && !IS_CONNECTED(wlan_obj.status)) {
HAL_Delay(MODWLAN_CONNECTION_WAIT_MS);
mp_hal_delay_ms(MODWLAN_CONNECTION_WAIT_MS);
waitForConnectionMs += MODWLAN_CONNECTION_WAIT_MS;
if (timeout > 0 && waitForConnectionMs > timeout) {
return MODWLAN_ERROR_TIMEOUT;
......@@ -875,7 +875,7 @@ STATIC mp_obj_t wlan_scan(mp_obj_t self_in) {
ASSERT_ON_ERROR(sl_WlanPolicySet(SL_POLICY_SCAN , MODWLAN_SL_SCAN_ENABLE, (_u8 *)&scanSeconds, sizeof(scanSeconds)));
// wait for the scan to complete
HAL_Delay (MODWLAN_WAIT_FOR_SCAN_MS);
mp_hal_delay_ms(MODWLAN_WAIT_FOR_SCAN_MS);
do {
if (sl_WlanGetNetworkList(_index++, 1, &wlanEntry) <= 0) {
......
......@@ -247,7 +247,7 @@ void pyb_sleep_sleep (void) {
if (pybsleep_data.rtc_obj->irq_enabled && (pybsleep_data.rtc_obj->pwrmode & PYB_PWR_MODE_LPDS)) {
if (!setup_timer_lpds_wake()) {
// lpds entering is not possible, wait for the forced interrupt and return
HAL_Delay (FAILED_SLEEP_DELAY_MS);
mp_hal_delay_ms(FAILED_SLEEP_DELAY_MS);
return;
}
} else {
......@@ -280,7 +280,7 @@ void pyb_sleep_deepsleep (void) {
if (pybsleep_data.rtc_obj->irq_enabled && (pybsleep_data.rtc_obj->pwrmode & PYB_PWR_MODE_HIBERNATE)) {
if (!setup_timer_hibernate_wake()) {
// hibernating is not possible, wait for the forced interrupt and return
HAL_Delay (FAILED_SLEEP_DELAY_MS);
mp_hal_delay_ms(FAILED_SLEEP_DELAY_MS);
return;
}
} else {
......
......@@ -236,7 +236,7 @@ soft_reset_exit:
modusocket_close_all_user_sockets();
// wait for pending transactions to complete
HAL_Delay(20);
mp_hal_delay_ms(20);
goto soft_reset;
}
......
......@@ -131,21 +131,21 @@ void TASK_Servers (void *pvParameters) {
// move to the next cycle
cycle = cycle ? false : true;
HAL_Delay(SERVERS_CYCLE_TIME_MS);
mp_hal_delay_ms(SERVERS_CYCLE_TIME_MS);
}
}
void servers_start (void) {
servers_data.do_enable = true;
HAL_Delay (SERVERS_CYCLE_TIME_MS * 3);
mp_hal_delay_ms(SERVERS_CYCLE_TIME_MS * 3);
}
void servers_stop (void) {
servers_data.do_disable = true;
do {
HAL_Delay (SERVERS_CYCLE_TIME_MS);
mp_hal_delay_ms(SERVERS_CYCLE_TIME_MS);
} while (servers_are_enabled());
HAL_Delay (SERVERS_CYCLE_TIME_MS * 3);
mp_hal_delay_ms(SERVERS_CYCLE_TIME_MS * 3);
}
void servers_reset (void) {
......@@ -158,7 +158,7 @@ bool servers_are_enabled (void) {
void server_sleep_sockets (void) {
sleep_sockets = true;
HAL_Delay (SERVERS_CYCLE_TIME_MS + 1);
mp_hal_delay_ms(SERVERS_CYCLE_TIME_MS + 1);
}
void servers_close_socket (int16_t *sd) {
......
......@@ -477,7 +477,7 @@ static bool telnet_send_with_retries (int16_t sd, const void *pBuf, int16_t len)
return false;
}
// start with the default delay and increment it on each retry
HAL_Delay (delay++);
mp_hal_delay_ms(delay++);
} while (++retries <= TELNET_TX_RETRIES_MAX);
}
return false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment