view projects/d-box/StatusLED.h @ 151:e9c9404e3d1f ClockSync

Pff partially working. No PID. When setting the audio clock on the bbb to 44098 the master and slave clock keep diverging instead of converging ...
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 22 Sep 2015 04:10:07 +0100
parents 8a575ba3ab52
children
line wrap: on
line source
/*
 * StatusLED.h
 *
 *
 */

#ifndef STATUSLED_H_
#define STATUSLED_H_

#include <pthread.h>

class StatusLED
{
public:
	StatusLED();
	~StatusLED();

	bool init(int gpio_pin);

	void on();
	void off();
	void blink(int ms_on, int ms_off);

	static void *static_blink_loop(void *data) {
		((StatusLED*)data)->blink_loop(NULL);
		return 0;
	}

	void* blink_loop(void *);

private:
	int gpio_number;
	int milliseconds_on, milliseconds_off;
	bool this_should_stop;
	pthread_t blink_thread;
};

#endif // STATUSLED_H_