|
|
@ -90,15 +90,15 @@ void mp_hal_delay_us(mp_uint_t usec) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool sys_tick_has_passed(uint32_t start_tick, uint32_t delay_ms) { |
|
|
|
bool systick_has_passed(uint32_t start_tick, uint32_t delay_ms) { |
|
|
|
return HAL_GetTick() - start_tick >= delay_ms; |
|
|
|
} |
|
|
|
|
|
|
|
// waits until at least delay_ms milliseconds have passed from the sampling of
|
|
|
|
// startTick. Handles overflow properly. Assumes stc was taken from
|
|
|
|
// HAL_GetTick() some time before calling this function.
|
|
|
|
void sys_tick_wait_at_least(uint32_t start_tick, uint32_t delay_ms) { |
|
|
|
while (!sys_tick_has_passed(start_tick, delay_ms)) { |
|
|
|
void systick_wait_at_least(uint32_t start_tick, uint32_t delay_ms) { |
|
|
|
while (!systick_has_passed(start_tick, delay_ms)) { |
|
|
|
__WFI(); // enter sleep mode, waiting for interrupt
|
|
|
|
} |
|
|
|
} |
|
|
|