APM:Libraries
RCOutputRGBLed.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RGBLed.h"
4 
5 class RCOutputRGBLed: public RGBLed {
6 public:
7  RCOutputRGBLed(uint8_t red_channel, uint8_t green_channel,
8  uint8_t blue_channel, uint8_t led_off, uint8_t led_full,
9  uint8_t led_medium, uint8_t led_dim);
10  RCOutputRGBLed(uint8_t red_channel, uint8_t green_channel,
11  uint8_t blue_channel);
12 
13 protected:
14  bool hw_init() override;
15  virtual bool hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue) override;
16  virtual uint16_t get_duty_cycle_for_color(const uint8_t color, const uint16_t usec_period) const;
17 
18 private:
19  uint8_t _red_channel;
20  uint8_t _green_channel;
21  uint8_t _blue_channel;
22 };
23 
25 public:
26  RCOutputRGBLedInverted(uint8_t red_channel, uint8_t green_channel, uint8_t blue_channel)
27  : RCOutputRGBLed(red_channel, green_channel, blue_channel)
28  { }
29 protected:
30  virtual uint16_t get_duty_cycle_for_color(const uint8_t color, const uint16_t usec_period) const override;
31 };
32 
34 public:
35  RCOutputRGBLedOff(uint8_t red_channel, uint8_t green_channel,
36  uint8_t blue_channel, uint8_t led_off)
37  : RCOutputRGBLed(red_channel, green_channel, blue_channel,
38  led_off, led_off, led_off, led_off)
39  { }
40 
41  /* Override the hw_set_rgb method to turn leds off regardless of the
42  * values passed */
43  bool hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue) override
44  {
46  }
47 };
uint8_t _red_channel
Definition: RGBLed.h:25
uint8_t _green_channel
bool hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue) override
uint8_t _led_off
Definition: RGBLed.h:61
virtual uint16_t get_duty_cycle_for_color(const uint8_t color, const uint16_t usec_period) const
RCOutputRGBLedOff(uint8_t red_channel, uint8_t green_channel, uint8_t blue_channel, uint8_t led_off)
RCOutputRGBLedInverted(uint8_t red_channel, uint8_t green_channel, uint8_t blue_channel)
uint8_t _blue_channel
bool hw_init() override
virtual bool hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue) override
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)