#ifndef OS_TIMER_H
#define OS_TIMER_H

#define MAX_TIMERS 20

extern unsigned char TimerCount;

//typ casovace
typedef enum TIMER_TYPE
{
	ONCE,
	PERIODICALY
}TIMER_TYPE;

//stav casovace
typedef enum TIMER_STATE
{
	ACTIVE,
	INACTIVE,
} TIMER_STATE;

//ID casovace
typedef enum TIMER_NAME
{
	CLOCK,
	APPLICATIONS_INIT,
	CURSOR,
    TOUCH_PANEL,
    BACKLIGHT,
    BATTERY,
	DRV_START_UP,
}TIMER_NAME;

//ridici struktura casovace
typedef struct TIMER
{
	void(*timer)(void);		//callback casovace
	TIMER_NAME name;		//ID casovace
	int interval;			//Interval v ms
	int remaining;			//zbyvajici cas pro spusteni
	TIMER_STATE state;		//stav
	TIMER_TYPE type;		//typ
}TIMER;




void initTimers(void);
RESULT TimerCreate(void(*ptr)(void),TIMER_NAME Name, int period,TIMER_TYPE typ, TIMER_STATE stat);
RESULT TimerDelete(TIMER_NAME Name);
RESULT TimerChangeState(TIMER_NAME Name, TIMER_STATE state);
void TimerRun(unsigned char index);
void Scheduler(void);
TIME_STAMP GetTimeStamp(void);
unsigned long GetElapsedTime(TIME_STAMP Start);
#endif