USB Device - Joystick/Mouse  1.0
hw_timer.h
Go to the documentation of this file.
1 #ifndef _HW_TIMER_H_
2 #define _HW_TIMER_H_
3 
4 #pragma pack(push,1) // jzz - radeji PRAGMA at vime jak je to velke
5 typedef struct
6 {
7  unsigned short ms; // milisekundy 0..59999 ms, vyuzito vse
8  unsigned char minutes; // minuty 0..59 min, nevyssi bit je IV bit, volny 1 bit
9  unsigned char hours; // hodiny 0..23 h , bit7-0x80 znamen8 SU - Summer Time, volne 2 - 3 bity
10  unsigned char days; // den v mesici 1..31 (tak to jsem zvedavej, co s tim provedu), volne 3 bity
11  unsigned char months; // mesic 1..12, volne 4 bity
12  unsigned char years; // roky 0..99, volny 1 bit
13 } SCP56Time;
14 #pragma pack(pop)
15 
16 
17 
18 // init timeru po 1ms - nutno zavolat pred zacatkem pouzivani odvozenych veci, tedy TIMERu, RTC, atd
19 void HwTimerInit(void);// udela init a enable
20 void HwTimerEnable();// enable
21 void HwTimerDisable();// disable
22 
23 typedef void (*PTIMER_FCE)(void);
24 
25 void RtcGetCP56Time(SCP56Time &t);
26 
27 // zarehistrovani funkce ktera bude volana po 1ms
29 
30 // pocet ticku od startu HW timeru, je to pocet [ms] na 4bajtech
31 unsigned long GetTickCount();
32 void Sleep(unsigned long tout);
33 void Sleep(unsigned long tout, bool passTsk);
34 
35 unsigned long DiffTickTimes(unsigned long first, unsigned long second);
36 // pro volani v ISR se stejnou prioritou jako je TIMER ISR
37 unsigned long ISR_GetTickCount();
38 // pro volani v ISR s vyssi prioritou jako je TIMER ISR
39 unsigned long UNKNOWN_ISR_GetTickCount();
40 
41 
42 #endif
unsigned char days
Definition: hw_timer.h:10
Definition: hw_timer.h:5
unsigned char months
Definition: hw_timer.h:11
void HwTimerEnable()
Definition: hw_timer.cpp:191
unsigned long UNKNOWN_ISR_GetTickCount()
Definition: hw_timer.cpp:60
unsigned short ms
Definition: hw_timer.h:7
void Sleep(unsigned long tout)
Definition: hw_timer.cpp:49
void HwTimerInit(void)
Definition: hw_timer.cpp:138
unsigned char years
Definition: hw_timer.h:12
unsigned long DiffTickTimes(unsigned long first, unsigned long second)
Definition: hw_timer.cpp:69
void(* PTIMER_FCE)(void)
Definition: hw_timer.h:23
unsigned long ISR_GetTickCount()
Definition: hw_timer.cpp:55
void HwTimerDisable()
Definition: hw_timer.cpp:195
void RegisterHwTimerFce(PTIMER_FCE fce)
Definition: hw_timer.cpp:22
unsigned char hours
Definition: hw_timer.h:9
unsigned long GetTickCount()
Definition: hw_timer.cpp:36
void RtcGetCP56Time(SCP56Time &t)
Definition: hw_timer.cpp:15
unsigned char minutes
Definition: hw_timer.h:8