#include #include volatile uint32_t global_systick = 0; volatile uint32_t systick_wait_counter; void systick_wait_ms(uint32_t ms) { systick_wait_counter = ms; while (systick_wait_counter > 0) __WFI(); } uint32_t systick_get_global_tick(void) { return global_systick; } void SysTick_Handler(void) { global_systick++; systick_wait_counter--; }