Out-of-office display, GFX
 All Classes Files Functions Variables Enumerations Enumerator Groups
tickTimer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Andreas Misje
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
25 #ifndef TICKTIMER_H
26 #define TICKTIMER_H
27 
28 #include <stdbool.h>
29 
33 #define TICKTIMER_MAX_CALLBACKS 15
34 
38 #define TICKTIMER_TIMER_NO 1
39 
43 struct tick
44 {
46  unsigned int s;
48  unsigned int ms;
49 };
50 
55 {
62 };
63 
77 int tickTimer_init( unsigned int intervalMs, int priority );
78 
84 struct tick tickTimer_getTick();
85 
94 unsigned long tickTimer_diff( const struct tick *lastTick );
95 
106 bool tickTimer_hasPassed( const struct tick *lastTick,
107  unsigned long durationMs );
108 
134 int tickTimer_addCallback( void ( *callback )( void *arg ), void *arg,
135  int intervalSecs, int intervalMSecs, int repeats );
136 
142 void tickTimer_removeCallback( void ( *callback )( void *arg ) );
143 
154 bool tickTimer_callbackActive( void ( *callback )( void *arg ) );
155 
164 
165 #endif // TICKTIMER_H
166