2022-08-05 18:06:48 +02:00
|
|
|
#include <systick.h>
|
2022-10-22 00:16:33 +02:00
|
|
|
#include <stm32f0xx.h>
|
2022-08-05 18:06:48 +02:00
|
|
|
|
|
|
|
volatile uint32_t global_systick = 0;
|
|
|
|
volatile uint32_t systick_wait_counter;
|
|
|
|
|
|
|
|
void systick_wait_ms(uint32_t ms)
|
|
|
|
{
|
|
|
|
systick_wait_counter = ms;
|
|
|
|
|
2022-10-22 00:16:33 +02:00
|
|
|
while (systick_wait_counter > 0)
|
|
|
|
__WFI();
|
2022-08-05 18:06:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t systick_get_global_tick(void)
|
|
|
|
{
|
|
|
|
return global_systick;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SysTick_Handler(void)
|
|
|
|
{
|
|
|
|
global_systick++;
|
|
|
|
systick_wait_counter--;
|
|
|
|
}
|