/*
===============================================================================
 Name        : main.c
 Author      : $(author)
 Version     :
 Copyright   : $(copyright)
 Description : main definition
===============================================================================
*/

#include "board.h"
#include "scheduler.h"

#include <cr_section_macros.h>

#define TICKRATE_HZ1	(100)

void SysTick_Handler(void)
{
	TickCounter++;
}

void delay(void){
	volatile unsigned int i;
	for (i=0; i<10000000; i++){};
}

int main(void) {

    // Read clock settings and update SystemCoreClock variable
    SystemCoreClockUpdate();
    // Set up and initialize all required blocks and
    // functions related to the board hardware
    Board_Init();
    if ( SysTick_Config(SystemCoreClock / TICKRATE_HZ1) == 1 )
    	while (1) {};	//error
    Board_LED_Set(LEDS_LED_B, false);
    volatile static int i = 0 ;

    uint16_t timer_led_a;
    ResetDelay(&timer_led_a);

    while(1) {
    	//__WFI();//
        HasDelayElapsed(500, &timer_led_a, true);

    }
    return 0 ;
}
