Skip to content

Commit

Permalink
RgbLed: added individual setters for each color channel. (#385)
Browse files Browse the repository at this point in the history
Co-authored-by: stephenhensley <stephen.p.hensley@gmail.com>
  • Loading branch information
stephenhensley and stephenhensley authored Jul 21, 2021
1 parent f62f85e commit 6f78393
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 15 additions & 0 deletions src/hid/rgb_led.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
15 changes: 15 additions & 0 deletions src/hid/rgb_led.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 6f78393

Please sign in to comment.