chg: dev: first version of multiColorLight implemeted

This commit is contained in:
hhau
2023-11-26 11:28:17 +01:00
parent e72595e739
commit 1b330e1520
5 changed files with 115 additions and 87 deletions

View File

@ -26,8 +26,14 @@ enum leds{
};
class MultiColorLight{
protected:
static const uint16_t ledAmount = 3;
static const int16_t ledPin = 48;
static const uint8_t maxBrightness = 100;
Adafruit_NeoPixel rgbLeds;
public:
MultiColorLight();
/**
* @brief initialize the multicolor component
*
@ -94,7 +100,21 @@ public:
* component, and BB is the blue component.
*/
uint32_t color(uint8_t r, uint8_t g, uint8_t b);
private:
/**
* @brief normalizes every component of color to not exeed the maxBrightness
*
* @param color A 32-bit unsigned integer representing the color in the format
* 0x00RRGGBB, where RR is the red component, GG is the green
* component, and BB is the blue component.
* @param maxBrigthness maximal level of brightness that is allowed for each color
* @return uint32_t A 32-bit unsigned integer representing the color in the format
* 0x00RRGGBB, where RR is the red component, GG is the green
* component, and BB is the blue component. Where each component can be
* between 0 - maxBrightness
*/
uint32_t normalizeColor(uint32_t color, uint8_t maxBrigthness=maxBrightness);
};
#endif //MultiColorLight_h