Mercurial > hg > beaglert
comparison projects/d-box/StatusLED.h @ 0:8a575ba3ab52
Initial commit.
author | andrewm |
---|---|
date | Fri, 31 Oct 2014 19:10:17 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8a575ba3ab52 |
---|---|
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_ |