annotate examples/10-Instruments/d-box/StatusLED.h @ 556:ce391098f321 prerelease tip

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