comparison examples/10-Instruments/d-box/StatusLED.h @ 464:8fcfbfb32aa0 prerelease

Examples reorder with subdirectories. Added header to each project. Moved Doxygen to bottom of render.cpp.
author Robert Jack <robert.h.jack@gmail.com>
date Mon, 20 Jun 2016 16:20:38 +0100
parents
children
comparison
equal deleted inserted replaced
463:c47709e8b5c9 464:8fcfbfb32aa0
1 /*
2 * StatusLED.h
3 *
4 *
5 */
6
7 #ifndef STATUSLED_H_
8 #define STATUSLED_H_
9
10 #include <pthread.h>
11 #include <unistd.h>
12
13 class StatusLED
14 {
15 public:
16 StatusLED();
17 ~StatusLED();
18
19 bool init(int gpio_pin);
20
21 void on();
22 void off();
23 void blink(int ms_on, int ms_off);
24
25 static void *static_blink_loop(void *data) {
26 ((StatusLED*)data)->blink_loop(NULL);
27 return 0;
28 }
29
30 void* blink_loop(void *);
31
32 private:
33 int gpio_number;
34 int milliseconds_on, milliseconds_off;
35 bool this_should_stop;
36 pthread_t blink_thread;
37 };
38
39 #endif // STATUSLED_H_