From b12e07539b801649f206a7a35b33e8988b0f4b75 Mon Sep 17 00:00:00 2001 From: hhau Date: Wed, 6 Dec 2023 00:06:10 +0100 Subject: [PATCH] chg: dev: add wrapper for setLED that takes three color arguments --- src/multiColorLight/MultiColorLight.cpp | 8 ++++++++ src/multiColorLight/MultiColorLight.h | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/multiColorLight/MultiColorLight.cpp b/src/multiColorLight/MultiColorLight.cpp index 985b35a..f8d3a4d 100644 --- a/src/multiColorLight/MultiColorLight.cpp +++ b/src/multiColorLight/MultiColorLight.cpp @@ -42,11 +42,19 @@ void MultiColorLight::setLed(leds leds, uint32_t color){ }; +void MultiColorLight::setLed(leds leds, uint8_t red, uint8_t green, uint8_t blue){ + MultiColorLight::setLed(leds, MultiColorLight::color(red,green,blue)); +}; + void MultiColorLight::setTopLeds(uint32_t color){ MultiColorLight::setLed(TOP,color); }; +void MultiColorLight::setTopLeds(uint8_t red, uint8_t green, uint8_t blue){ + MultiColorLight::setTopLeds(MultiColorLight::color(red,green,blue)); +}; + void MultiColorLight::blink(uint16_t amount,uint32_t color, leds leds, uint32_t interval){ for(uint16_t index = 0; index < amount;index++){ MultiColorLight::setLed(leds, color); diff --git a/src/multiColorLight/MultiColorLight.h b/src/multiColorLight/MultiColorLight.h index 52ee75d..ce9ba5c 100644 --- a/src/multiColorLight/MultiColorLight.h +++ b/src/multiColorLight/MultiColorLight.h @@ -59,6 +59,16 @@ public: */ void setLed(leds leds, uint32_t color); + /** + * @brief Set the specified leds to the passed color value + * + * @param leds which leds should be updated + * @param red brightness of red, is normalized in the function + * @param green brightness of green, is normalized in the function + * @param blue brightness of blue, is normalized in the function + */ + void setLed(leds leds, uint8_t red, uint8_t green, uint8_t blue); + /** * @brief sets the two leds on the top of the robot to the specified color * @@ -68,6 +78,15 @@ public: */ void setTopLeds(uint32_t color); + /** + * @brief sets the two leds on the top of the robot to the specified color + * + * @param red brightness of red, is normalized in the function + * @param green brightness of green, is normalized in the function + * @param blue brightness of blue, is normalized in the function + */ + void setTopLeds(uint8_t red, uint8_t green, uint8_t blue); + /** * @brief Let LEDs blink, returns after all blinks were executed *