3x LEDs configured as an RGB for ease of use.
#include <rgb_led.h>
Public Member Functions | |
RgbLed () | |
~RgbLed () | |
void | Init (dsy_gpio_pin red, dsy_gpio_pin green, dsy_gpio_pin blue, bool invert) |
void | Set (float r, float g, float b) |
void | SetRed (float val) |
void | SetGreen (float val) |
void | SetBlue (float val) |
void | SetColor (Color c) |
void | Update () |
|
inline |
|
inline |
void daisy::RgbLed::Init | ( | dsy_gpio_pin | red, |
dsy_gpio_pin | green, | ||
dsy_gpio_pin | blue, | ||
bool | invert | ||
) |
Initializes 3x GPIO Pins as red, green, and blue elements of an RGB LED
red | Red element |
green | Green element |
blue | Blue element |
invert | Flips led polarity |
Sets each element of the LED with a floating point number 0-1
r | Red element |
g | Green element |
b | Blue element |
Sets the blue channel of the LED with a floating point number 0-1
val | brightness of the blue channel |
Sets the green channel of the LED with a floating point number 0-1
val | brightness of the green channel |
Sets the red channel of the LED with a floating point number 0-1
val | brightness of the red channel |
void daisy::RgbLed::Update | ( | ) |
Updates the PWM of the LED based on the current values. Should be called at a regular interval. (i.e. 1kHz/1ms)