andrewm@0: /*
andrewm@0:  * StatusLED.h
andrewm@0:  *
andrewm@0:  *
andrewm@0:  */
andrewm@0: 
andrewm@0: #ifndef STATUSLED_H_
andrewm@0: #define STATUSLED_H_
andrewm@0: 
andrewm@0: #include <pthread.h>
andrewm@303: #include <unistd.h>
andrewm@0: 
andrewm@0: class StatusLED
andrewm@0: {
andrewm@0: public:
andrewm@0: 	StatusLED();
andrewm@0: 	~StatusLED();
andrewm@0: 
andrewm@0: 	bool init(int gpio_pin);
andrewm@0: 
andrewm@0: 	void on();
andrewm@0: 	void off();
andrewm@0: 	void blink(int ms_on, int ms_off);
andrewm@0: 
andrewm@0: 	static void *static_blink_loop(void *data) {
andrewm@0: 		((StatusLED*)data)->blink_loop(NULL);
andrewm@0: 		return 0;
andrewm@0: 	}
andrewm@0: 
andrewm@0: 	void* blink_loop(void *);
andrewm@0: 
andrewm@0: private:
andrewm@0: 	int gpio_number;
andrewm@0: 	int milliseconds_on, milliseconds_off;
andrewm@0: 	bool this_should_stop;
andrewm@0: 	pthread_t blink_thread;
andrewm@0: };
andrewm@0: 
andrewm@0: #endif // STATUSLED_H_