comparison examples/10-Instruments/d-box/StatusLED.h @ 468:85cf9c0da052 prerelease

merge
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 20 Jun 2016 17:08:02 +0100
parents 8fcfbfb32aa0
children
comparison
equal deleted inserted replaced
467:03a2cd5f151b 468:85cf9c0da052
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_