2015-10-28 17:54:32 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "RGBLed.h"
|
|
|
|
|
|
|
|
class RCOutputRGBLed: public RGBLed {
|
|
|
|
public:
|
|
|
|
RCOutputRGBLed(uint8_t red_channel, uint8_t green_channel,
|
|
|
|
uint8_t blue_channel, uint8_t led_off, uint8_t led_full,
|
|
|
|
uint8_t led_medium, uint8_t led_dim);
|
|
|
|
RCOutputRGBLed(uint8_t red_channel, uint8_t green_channel,
|
|
|
|
uint8_t blue_channel);
|
2021-03-28 22:44:23 -03:00
|
|
|
bool init() override;
|
2017-01-26 05:10:26 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue) override;
|
2017-10-19 06:10:42 -03:00
|
|
|
virtual uint16_t get_duty_cycle_for_color(const uint8_t color, const uint16_t usec_period) const;
|
2015-10-28 17:54:32 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t _red_channel;
|
|
|
|
uint8_t _green_channel;
|
|
|
|
uint8_t _blue_channel;
|
|
|
|
};
|
2016-01-05 16:36:38 -04:00
|
|
|
|
2017-10-19 06:10:42 -03:00
|
|
|
class RCOutputRGBLedInverted : public RCOutputRGBLed {
|
|
|
|
public:
|
|
|
|
RCOutputRGBLedInverted(uint8_t red_channel, uint8_t green_channel, uint8_t blue_channel)
|
|
|
|
: RCOutputRGBLed(red_channel, green_channel, blue_channel)
|
|
|
|
{ }
|
|
|
|
protected:
|
|
|
|
virtual uint16_t get_duty_cycle_for_color(const uint8_t color, const uint16_t usec_period) const override;
|
|
|
|
};
|
|
|
|
|
2016-01-05 16:36:38 -04:00
|
|
|
class RCOutputRGBLedOff : public RCOutputRGBLed {
|
|
|
|
public:
|
|
|
|
RCOutputRGBLedOff(uint8_t red_channel, uint8_t green_channel,
|
|
|
|
uint8_t blue_channel, uint8_t led_off)
|
|
|
|
: RCOutputRGBLed(red_channel, green_channel, blue_channel,
|
|
|
|
led_off, led_off, led_off, led_off)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
/* Override the hw_set_rgb method to turn leds off regardless of the
|
|
|
|
* values passed */
|
|
|
|
bool hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue) override
|
|
|
|
{
|
|
|
|
return RCOutputRGBLed::hw_set_rgb(_led_off, _led_off, _led_off);
|
|
|
|
}
|
|
|
|
};
|