annotate examples/d-box/StatusLED.h @ 438:ad3f61134bb4 prerelease

More compatibility
author Giulio Moro <giuliomoro@yahoo.it>
date Sat, 18 Jun 2016 02:25:48 +0100
parents 421a69d42943
children
rev   line source
andrewm@0 1 /*
andrewm@0 2 * StatusLED.h
andrewm@0 3 *
andrewm@0 4 *
andrewm@0 5 */
andrewm@0 6
andrewm@0 7 #ifndef STATUSLED_H_
andrewm@0 8 #define STATUSLED_H_
andrewm@0 9
andrewm@0 10 #include <pthread.h>
andrewm@303 11 #include <unistd.h>
andrewm@0 12
andrewm@0 13 class StatusLED
andrewm@0 14 {
andrewm@0 15 public:
andrewm@0 16 StatusLED();
andrewm@0 17 ~StatusLED();
andrewm@0 18
andrewm@0 19 bool init(int gpio_pin);
andrewm@0 20
andrewm@0 21 void on();
andrewm@0 22 void off();
andrewm@0 23 void blink(int ms_on, int ms_off);
andrewm@0 24
andrewm@0 25 static void *static_blink_loop(void *data) {
andrewm@0 26 ((StatusLED*)data)->blink_loop(NULL);
andrewm@0 27 return 0;
andrewm@0 28 }
andrewm@0 29
andrewm@0 30 void* blink_loop(void *);
andrewm@0 31
andrewm@0 32 private:
andrewm@0 33 int gpio_number;
andrewm@0 34 int milliseconds_on, milliseconds_off;
andrewm@0 35 bool this_should_stop;
andrewm@0 36 pthread_t blink_thread;
andrewm@0 37 };
andrewm@0 38
andrewm@0 39 #endif // STATUSLED_H_