annotate projects/d-box/StatusLED.h @ 45:579c86316008 newapi

Major API overhaul. Moved to a single data structure for handling render functions. Functionally, generally similar except for scheduling within PRU loop function, which now uses interrupts from the PRU rather than polling. This requires an updated kernel.
author andrewm
date Thu, 28 May 2015 14:35:55 -0400
parents 8a575ba3ab52
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@0 11
andrewm@0 12 class StatusLED
andrewm@0 13 {
andrewm@0 14 public:
andrewm@0 15 StatusLED();
andrewm@0 16 ~StatusLED();
andrewm@0 17
andrewm@0 18 bool init(int gpio_pin);
andrewm@0 19
andrewm@0 20 void on();
andrewm@0 21 void off();
andrewm@0 22 void blink(int ms_on, int ms_off);
andrewm@0 23
andrewm@0 24 static void *static_blink_loop(void *data) {
andrewm@0 25 ((StatusLED*)data)->blink_loop(NULL);
andrewm@0 26 return 0;
andrewm@0 27 }
andrewm@0 28
andrewm@0 29 void* blink_loop(void *);
andrewm@0 30
andrewm@0 31 private:
andrewm@0 32 int gpio_number;
andrewm@0 33 int milliseconds_on, milliseconds_off;
andrewm@0 34 bool this_should_stop;
andrewm@0 35 pthread_t blink_thread;
andrewm@0 36 };
andrewm@0 37
andrewm@0 38 #endif // STATUSLED_H_