25 lines
381 B
C
25 lines
381 B
C
#include <systick.h>
|
|
#include <stm32f0xx.h>
|
|
|
|
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--;
|
|
}
|