Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00038 #ifndef _timer_ticks_h
00039 #define _timer_ticks_h
00040
00043 #define TIMER_TICKS_HZ 16U
00044
00046 #define MS_TO_TICKS(m) (((m)*TIMER_TICKS_HZ+999U)/1000U)
00047
00048
00050 #define S_TO_TICKS(s) ((s)*TIMER_TICKS_HZ)
00051
00052
00054 #define TICKS_TO_S(t) ((t)/TIMER_TICKS_HZ)
00055
00057 #define TICKS_TO_MS(t) (((t)*1000U)/TIMER_TICKS_HZ)
00058
00059
00061 #define TICKS_CMP_OP(t1, t2, OP) \
00062 (((s_ticks_t)((ticks_t)(t1)-(ticks_t)(t2))) OP (s_ticks_t)0)
00063
00064 #define TICKS_LT(t1, t2) TICKS_CMP_OP(t1, t2, <)
00065
00066 #define TICKS_LE(t1, t2) TICKS_CMP_OP(t1, t2, <=)
00067
00068 #define TICKS_GT(t1, t2) TICKS_CMP_OP(t1, t2, >)
00069
00070 #define TICKS_GE(t1, t2) TICKS_CMP_OP(t1, t2, >=)
00071
00072
00073 typedef unsigned int ticks_t;
00074 typedef signed int s_ticks_t;
00075
00076 #endif