mirror of
https://github.com/EranMorkon/AMTS.git
synced 2023-12-28 16:48:38 +00:00
24 lines
386 B
C
24 lines
386 B
C
#include "systick.h"
|
|
|
|
volatile uint32_t SysTickCnt;
|
|
|
|
void SysTick_Handler()
|
|
{
|
|
SysTickCnt++;
|
|
}
|
|
|
|
void systick_init(void)
|
|
{
|
|
RCC_ClocksTypeDef clocks;
|
|
RCC_GetClocksFreq(&clocks);
|
|
SysTick_Config(clocks.HCLK_Frequency/1000 - 1);
|
|
|
|
SysTickCnt = 0;
|
|
}
|
|
|
|
void Wait(uint32_t ms)
|
|
{
|
|
uint32_t SysTickCntHold = SysTickCnt;
|
|
while((SysTickCnt - SysTickCntHold) <= ms);
|
|
}
|