Skip to content

Commit f4decdc

Browse files
committed
cc3200: Switch from HAL_Delay() to mp_hal_delay_ms().
1 parent eb099b9 commit f4decdc

File tree

9 files changed

+18
-18
lines changed

9 files changed

+18
-18
lines changed

cc3200/fatfs/src/drivers/sd_diskio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static unsigned int CardSelect (DiskInfo_t *sDiskInfo) {
187187
}
188188

189189
// Delay 250ms for the card to become ready
190-
HAL_Delay (250);
190+
mp_hal_delay_ms(250);
191191

192192
return ulRet;
193193
}

cc3200/hal/cc3200_hal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ uint32_t HAL_GetTick(void) {
108108
return HAL_tickCount;
109109
}
110110

111-
void HAL_Delay(uint32_t delay) {
111+
void mp_hal_delay_ms(uint32_t delay) {
112112
// only if we are not within interrupt context and interrupts are enabled
113113
if ((HAL_NVIC_INT_CTRL_REG & HAL_VECTACTIVE_MASK) == 0 && query_irq() == IRQ_STATE_ENABLED) {
114114
#ifdef USE_FREERTOS
@@ -193,7 +193,7 @@ int mp_hal_stdin_rx_chr(void) {
193193
}
194194
}
195195
}
196-
HAL_Delay(1);
196+
mp_hal_delay_ms(1);
197197
}
198198
}
199199

cc3200/hal/cc3200_hal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ extern void HAL_SystemInit (void);
6363
extern void HAL_SystemDeInit (void);
6464
extern void HAL_IncrementTick(void);
6565
extern uint32_t HAL_GetTick(void);
66-
extern void HAL_Delay(uint32_t delay);
66+
extern void mp_hal_delay_ms(uint32_t delay);
6767
extern NORETURN void mp_hal_raise(int errno);
6868
extern void mp_hal_set_interrupt_char (int c);
6969

cc3200/mods/modutime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(time_time_obj, time_time);
125125
STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) {
126126
int32_t sleep_s = mp_obj_get_int(seconds_o);
127127
if (sleep_s > 0) {
128-
HAL_Delay(sleep_s * 1000);
128+
mp_hal_delay_ms(sleep_s * 1000);
129129
}
130130
return mp_const_none;
131131
}
@@ -134,7 +134,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_obj, time_sleep);
134134
STATIC mp_obj_t time_sleep_ms (mp_obj_t ms_in) {
135135
mp_int_t ms = mp_obj_get_int(ms_in);
136136
if (ms > 0) {
137-
HAL_Delay(ms);
137+
mp_hal_delay_ms(ms);
138138
}
139139
return mp_const_none;
140140
}

cc3200/mods/modwlan.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ STATIC void wlan_sl_disconnect (void) {
691691
// other return-codes
692692
if (0 == sl_WlanDisconnect()) {
693693
while (IS_CONNECTED(wlan_obj.status)) {
694-
HAL_Delay(MODWLAN_CONNECTION_WAIT_MS);
694+
mp_hal_delay_ms(MODWLAN_CONNECTION_WAIT_MS);
695695
wlan_update();
696696
}
697697
}
@@ -711,7 +711,7 @@ STATIC modwlan_Status_t wlan_do_connect (const char* ssid, uint32_t ssid_len, co
711711
// wait for the WLAN Event
712712
uint32_t waitForConnectionMs = 0;
713713
while (timeout && !IS_CONNECTED(wlan_obj.status)) {
714-
HAL_Delay(MODWLAN_CONNECTION_WAIT_MS);
714+
mp_hal_delay_ms(MODWLAN_CONNECTION_WAIT_MS);
715715
waitForConnectionMs += MODWLAN_CONNECTION_WAIT_MS;
716716
if (timeout > 0 && waitForConnectionMs > timeout) {
717717
return MODWLAN_ERROR_TIMEOUT;
@@ -875,7 +875,7 @@ STATIC mp_obj_t wlan_scan(mp_obj_t self_in) {
875875
ASSERT_ON_ERROR(sl_WlanPolicySet(SL_POLICY_SCAN , MODWLAN_SL_SCAN_ENABLE, (_u8 *)&scanSeconds, sizeof(scanSeconds)));
876876

877877
// wait for the scan to complete
878-
HAL_Delay (MODWLAN_WAIT_FOR_SCAN_MS);
878+
mp_hal_delay_ms(MODWLAN_WAIT_FOR_SCAN_MS);
879879

880880
do {
881881
if (sl_WlanGetNetworkList(_index++, 1, &wlanEntry) <= 0) {

cc3200/mods/pybsleep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void pyb_sleep_sleep (void) {
247247
if (pybsleep_data.rtc_obj->irq_enabled && (pybsleep_data.rtc_obj->pwrmode & PYB_PWR_MODE_LPDS)) {
248248
if (!setup_timer_lpds_wake()) {
249249
// lpds entering is not possible, wait for the forced interrupt and return
250-
HAL_Delay (FAILED_SLEEP_DELAY_MS);
250+
mp_hal_delay_ms(FAILED_SLEEP_DELAY_MS);
251251
return;
252252
}
253253
} else {
@@ -280,7 +280,7 @@ void pyb_sleep_deepsleep (void) {
280280
if (pybsleep_data.rtc_obj->irq_enabled && (pybsleep_data.rtc_obj->pwrmode & PYB_PWR_MODE_HIBERNATE)) {
281281
if (!setup_timer_hibernate_wake()) {
282282
// hibernating is not possible, wait for the forced interrupt and return
283-
HAL_Delay (FAILED_SLEEP_DELAY_MS);
283+
mp_hal_delay_ms(FAILED_SLEEP_DELAY_MS);
284284
return;
285285
}
286286
} else {

cc3200/mptask.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void TASK_Micropython (void *pvParameters) {
236236
modusocket_close_all_user_sockets();
237237

238238
// wait for pending transactions to complete
239-
HAL_Delay(20);
239+
mp_hal_delay_ms(20);
240240

241241
goto soft_reset;
242242
}

cc3200/serverstask.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,21 @@ void TASK_Servers (void *pvParameters) {
131131

132132
// move to the next cycle
133133
cycle = cycle ? false : true;
134-
HAL_Delay(SERVERS_CYCLE_TIME_MS);
134+
mp_hal_delay_ms(SERVERS_CYCLE_TIME_MS);
135135
}
136136
}
137137

138138
void servers_start (void) {
139139
servers_data.do_enable = true;
140-
HAL_Delay (SERVERS_CYCLE_TIME_MS * 3);
140+
mp_hal_delay_ms(SERVERS_CYCLE_TIME_MS * 3);
141141
}
142142

143143
void servers_stop (void) {
144144
servers_data.do_disable = true;
145145
do {
146-
HAL_Delay (SERVERS_CYCLE_TIME_MS);
146+
mp_hal_delay_ms(SERVERS_CYCLE_TIME_MS);
147147
} while (servers_are_enabled());
148-
HAL_Delay (SERVERS_CYCLE_TIME_MS * 3);
148+
mp_hal_delay_ms(SERVERS_CYCLE_TIME_MS * 3);
149149
}
150150

151151
void servers_reset (void) {
@@ -158,7 +158,7 @@ bool servers_are_enabled (void) {
158158

159159
void server_sleep_sockets (void) {
160160
sleep_sockets = true;
161-
HAL_Delay (SERVERS_CYCLE_TIME_MS + 1);
161+
mp_hal_delay_ms(SERVERS_CYCLE_TIME_MS + 1);
162162
}
163163

164164
void servers_close_socket (int16_t *sd) {

cc3200/telnet/telnet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ static bool telnet_send_with_retries (int16_t sd, const void *pBuf, int16_t len)
477477
return false;
478478
}
479479
// start with the default delay and increment it on each retry
480-
HAL_Delay (delay++);
480+
mp_hal_delay_ms(delay++);
481481
} while (++retries <= TELNET_TX_RETRIES_MAX);
482482
}
483483
return false;

0 commit comments

Comments
 (0)