comparison examples/d-box/StatusLED.h @ 300:dbeed520b014 prerelease

Renamed projects to examples
author Giulio Moro <giuliomoro@yahoo.it>
date Fri, 27 May 2016 13:58:20 +0100
parents projects/d-box/StatusLED.h@8a575ba3ab52
children 421a69d42943
comparison
equal deleted inserted replaced
297:a3d83ebdf49b 300:dbeed520b014
1 /*
2 * StatusLED.h
3 *
4 *
5 */
6
7 #ifndef STATUSLED_H_
8 #define STATUSLED_H_
9
10 #include <pthread.h>
11
12 class StatusLED
13 {
14 public:
15 StatusLED();
16 ~StatusLED();
17
18 bool init(int gpio_pin);
19
20 void on();
21 void off();
22 void blink(int ms_on, int ms_off);
23
24 static void *static_blink_loop(void *data) {
25 ((StatusLED*)data)->blink_loop(NULL);
26 return 0;
27 }
28
29 void* blink_loop(void *);
30
31 private:
32 int gpio_number;
33 int milliseconds_on, milliseconds_off;
34 bool this_should_stop;
35 pthread_t blink_thread;
36 };
37
38 #endif // STATUSLED_H_