diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bb1f5a30b7..8ab001c2d09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ endif() set(CORE_SRCS cores/esp32/base64.cpp cores/esp32/cbuf.cpp + cores/esp32/ColorFormat.c cores/esp32/chip-debug-report.cpp cores/esp32/esp32-hal-adc.c cores/esp32/esp32-hal-bt.c @@ -171,7 +172,6 @@ set(ARDUINO_LIBRARY_Matter_SRCS libraries/Matter/src/MatterEndpoints/MatterDimmableLight.cpp libraries/Matter/src/MatterEndpoints/MatterColorTemperatureLight.cpp libraries/Matter/src/MatterEndpoints/MatterColorLight.cpp - libraries/Matter/src/MatterUtil/ColorFormat.cpp libraries/Matter/src/Matter.cpp) set(ARDUINO_LIBRARY_PPP_SRCS diff --git a/libraries/Matter/src/MatterUtil/ColorFormat.cpp b/cores/esp32/ColorFormat.c similarity index 74% rename from libraries/Matter/src/MatterUtil/ColorFormat.cpp rename to cores/esp32/ColorFormat.c index f18fd1319f5..a58d796666e 100644 --- a/libraries/Matter/src/MatterUtil/ColorFormat.cpp +++ b/cores/esp32/ColorFormat.c @@ -23,8 +23,38 @@ // define a clamp macro to substitute the std::clamp macro which is available from C++17 onwards #define clamp(a, min, max) ((a) < (min) ? (min) : ((a) > (max) ? (max) : (a))) -RgbColor_t HsvToRgb(HsvColor_t hsv) { - RgbColor_t rgb; +const espHsvColor_t HSV_BLACK = {0, 0, 0}; +const espHsvColor_t HSV_WHITE = {0, 0, 254}; +const espHsvColor_t HSV_RED = {0, 254, 254}; +const espHsvColor_t HSV_YELLOW = {42, 254, 254}; +const espHsvColor_t HSV_GREEN = {84, 254, 254}; +const espHsvColor_t HSV_CYAN = {127, 254, 254}; +const espHsvColor_t HSV_BLUE = {169, 254, 254}; +const espHsvColor_t HSV_MAGENTA = {211, 254, 254}; + +const espRgbColor_t RGB_BLACK = {0, 0, 0}; +const espRgbColor_t RGB_WHITE = {255, 255, 255}; +const espRgbColor_t RGB_RED = {255, 0, 0}; +const espRgbColor_t RGB_YELLOW = {255, 255, 0}; +const espRgbColor_t RGB_GREEN = {0, 255, 0}; +const espRgbColor_t RGB_CYAN = {0, 255, 255}; +const espRgbColor_t RGB_BLUE = {0, 0, 255}; +const espRgbColor_t RGB_MAGENTA = {255, 0, 255}; + +// main color temperature values +const espCtColor_t COOL_WHITE_COLOR_TEMPERATURE = { 142 }; +const espCtColor_t DAYLIGHT_WHITE_COLOR_TEMPERATURE = { 181 }; +const espCtColor_t WHITE_COLOR_TEMPERATURE = { 250 }; +const espCtColor_t SOFT_WHITE_COLOR_TEMPERATURE = { 370 }; +const espCtColor_t WARM_WHITE_COLOR_TEMPERATURE = { 454 }; + +espRgbColor_t espHsvToRgbColor(uint16_t h, uint8_t s, uint8_t v) { + espHsvColor_t hsv = {h, s, v}; + return espHsvColorToRgbColor(hsv); +} + +espRgbColor_t espHsvColorToRgbColor(espHsvColor_t hsv) { + espRgbColor_t rgb; uint8_t region, p, q, t; uint32_t h, s, v, remainder; @@ -66,8 +96,13 @@ RgbColor_t HsvToRgb(HsvColor_t hsv) { return rgb; } -HsvColor_t RgbToHsv(RgbColor_t rgb) { - HsvColor_t hsv; +espHsvColor_t espRgbToHsvColor(uint8_t r, uint8_t g, uint8_t b) { + espRgbColor_t rgb = {r, g, b}; + return espRgbColorToHsvColor(rgb); +} + +espHsvColor_t espRgbColorToHsvColor(espRgbColor_t rgb) { + espHsvColor_t hsv; uint8_t rgbMin, rgbMax; rgbMin = rgb.r < rgb.g ? (rgb.r < rgb.b ? rgb.r : rgb.b) : (rgb.g < rgb.b ? rgb.g : rgb.b); @@ -95,7 +130,11 @@ HsvColor_t RgbToHsv(RgbColor_t rgb) { return hsv; } -RgbColor_t XYToRgb(uint8_t Level, uint16_t current_X, uint16_t current_Y) { +espRgbColor_t espXYColorToRgbColor(uint8_t Level, espXyColor_t xy) { + return espXYToRgbColor(Level, xy.x, xy.y); +} + +espRgbColor_t espXYToRgbColor(uint8_t Level, uint16_t current_X, uint16_t current_Y) { // convert xyY color space to RGB // https://www.easyrgb.com/en/math.php @@ -108,7 +147,7 @@ RgbColor_t XYToRgb(uint8_t Level, uint16_t current_X, uint16_t current_Y) { // y = current_Y/65536 // z = 1-x-y - RgbColor_t rgb; + espRgbColor_t rgb; float x, y, z; float X, Y, Z; @@ -155,14 +194,19 @@ RgbColor_t XYToRgb(uint8_t Level, uint16_t current_X, uint16_t current_Y) { return rgb; } -XyColor_t RgbToXY(RgbColor_t rgb) { +espXyColor_t espRgbToXYColor(uint8_t r, uint8_t g, uint8_t b){ + espRgbColor_t rgb = {r, g, b}; + return espRgbColorToXYColor(rgb); +} + +espXyColor_t espRgbColorToXYColor(espRgbColor_t rgb) { // convert RGB to xy color space // https://www.easyrgb.com/en/math.php // https://en.wikipedia.org/wiki/SRGB // refer https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space - XyColor_t xy; + espXyColor_t xy; float r, g, b; float X, Y, Z; @@ -198,9 +242,13 @@ XyColor_t RgbToXY(RgbColor_t rgb) { return xy; } +espRgbColor_t espCTToRgbColor(uint16_t ct){ + espCtColor_t ctColor = {ct}; + return espCTColorToRgbColor(ctColor); +} -RgbColor_t CTToRgb(CtColor_t ct) { - RgbColor_t rgb = {0, 0, 0}; +espRgbColor_t espCTColorToRgbColor(espCtColor_t ct) { + espRgbColor_t rgb = {0, 0, 0}; float r, g, b; if (ct.ctMireds == 0) { diff --git a/cores/esp32/ColorFormat.h b/cores/esp32/ColorFormat.h new file mode 100644 index 00000000000..272c5130a66 --- /dev/null +++ b/cores/esp32/ColorFormat.h @@ -0,0 +1,69 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#ifdef __cplusplus +extern "C" { +#endif + +struct RgbColor_t { + uint8_t r; + uint8_t g; + uint8_t b; +}; + +struct HsvColor_t { + uint16_t h; + uint8_t s; + uint8_t v; +}; + +struct XyColor_t { + uint16_t x; + uint16_t y; +}; + +struct CtColor_t { + uint16_t ctMireds; +}; + +typedef struct RgbColor_t espRgbColor_t; +typedef struct HsvColor_t espHsvColor_t; +typedef struct XyColor_t espXyColor_t; +typedef struct CtColor_t espCtColor_t; + +espRgbColor_t espXYToRgbColor(uint8_t Level, uint16_t current_X, uint16_t current_Y); +espRgbColor_t espXYColorToRgb(uint8_t Level, espXyColor_t xy); +espXyColor_t espRgbColorToXYColor(espRgbColor_t rgb); +espXyColor_t espRgbToXYColor(uint8_t r, uint8_t g, uint8_t b); +espRgbColor_t espHsvColorToRgbColor(espHsvColor_t hsv); +espRgbColor_t espHsvToRgbColor(uint16_t h, uint8_t s, uint8_t v); +espRgbColor_t espCTColorToRgbColor(espCtColor_t ct); +espRgbColor_t espCTToRgbColor(uint16_t ct); +espHsvColor_t espRgbColorToHsvColor(espRgbColor_t rgb); +espHsvColor_t espRgbToHsvColor(uint8_t r, uint8_t g, uint8_t b); + +extern const espHsvColor_t HSV_BLACK, HSV_WHITE, HSV_RED, HSV_YELLOW, HSV_GREEN, HSV_CYAN, HSV_BLUE, HSV_MAGENTA; +extern const espCtColor_t COOL_WHITE_COLOR_TEMPERATURE, DAYLIGHT_WHITE_COLOR_TEMPERATURE, WHITE_COLOR_TEMPERATURE, SOFT_WHITE_COLOR_TEMPERATURE, WARM_WHITE_COLOR_TEMPERATURE; +extern const espRgbColor_t RGB_BLACK, RGB_WHITE, RGB_RED, RGB_YELLOW, RGB_GREEN, RGB_CYAN, RGB_BLUE, RGB_MAGENTA; + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/libraries/ESP32/keywords.txt b/libraries/ESP32/keywords.txt index 7e36360c840..64814f37dd8 100644 --- a/libraries/ESP32/keywords.txt +++ b/libraries/ESP32/keywords.txt @@ -6,14 +6,51 @@ # Datatypes (KEYWORD1) ####################################### -Serial4 KEYWORD1 +Serial4 KEYWORD1 +espCtColor_t KEYWORD1 +espXyColor_t KEYWORD1 +espHsvColor_t KEYWORD1 +espRgbColor_t KEYWORD1 ####################################### # Methods and Functions (KEYWORD2) ####################################### +espXYToRgbColor KEYWORD2 +espXYColorToRgb KEYWORD2 +espRgbColorToXYColor KEYWORD2 +espRgbToXYColor KEYWORD2 +espHsvColorToRgbColor KEYWORD2 +espHsvToRgbColor KEYWORD2 +espCTColorToRgbColor KEYWORD2 +espCTToRgbColor KEYWORD2 +espRgbColorToHsvColor KEYWORD2 +espRgbToHsvColor KEYWORD2 + ####################################### # Constants (LITERAL1) ####################################### RGB_BUILTIN LITERAL1 +HSV_BLACK LITERAL1 +HSV_WHITE LITERAL1 +HSV_RED LITERAL1 +HSV_YELLOW LITERAL1 +HSV_GREEN LITERAL1 +HSV_CYAN LITERAL1 +HSV_BLUE LITERAL1 +HSV_MAGENTA LITERAL1 +COOL_WHITE_COLOR_TEMPERATURE LITERAL1 +DAYLIGHT_WHITE_COLOR_TEMPERATURE LITERAL1 +WHITE_COLOR_TEMPERATURE LITERAL1 +SOFT_WHITE_COLOR_TEMPERATURE LITERAL1 +WARM_WHITE_COLOR_TEMPERATURE LITERAL1 +RGB_BLACK LITERAL1 +RGB_WHITE LITERAL1 +RGB_RED LITERAL1 +RGB_YELLOW LITERAL1 +RGB_GREEN LITERAL1 +RGB_CYAN LITERAL1 +RGB_BLUE LITERAL1 +RGB_MAGENTA LITERAL1 + diff --git a/libraries/Matter/examples/Matter_CW_WW_Light/Matter_CW_WW_Light.ino b/libraries/Matter/examples/Matter_CW_WW_Light/Matter_CW_WW_Light.ino index 39392d90225..0ff30f53ec0 100644 --- a/libraries/Matter/examples/Matter_CW_WW_Light/Matter_CW_WW_Light.ino +++ b/libraries/Matter/examples/Matter_CW_WW_Light/Matter_CW_WW_Light.ino @@ -47,8 +47,7 @@ bool setLightState(bool state, uint8_t brightness, uint16_t temperature_Mireds) if (state) { #ifdef RGB_BUILTIN - CtColor_t ct = {temperature_Mireds}; - RgbColor_t rgb_ct = CTToRgb(ct); + espRgbColor_t rgb_ct = espCTToRgbColor(temperature_Mireds); // simple intensity correction float brightnessPercent = (float)brightness / MatterColorTemperatureLight::MAX_BRIGHTNESS; rgb_ct.r = brightnessPercent * rgb_ct.r; @@ -106,7 +105,7 @@ void setup() { // default brightness ~= 6% (15/255) uint8_t lastBrightness = matterPref.getUChar(brightnessPrefKey, 15); // default temperature ~= 454 Mireds (Warm White) - uint16_t lastTemperature = matterPref.getUShort(temperaturePrefKey, MatterColorTemperatureLight::WARM_WHITE_COLOR_TEMPERATURE); + uint16_t lastTemperature = matterPref.getUShort(temperaturePrefKey, WARM_WHITE_COLOR_TEMPERATURE.ctMireds); CW_WW_Light.begin(lastOnOffState, lastBrightness, lastTemperature); // set the callback function to handle the Light state change CW_WW_Light.onChange(setLightState); diff --git a/libraries/Matter/examples/Matter_ColorLight/Matter_ColorLight.ino b/libraries/Matter/examples/Matter_ColorLight/Matter_ColorLight.ino index 4b7b94097b3..86dec3d7e62 100644 --- a/libraries/Matter/examples/Matter_ColorLight/Matter_ColorLight.ino +++ b/libraries/Matter/examples/Matter_ColorLight/Matter_ColorLight.ino @@ -42,11 +42,11 @@ const char *ssid = "your-ssid"; // Change this to your WiFi SSID const char *password = "your-password"; // Change this to your WiFi password // Set the RGB LED Light based on the current state of the Color Light -bool setLightState(bool state, HsvColor_t colorHSV) { +bool setLightState(bool state, espHsvColor_t colorHSV) { if (state) { #ifdef RGB_BUILTIN - RgbColor_t rgbColor = HsvToRgb(colorHSV); + espRgbColor_t rgbColor = espHsvColorToRgbColor(colorHSV); // set the RGB LED rgbLedWrite(ledPin, rgbColor.r, rgbColor.g, rgbColor.b); #else @@ -97,7 +97,7 @@ void setup() { bool lastOnOffState = matterPref.getBool(onOffPrefKey, true); // default HSV color is blue HSV(169, 254, 254) uint32_t prefHsvColor = matterPref.getUInt(hsvColorPrefKey, 169 << 16 | 254 << 8 | 254); - HsvColor_t lastHsvColor = {uint8_t(prefHsvColor >> 16), uint8_t(prefHsvColor >> 8), uint8_t(prefHsvColor)}; + espHsvColor_t lastHsvColor = {uint8_t(prefHsvColor >> 16), uint8_t(prefHsvColor >> 8), uint8_t(prefHsvColor)}; ColorLight.begin(lastOnOffState, lastHsvColor); // set the callback function to handle the Light state change ColorLight.onChange(setLightState); diff --git a/libraries/Matter/keywords.txt b/libraries/Matter/keywords.txt index 589156232b6..39a74e76583 100644 --- a/libraries/Matter/keywords.txt +++ b/libraries/Matter/keywords.txt @@ -1,5 +1,5 @@ ####################################### -# Syntax Coloring Map For OpenThread +# Syntax Coloring Map For Matter ####################################### ####################################### @@ -10,13 +10,9 @@ Matter KEYWORD1 ArduinoMatter KEYWORD1 MatterOnOffLight KEYWORD1 MatterDimmableLight KEYWORD1 -MatterColorTemperatureLight KEYWORD1 +MatterColorTemperatureLight KEYWORD1 MatterColorLight KEYWORD1 MatterEndPoint KEYWORD1 -CtColor_t KEYWORD1 -XyColor_t KEYWORD1 -HsvColor_t KEYWORD1 -RgbColor_t KEYWORD1 ####################################### # Methods and Functions (KEYWORD2) @@ -47,31 +43,14 @@ updateAccessory KEYWORD2 onChange KEYWORD2 onChangeOnOff KEYWORD2 onChangeBrightness KEYWORD2 -onChangeColorTemperature KEYWORD2 +onChangeColorTemperature KEYWORD2 onChangeColorHSV KEYWORD2 -XYToRgb KEYWORD2 -HsvToRgb KEYWORD2 -CTToRgb KEYWORD2 -RgbToHsv KEYWORD2 + ####################################### # Constants (LITERAL1) ####################################### -MAX_BRIGHTNESS LITERAL1 -MAX_COLOR_TEMPERATURE LITERAL1 -MIN_COLOR_TEMPERATURE LITERAL1 -COOL_WHITE_COLOR_TEMPERATURE LITERAL1 -DAYLIGHT_WHITE_COLOR_TEMPERATURE LITERAL1 -WHITE_COLOR_TEMPERATURE LITERAL1 -SOFT_WHITE_COLOR_TEMPERATURE LITERAL1 -WARM_WHITE_COLOR_TEMPERATURE LITERAL1 -HSV_BLACK LITERAL1 -HSV_WHITE LITERAL1 -HSV_RED LITERAL1 -HSV_YELLOW LITERAL1 -HSV_GREEN LITERAL1 -HSV_CIAN LITERAL1 -HSV_BLUE LITERAL1 -HSV_MAGENTA LITERAL1 - +MAX_BRIGHTNESS LITERAL1 +MAX_COLOR_TEMPERATURE LITERAL1 +MIN_COLOR_TEMPERATURE LITERAL1 diff --git a/libraries/Matter/src/Matter.cpp b/libraries/Matter/src/Matter.cpp index 857438cce03..89ef87b4db3 100644 --- a/libraries/Matter/src/Matter.cpp +++ b/libraries/Matter/src/Matter.cpp @@ -17,7 +17,6 @@ #include #include -#include "MatterEndPoint.h" using namespace esp_matter; using namespace esp_matter::attribute; diff --git a/libraries/Matter/src/Matter.h b/libraries/Matter/src/Matter.h index d1c2b8e7f54..4d269474187 100644 --- a/libraries/Matter/src/Matter.h +++ b/libraries/Matter/src/Matter.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include diff --git a/libraries/Matter/src/MatterEndpoints/MatterColorLight.cpp b/libraries/Matter/src/MatterEndpoints/MatterColorLight.cpp index 9fe1143422e..9f66e143652 100644 --- a/libraries/Matter/src/MatterEndpoints/MatterColorLight.cpp +++ b/libraries/Matter/src/MatterEndpoints/MatterColorLight.cpp @@ -128,7 +128,7 @@ bool MatterColorLight::attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_ log_i("Color Control Attribute ID [%x] not processed.", attribute_id); break; } - HsvColor_t hsvColor = {colorHSV.h, colorHSV.s, colorHSV.v}; + espHsvColor_t hsvColor = {colorHSV.h, colorHSV.s, colorHSV.v}; if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { log_d("RGB Light Hue changed to %d", val->val.u8); hsvColor.h = val->val.u8; @@ -158,7 +158,7 @@ MatterColorLight::~MatterColorLight() { end(); } -bool MatterColorLight::begin(bool initialState, HsvColor_t _colorHSV) { +bool MatterColorLight::begin(bool initialState, espHsvColor_t _colorHSV) { ArduinoMatter::_init(); rgb_color_light::config_t light_config; @@ -239,15 +239,15 @@ bool MatterColorLight::toggle() { return setOnOff(!onOffState); } -bool MatterColorLight::setColorRGB(RgbColor_t _rgbColor) { - return setColorHSV(RgbToHsv(_rgbColor)); +bool MatterColorLight::setColorRGB(espRgbColor_t _rgbColor) { + return setColorHSV(espRgbColorToHsvColor(_rgbColor)); } -RgbColor_t MatterColorLight::getColorRGB() { - return HsvToRgb(colorHSV); +espRgbColor_t MatterColorLight::getColorRGB() { + return espHsvColorToRgbColor(colorHSV); } -bool MatterColorLight::setColorHSV(HsvColor_t _hsvColor) { +bool MatterColorLight::setColorHSV(espHsvColor_t _hsvColor) { if (!started) { log_w("Matter RGB Color Light device has not begun."); @@ -291,7 +291,7 @@ bool MatterColorLight::setColorHSV(HsvColor_t _hsvColor) { return true; } -HsvColor_t MatterColorLight::getColorHSV() { +espHsvColor_t MatterColorLight::getColorHSV() { return colorHSV; } diff --git a/libraries/Matter/src/MatterEndpoints/MatterColorLight.h b/libraries/Matter/src/MatterEndpoints/MatterColorLight.h index 838f78cbd3c..923c8012702 100644 --- a/libraries/Matter/src/MatterEndpoints/MatterColorLight.h +++ b/libraries/Matter/src/MatterEndpoints/MatterColorLight.h @@ -18,24 +18,13 @@ #include #include -#include class MatterColorLight : public MatterEndPoint { public: - const HsvColor_t HSV_BLACK = {0, 0, 0}; - const HsvColor_t HSV_WHITE = {0, 0, 254}; - const HsvColor_t HSV_RED = {0, 254, 254}; - const HsvColor_t HSV_YELLOW = {42, 254, 254}; - const HsvColor_t HSV_GREEN = {84, 254, 254}; - const HsvColor_t HSV_CIAN = {127, 254, 254}; - const HsvColor_t HSV_BLUE = {169, 254, 254}; - const HsvColor_t HSV_MAGENTA = {211, 254, 254}; - - MatterColorLight(); ~MatterColorLight(); // default initial state is off, color is red 12% intensity HSV(0, 254, 31) - virtual bool begin(bool initialState = false, HsvColor_t colorHSV = { 0, 254, 31}); + virtual bool begin(bool initialState = false, espHsvColor_t colorHSV = { 0, 254, 31}); // this will just stop processing Light Matter events void end(); @@ -43,10 +32,10 @@ class MatterColorLight : public MatterEndPoint { bool getOnOff(); // returns current light state bool toggle(); // returns true if successful - bool setColorRGB(RgbColor_t rgbColor); // returns true if successful - RgbColor_t getColorRGB(); // returns current RGB Color - bool setColorHSV(HsvColor_t hsvColor); // returns true if successful - HsvColor_t getColorHSV(); // returns current HSV Color + bool setColorRGB(espRgbColor_t rgbColor); // returns true if successful + espRgbColor_t getColorRGB(); // returns current RGB Color + bool setColorHSV(espHsvColor_t hsvColor); // returns true if successful + espHsvColor_t getColorHSV(); // returns current HSV Color // used to update the state of the light using the current Matter Light internal state @@ -65,13 +54,13 @@ class MatterColorLight : public MatterEndPoint { _onChangeOnOffCB = onChangeCB; } // User Callback for whenever the HSV Color value is changed by the Matter Controller - using EndPointRGBColorCB = std::function; + using EndPointRGBColorCB = std::function; void onChangeColorHSV(EndPointRGBColorCB onChangeCB) { _onChangeColorCB = onChangeCB; } // User Callback for whenever any parameter is changed by the Matter Controller - using EndPointCB = std::function; + using EndPointCB = std::function; void onChange(EndPointCB onChangeCB) { _onChangeCB = onChangeCB; } @@ -79,7 +68,7 @@ class MatterColorLight : public MatterEndPoint { protected: bool started = false; bool onOffState = false; // default initial state is off, but it can be changed by begin(bool) - HsvColor_t colorHSV = { 0 }; // default initial color HSV is black, but it can be changed by begin(bool, HsvColor_t) + espHsvColor_t colorHSV = { 0 }; // default initial color HSV is black, but it can be changed by begin(bool, espHsvColor_t) EndPointOnOffCB _onChangeOnOffCB = NULL; EndPointRGBColorCB _onChangeColorCB = NULL; EndPointCB _onChangeCB = NULL; diff --git a/libraries/Matter/src/MatterEndpoints/MatterColorTemperatureLight.h b/libraries/Matter/src/MatterEndpoints/MatterColorTemperatureLight.h index a37f362f475..723849e354a 100644 --- a/libraries/Matter/src/MatterEndpoints/MatterColorTemperatureLight.h +++ b/libraries/Matter/src/MatterEndpoints/MatterColorTemperatureLight.h @@ -24,12 +24,6 @@ class MatterColorTemperatureLight : public MatterEndPoint { static const uint8_t MAX_BRIGHTNESS = 255; static const uint16_t MAX_COLOR_TEMPERATURE = 500; static const uint16_t MIN_COLOR_TEMPERATURE = 100; - // main color temperature values - static const uint16_t COOL_WHITE_COLOR_TEMPERATURE = 142; - static const uint16_t DAYLIGHT_WHITE_COLOR_TEMPERATURE = 181; - static const uint16_t WHITE_COLOR_TEMPERATURE = 250; - static const uint16_t SOFT_WHITE_COLOR_TEMPERATURE = 370; - static const uint16_t WARM_WHITE_COLOR_TEMPERATURE = 454; MatterColorTemperatureLight(); ~MatterColorTemperatureLight(); diff --git a/libraries/Matter/src/MatterUtil/ColorFormat.h b/libraries/Matter/src/MatterUtil/ColorFormat.h deleted file mode 100644 index 20e9e0bd360..00000000000 --- a/libraries/Matter/src/MatterUtil/ColorFormat.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -struct RgbColor_t { - uint8_t r; - uint8_t g; - uint8_t b; -}; - -struct HsvColor_t { - uint16_t h; - uint8_t s; - uint8_t v; -}; - -struct XyColor_t { - uint16_t x; - uint16_t y; -}; - -struct CtColor_t { - uint16_t ctMireds; -}; - -RgbColor_t XYToRgb(uint8_t Level, uint16_t current_X, uint16_t current_Y); -XyColor_t RgbToXY(RgbColor_t rgb); -RgbColor_t HsvToRgb(HsvColor_t hsv); -RgbColor_t CTToRgb(CtColor_t ct); -HsvColor_t RgbToHsv(RgbColor_t rgb);