Skip to content

Commit 0c6cac0

Browse files
committed
Use LEDColor to avoid name clash with IoT Cloud lib
1 parent ed084d3 commit 0c6cac0

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

examples/RGBLED/RGBLED.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ void pulseColors(RGBLED &led) {
2424
led.setColor({255, 0, 0}); // Red
2525
pulseLED(led);
2626

27-
// Color can be set via Color struct or 3 separate uint8_t values
27+
// Color can be set via LEDColor struct or 3 separate uint8_t values
2828
led.setColor(0, 255, 0); // Green
2929
pulseLED(led);
3030

31-
Color blueColor = {0, 0, 255};
31+
LEDColor blueColor = {0, 0, 255};
3232
led.setColor(blueColor); // Blue
3333
pulseLED(led);
3434

src/RGBLED.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ bool RGBLED::setColor(uint8_t r, uint8_t g, uint8_t b, bool persist) {
2323
return true;
2424
}
2525

26-
bool RGBLED::setColor(Color color, bool persist) {
26+
bool RGBLED::setColor(LEDColor color, bool persist) {
2727
return setColor(color.red, color.green, color.blue, persist);
2828
}
2929

30-
Color RGBLED::color() {
30+
LEDColor RGBLED::color() {
3131
uint8_t red = readFromRegister<uint8_t>(RGB_LED_RED_REGISTER_INFO);
3232
uint8_t green = readFromRegister<uint8_t>(RGB_LED_GREEN_REGISTER_INFO);
3333
uint8_t blue = readFromRegister<uint8_t>(RGB_LED_BLUE_REGISTER_INFO);

src/RGBLED.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* @brief Represents a color with red, green, and blue components.
55
*/
6-
struct Color {
6+
struct LEDColor {
77
uint8_t red; /**< The red component of the color. */
88
uint8_t green; /**< The green component of the color. */
99
uint8_t blue; /**< The blue component of the color. */
@@ -57,21 +57,21 @@ class RGBLED : public I2CDevice {
5757
bool setColor(uint8_t r, uint8_t g, uint8_t b, bool persist = false);
5858

5959
/**
60-
* @brief Sets the RGB color of the LED using a Color object.
61-
* The Color object contains the red, green, and blue values that can be changed individually.
60+
* @brief Sets the RGB color of the LED using a LEDColor object.
61+
* The LEDColor object contains the red, green, and blue values that can be changed individually.
6262
* Note: A value of 0, 0, 0 will set the color based on the IAQ value from the Indoor Air Quality sensor.
6363
* @param color The RGB color to set.
6464
* @param persist If true, the change will be saved to flash memory.
6565
* @return True if the color was set successfully, false otherwise.
6666
*/
67-
bool setColor(Color color, bool persist = false);
67+
bool setColor(LEDColor color, bool persist = false);
6868

6969
/**
7070
* @brief Gets the current RGB color of the LED.
7171
*
72-
* @return The current RGB color as a Color object.
72+
* @return The current RGB color as a LEDColor object.
7373
*/
74-
Color color();
74+
LEDColor color();
7575

7676
/**
7777
* @brief Get the brightness of the RGB LED (0-255)

0 commit comments

Comments
 (0)