CoffeePi Coffee machine control for Raspberry Pi

- Main Page
- Data Structures
- Files

- File List
- Globals

timer.h
Go to the documentation of this file.
1 /*
2 * timer.h
3 *
4 * Created on: Nov 9, 2015
5 * Author: Philipp Hinz
6 */
7
8 #ifndef TIMER_H_
9 #define TIMER_H_
10
17 class timer {
18 public:
19 timer(void (*handler)(void));
20 timer(void *(*handler)(void *));
21 void setDivider(int divider);
22 int getDivider();
23 void call();
24 void start();
25 void stop();
26 bool isActive();
27 timer *next;
28 private:
29 void (*handler)(void);
30 void *(*thandler)(void *);
31 int divider;
32 int id = 0;
33 bool active;
34 bool asThread;
35 pthread_t thread;
36 };
37
38 void initTimers(void);
39 void stopTimers(void);
40 void *nullThread(void *threadid);
41
42 #define SIG SIGRTMIN
43 #define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)
44 #define CLOCKID CLOCK_REALTIME
45
46 #endif /* TIMER_H_ */
timer::timer
timer(void(*handler)(void))
Timer constructor Depending on the call of the constructor the handler will be called as thread or no...
Definition: timer.cpp:34
initTimers
void initTimers(void)
inits the system timer based on signals
Definition: timer.cpp:153
timer::call
void call()
Calls the timer handler if enabled.
Definition: timer.cpp:69
nullThread
void * nullThread(void *threadid)
This is a dummy thread.
Definition: timer.cpp:229
timer::next
timer * next
contains the pointer on the next timer element of the list
Definition: timer.h:27
timer::start
void start()
enables the timer
Definition: timer.cpp:93
stopTimers
void stopTimers(void)
Stops all existing timers.
Definition: timer.cpp:214
timer::isActive
bool isActive()
Returns the timers active state.
Definition: timer.cpp:128
timer::setDivider
void setDivider(int divider)
sets the divider for this timer (based on system timer)
Definition: timer.cpp:110
timer::getDivider
int getDivider()
reads the timer divider
Definition: timer.cpp:119
timer
Timer Class This class allows the creation of multiple timers that are based by a divider on a single...
Definition: timer.h:17
timer::stop
void stop()
disables the timer
Definition: timer.cpp:101