我目前採用 ESP32-C3 開發板編譯 esp-matter/example/light 範例都可以正常操作,
唯獨 LED 的配置有問題,編譯 app_driver.cpp 的結果一直是 BSP_LED_NUM = 0 的
情況,檢查過 sdkconfig 的設定如下,請問我要如何才能在 ESP32-C3 設定好 LED 呢?
目前執行板子的 log 一直是 [NG] LED set power: 1
sdkconfig :
=========================================================
#
# LEDs
#
CONFIG_BSP_LED_TYPE_GPIO=y
# CONFIG_BSP_LED_TYPE_RGB_CLASSIC is not set
# CONFIG_BSP_LED_TYPE_RGB is not set
CONFIG_ENV_MAX_LEDS=5
CONFIG_BSP_LEDS_NUM=2
CONFIG_BSP_ESP_IDF_VERSION="5.2"
#
# LED 1
#
CONFIG_BSP_LED_1_GPIO=8
CONFIG_BSP_LED_1_LEVEL=0
# end of LED 1
#
# LED 2
#
CONFIG_BSP_LED_2_GPIO=9
CONFIG_BSP_LED_2_LEVEL=0
# end of LED 2
# end of LEDs
app_driver.cpp
=========================================================
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
esp_err_t err = ESP_OK;
ESP_LOGI(TAG, "[OK] LED set power: %d", val->val.b);
if (val->val.b) {
err = led_indicator_start(handle, BSP_LED_ON);
} else {
err = led_indicator_start(handle, BSP_LED_OFF);
}
return err;
#else
ESP_LOGI(TAG, "[NG] LED set power: %d", val->val.b);
return ESP_OK;
#endif
}
ESP32-C3 編譯 Matter Light example 無法配置 LED
Moderator: ESP_Bob
Re: ESP32-C3 編譯 Matter Light example 無法配置 LED
在 sdkconfig.defaults.esp32c3 这个文件中增加如下配置
# LEDs
CONFIG_ENV_MAX_LEDS=1
CONFIG_BSP_LEDS_NUM=1
CONFIG_BSP_LED_RGB_GPIO=8
然后编译
就会在sdkconfig 这个文件中 出现这个配置,根据需求修改GPIO引脚
#
# LED 1
#
CONFIG_BSP_LED_1_GPIO=8
CONFIG_BSP_LED_1_LEVEL=0
# end of LED 1
# LEDs
CONFIG_ENV_MAX_LEDS=1
CONFIG_BSP_LEDS_NUM=1
CONFIG_BSP_LED_RGB_GPIO=8
然后编译
就会在sdkconfig 这个文件中 出现这个配置,根据需求修改GPIO引脚
#
# LED 1
#
CONFIG_BSP_LED_1_GPIO=8
CONFIG_BSP_LED_1_LEVEL=0
# end of LED 1
Who is online
Users browsing this forum: No registered users and 12 guests