mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'fix/light_example_boot_buttons' into 'main'
fix: Fixed boot GPIO number on ESP32C6, ESP32H2 and ESP32C3. Closes IDF-9172 See merge request app-frameworks/esp-matter!640
This commit is contained in:
@@ -24,7 +24,7 @@ extern uint16_t light_endpoint_id;
|
||||
/* Do any conversions/remapping for the actual value here */
|
||||
static esp_err_t app_driver_light_set_power(led_indicator_handle_t handle, esp_matter_attr_val_t *val)
|
||||
{
|
||||
#if BSP_LED_NUM > 0
|
||||
#if CONFIG_BSP_LEDS_NUM > 0
|
||||
esp_err_t err = ESP_OK;
|
||||
if (val->val.b) {
|
||||
err = led_indicator_start(handle, BSP_LED_ON);
|
||||
@@ -41,7 +41,7 @@ static esp_err_t app_driver_light_set_power(led_indicator_handle_t handle, esp_m
|
||||
static esp_err_t app_driver_light_set_brightness(led_indicator_handle_t handle, esp_matter_attr_val_t *val)
|
||||
{
|
||||
int value = REMAP_TO_RANGE(val->val.u8, MATTER_BRIGHTNESS, STANDARD_BRIGHTNESS);
|
||||
#if BSP_LED_NUM > 0
|
||||
#if CONFIG_BSP_LEDS_NUM > 0
|
||||
return led_indicator_set_brightness(handle, value);
|
||||
#else
|
||||
ESP_LOGI(TAG, "LED set brightness: %d", value);
|
||||
@@ -52,10 +52,11 @@ static esp_err_t app_driver_light_set_brightness(led_indicator_handle_t handle,
|
||||
static esp_err_t app_driver_light_set_hue(led_indicator_handle_t handle, esp_matter_attr_val_t *val)
|
||||
{
|
||||
int value = REMAP_TO_RANGE(val->val.u8, MATTER_HUE, STANDARD_HUE);
|
||||
#if BSP_LED_NUM > 0
|
||||
uint32_t hsv = led_indicator_get_hsv(handle);
|
||||
SET_HUE(hsv, value);
|
||||
return led_indicator_set_hsv(handle, hsv);
|
||||
#if CONFIG_BSP_LEDS_NUM > 0
|
||||
led_indicator_ihsv_t hsv;
|
||||
hsv.value = led_indicator_get_hsv(handle);
|
||||
hsv.h = value;
|
||||
return led_indicator_set_hsv(handle, hsv.value);
|
||||
#else
|
||||
ESP_LOGI(TAG, "LED set hue: %d", value);
|
||||
return ESP_OK;
|
||||
@@ -65,10 +66,11 @@ static esp_err_t app_driver_light_set_hue(led_indicator_handle_t handle, esp_mat
|
||||
static esp_err_t app_driver_light_set_saturation(led_indicator_handle_t handle, esp_matter_attr_val_t *val)
|
||||
{
|
||||
int value = REMAP_TO_RANGE(val->val.u8, MATTER_SATURATION, STANDARD_SATURATION);
|
||||
#if BSP_LED_NUM > 0
|
||||
uint32_t hsv = led_indicator_get_hsv(handle);
|
||||
SET_SATURATION(hsv, value);
|
||||
return led_indicator_set_hsv(handle, hsv);
|
||||
#if CONFIG_BSP_LEDS_NUM > 0
|
||||
led_indicator_ihsv_t hsv;
|
||||
hsv.value = led_indicator_get_hsv(handle);
|
||||
hsv.s = value;
|
||||
return led_indicator_set_hsv(handle, hsv.value);
|
||||
#else
|
||||
ESP_LOGI(TAG, "LED set saturation: %d", value);
|
||||
return ESP_OK;
|
||||
@@ -78,7 +80,7 @@ static esp_err_t app_driver_light_set_saturation(led_indicator_handle_t handle,
|
||||
static esp_err_t app_driver_light_set_temperature(led_indicator_handle_t handle, esp_matter_attr_val_t *val)
|
||||
{
|
||||
uint32_t value = REMAP_TO_RANGE_INVERSE(val->val.u16, STANDARD_TEMPERATURE_FACTOR);
|
||||
#if BSP_LED_NUM > 0
|
||||
#if CONFIG_BSP_LEDS_NUM > 0
|
||||
return led_indicator_set_color_temperature(handle, value);
|
||||
#else
|
||||
ESP_LOGI(TAG, "LED set temperature: %ld", value);
|
||||
@@ -181,10 +183,10 @@ esp_err_t app_driver_light_set_defaults(uint16_t endpoint_id)
|
||||
|
||||
app_driver_handle_t app_driver_light_init()
|
||||
{
|
||||
#if BSP_LED_NUM > 0
|
||||
#if CONFIG_BSP_LEDS_NUM > 0
|
||||
/* Initialize led */
|
||||
led_indicator_handle_t leds[BSP_LED_NUM];
|
||||
ESP_ERROR_CHECK(bsp_led_indicator_create(leds, NULL, BSP_LED_NUM));
|
||||
led_indicator_handle_t leds[CONFIG_BSP_LEDS_NUM];
|
||||
ESP_ERROR_CHECK(bsp_led_indicator_create(leds, NULL, CONFIG_BSP_LEDS_NUM));
|
||||
led_indicator_set_hsv(leds[0], SET_HSV(DEFAULT_HUE, DEFAULT_SATURATION, DEFAULT_BRIGHTNESS));
|
||||
|
||||
return (app_driver_handle_t)leds[0];
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
CONFIG_IDF_TARGET="esp32c3"
|
||||
|
||||
# Enable OTA Requestor
|
||||
CONFIG_ENABLE_OTA_REQUESTOR=y
|
||||
|
||||
# Disable AP
|
||||
CONFIG_ENABLE_WIFI_STATION=y
|
||||
CONFIG_ENABLE_WIFI_AP=n
|
||||
|
||||
# ESP32-C3-DevKitC-02 Settings
|
||||
# Buttons
|
||||
CONFIG_BSP_BUTTONS_NUM=1
|
||||
CONFIG_BSP_BUTTON_1_TYPE_GPIO=y
|
||||
CONFIG_BSP_BUTTON_1_GPIO=9
|
||||
CONFIG_BSP_BUTTON_1_LEVEL=0
|
||||
# LEDs
|
||||
CONFIG_BSP_LEDS_NUM=1
|
||||
CONFIG_BSP_LED_TYPE_RGB=y
|
||||
CONFIG_BSP_LED_RGB_GPIO=8
|
||||
CONFIG_BSP_LED_RGB_BACKEND_RMT=y
|
||||
|
||||
@@ -42,7 +42,7 @@ CONFIG_ENABLE_CHIP_SHELL=y
|
||||
# Buttons
|
||||
CONFIG_BSP_BUTTONS_NUM=1
|
||||
CONFIG_BSP_BUTTON_1_TYPE_GPIO=y
|
||||
CONFIG_BSP_BUTTON_1_GPIO=0
|
||||
CONFIG_BSP_BUTTON_1_GPIO=9
|
||||
CONFIG_BSP_BUTTON_1_LEVEL=0
|
||||
# LEDs
|
||||
CONFIG_BSP_LEDS_NUM=1
|
||||
|
||||
@@ -58,7 +58,7 @@ CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=y
|
||||
# Buttons
|
||||
CONFIG_BSP_BUTTONS_NUM=1
|
||||
CONFIG_BSP_BUTTON_1_TYPE_GPIO=y
|
||||
CONFIG_BSP_BUTTON_1_GPIO=0
|
||||
CONFIG_BSP_BUTTON_1_GPIO=9
|
||||
CONFIG_BSP_BUTTON_1_LEVEL=0
|
||||
# LEDs
|
||||
CONFIG_BSP_LEDS_NUM=1
|
||||
|
||||
@@ -50,3 +50,12 @@ CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y
|
||||
|
||||
# Enable HKDF in mbedtls
|
||||
CONFIG_MBEDTLS_HKDF_C=y
|
||||
|
||||
# ESP32-DevKit Settings
|
||||
# Buttons
|
||||
CONFIG_BSP_BUTTONS_NUM=1
|
||||
CONFIG_BSP_BUTTON_1_TYPE_GPIO=y
|
||||
CONFIG_BSP_BUTTON_1_GPIO=0
|
||||
CONFIG_BSP_BUTTON_1_LEVEL=0
|
||||
# LEDs
|
||||
CONFIG_BSP_LEDS_NUM=0
|
||||
Reference in New Issue
Block a user