A typical example for using the CMSIS layer is provided below. The example is based on an unspecific Cortex-A9 Device.
static const uint32_t TICK_RATE_HZ = 1000U;
uint32_t volatile msTicks;
static void SysTick_Handler( void )
{
msTicks++;
}
void private_timer_init(void) {
}
void Delay(uint32_t ticks) {
uint32_t tgtTicks = msTicks + ticks;
while (msTicks == tgtTicks) {
}
}
int main(void)
{
private_timer_init();
static uint8_t ledState = 0;
while (1)
{
ledState = !ledState;
Delay(500);
}
}