Browse Source

stm32/systick: Rename sys_tick_XXX functions to systick_XXX.

pull/4474/head
Damien George 6 years ago
parent
commit
5fbda53d3c
  1. 4
      ports/stm32/main.c
  2. 6
      ports/stm32/systick.c
  3. 4
      ports/stm32/systick.h

4
ports/stm32/main.c

@ -229,7 +229,7 @@ MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) {
f_close(&fp);
// keep LED on for at least 200ms
sys_tick_wait_at_least(start_tick, 200);
systick_wait_at_least(start_tick, 200);
led_state(PYB_LED_GREEN, 0);
} else if (res == FR_OK) {
// mount sucessful
@ -273,7 +273,7 @@ MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) {
f_close(&fp);
// keep LED on for at least 200ms
sys_tick_wait_at_least(start_tick, 200);
systick_wait_at_least(start_tick, 200);
led_state(PYB_LED_GREEN, 0);
}

6
ports/stm32/systick.c

@ -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
}
}

4
ports/stm32/systick.h

@ -26,7 +26,7 @@
#ifndef MICROPY_INCLUDED_STM32_SYSTICK_H
#define MICROPY_INCLUDED_STM32_SYSTICK_H
void sys_tick_wait_at_least(uint32_t stc, uint32_t delay_ms);
bool sys_tick_has_passed(uint32_t stc, uint32_t delay_ms);
void systick_wait_at_least(uint32_t stc, uint32_t delay_ms);
bool systick_has_passed(uint32_t stc, uint32_t delay_ms);
#endif // MICROPY_INCLUDED_STM32_SYSTICK_H

Loading…
Cancel
Save