diff --git a/CHANGELOG.md b/CHANGELOG.md index 33d9b3a5e..4f0987bcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * string: allow more integer types in `FixedCapStr::AppendInt()` * fifo/stack: Add new methods for searching elements * fifo/stack: Reduce binary size +* RgbLed: Added individual setters for each color ### Bug fixes diff --git a/src/hid/rgb_led.cpp b/src/hid/rgb_led.cpp index 83f771b7d..3226268af 100644 --- a/src/hid/rgb_led.cpp +++ b/src/hid/rgb_led.cpp @@ -17,6 +17,21 @@ void RgbLed::Set(float r, float g, float b) b_.Set(b); } +void RgbLed::SetRed(float val) +{ + r_.Set(val); +} + +void RgbLed::SetGreen(float val) +{ + g_.Set(val); +} + +void RgbLed::SetBlue(float val) +{ + b_.Set(val); +} + void RgbLed::SetColor(Color c) { r_.Set(c.Red()); diff --git a/src/hid/rgb_led.h b/src/hid/rgb_led.h index c24a75e06..382df448f 100644 --- a/src/hid/rgb_led.h +++ b/src/hid/rgb_led.h @@ -33,6 +33,21 @@ class RgbLed */ void Set(float r, float g, float b); + /** Sets the red channel of the LED with a floating point number 0-1 + \param val brightness of the red channel + */ + void SetRed(float val); + + /** Sets the green channel of the LED with a floating point number 0-1 + \param val brightness of the green channel + */ + void SetGreen(float val); + + /** Sets the blue channel of the LED with a floating point number 0-1 + \param val brightness of the blue channel + */ + void SetBlue(float val); + /** Sets the RGB using a Color object. \param c Color object to set. */