2013-08-13 23:51:22 -03:00
|
|
|
/*
|
2013-08-29 00:13:09 -03:00
|
|
|
ToshibaLED PX4 driver
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2013-08-13 23:51:22 -03:00
|
|
|
*/
|
|
|
|
#ifndef __TOSHIBA_LED_PX4_H__
|
|
|
|
#define __TOSHIBA_LED_PX4_H__
|
|
|
|
|
2013-08-29 00:13:09 -03:00
|
|
|
#include "ToshibaLED.h"
|
2014-01-23 19:40:39 -04:00
|
|
|
#include "AP_Math.h"
|
|
|
|
#include "vectorN.h"
|
2013-08-14 00:21:44 -03:00
|
|
|
|
2013-08-29 00:13:09 -03:00
|
|
|
class ToshibaLED_PX4 : public ToshibaLED
|
|
|
|
{
|
2013-08-13 23:51:22 -03:00
|
|
|
public:
|
2013-08-29 00:13:09 -03:00
|
|
|
bool hw_init(void);
|
|
|
|
bool hw_set_rgb(uint8_t r, uint8_t g, uint8_t b);
|
2013-08-13 23:51:22 -03:00
|
|
|
private:
|
2013-08-29 00:13:09 -03:00
|
|
|
int _rgbled_fd;
|
2014-01-23 19:40:39 -04:00
|
|
|
void update_timer(void);
|
2014-08-20 18:31:53 -03:00
|
|
|
|
|
|
|
// use a union so that updates can be of a single 32 bit value,
|
|
|
|
// making it atomic on PX4
|
|
|
|
union rgb_value {
|
|
|
|
struct {
|
|
|
|
uint8_t r;
|
|
|
|
uint8_t g;
|
|
|
|
uint8_t b;
|
|
|
|
};
|
|
|
|
volatile uint32_t v;
|
|
|
|
};
|
2014-01-23 19:40:39 -04:00
|
|
|
|
2014-08-20 18:31:53 -03:00
|
|
|
union rgb_value last, next;
|
2013-08-13 23:51:22 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __TOSHIBA_LED_PX4_H__
|