Skip to content

Commit

Permalink
Merge branch 'master' into tv_friendly_name
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffamzn authored Mar 8, 2023
2 parents 875d5d8 + 43d45ef commit 203dd6f
Show file tree
Hide file tree
Showing 88 changed files with 1,704 additions and 502 deletions.
14 changes: 9 additions & 5 deletions config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ if (CONFIG_ENABLE_CHIP_SHELL)
chip_gn_arg_append("chip_build_libshell" "true")
endif()

if (CONFIG_IDF_TARGET_ESP32H2)
if (CONFIG_ENABLE_WIFI_STATION OR CONFIG_ENABLE_WIFI_AP)
chip_gn_arg_append("chip_enable_wifi" "true")
else()
chip_gn_arg_append("chip_enable_wifi" "false")
endif()

Expand Down Expand Up @@ -286,20 +288,22 @@ target_include_directories(${COMPONENT_LIB} INTERFACE
idf_component_get_property(esp32_mbedtls_lib esp32_mbedtls COMPONENT_LIB)

if(CONFIG_BT_ENABLED)
idf_component_get_property(bt_lib bt COMPONENT_LIB)
if("${CONFIG_IDF_TARGET}" STREQUAL "esp32h2")
idf_component_get_property(bt_lib bt COMPONENT_LIB)
idf_component_get_property(bt_dir bt COMPONENT_DIR)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}>)
if(CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2)
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32h2/esp32h2-bt-lib/beta2/libble_app.a)
endif()
elseif("${CONFIG_IDF_TARGET}" STREQUAL "esp32c2")
idf_component_get_property(bt_lib bt COMPONENT_LIB)
idf_component_get_property(bt_dir bt COMPONENT_DIR)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}>)
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32c2/esp32c2-bt-lib/libble_app.a)
elseif("${CONFIG_IDF_TARGET}" STREQUAL "esp32c6")
idf_component_get_property(bt_dir bt COMPONENT_DIR)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}>)
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32c6/esp32c6-bt-lib/libble_app.a)
else()
idf_component_get_property(bt_lib bt COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}> -lbtdm_app)
endif()
endif()
Expand All @@ -314,7 +318,7 @@ if(CONFIG_OPENTHREAD_ENABLED)
list(APPEND chip_libraries $<TARGET_FILE:${openthread_lib}>)
endif()

if((NOT CONFIG_USE_MINIMAL_MDNS) AND (NOT CONFIG_IDF_TARGET_ESP32H2))
if((NOT CONFIG_USE_MINIMAL_MDNS) AND (CONFIG_ENABLE_WIFI_STATION OR CONFIG_ENABLE_WIFI_AP))
idf_build_get_property(build_components BUILD_COMPONENTS)
# For IDF v5.x, the mdns component was moved to idf_managed_components.
# We should use 'espressif__mdns' for 'idf_component_get_property'.
Expand Down
10 changes: 10 additions & 0 deletions docs/guides/esp32/setup_idf_chip.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ step.
$ ./install.sh
```

- For ESP32C6, please use commit
[afbdb0f3e](https://github.com/espressif/esp-idf/tree/afbdb0f3e).

```
$ cd esp-idf
$ git checkout afbdb0f3e
$ git submodule update --init
$ ./install.sh
```

## Setup Matter environment

### Install Prerequisites
Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ idf_build_set_property(COMPILE_OPTIONS "-Wno-format-nonliteral;-Wno-format-secur
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
idf_build_set_property(COMPILE_OPTIONS "-Wno-error=maybe-uninitialized" APPEND)

idf_build_set_property(COMPILE_OPTIONS "-Wno-error=array-bounds" APPEND)

flashing_script()

if (CONFIG_ENABLE_PW_RPC)
Expand Down
14 changes: 7 additions & 7 deletions examples/all-clusters-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set(PRIV_INCLUDE_DIRS_LIST
"${CMAKE_CURRENT_LIST_DIR}/include"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/third_party/nlfaultinjection/repo/include"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/third_party/nlfaultinjection/repo/include"
)
set(SRC_DIRS_LIST
"${CMAKE_CURRENT_LIST_DIR}"
Expand All @@ -40,9 +40,9 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/test-cluster-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fault-injection-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fan-control-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fan-control-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fixed-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/level-control"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server"
Expand All @@ -67,7 +67,7 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/target-navigator-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-user-interface-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/channel-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/scenes"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server"
Expand All @@ -83,8 +83,8 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wake-on-lan-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wake-on-lan-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/pump-configuration-and-control-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server"
Expand All @@ -108,7 +108,7 @@ set(SRC_DIRS_LIST "${SRC_DIRS_LIST}"
)
endif (CONFIG_ENABLE_PW_RPC)

if(("${CONFIG_DEVICE_TYPE_ESP32_DEVKITC}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_C2_DEVKITM}" STREQUAL "y"))
if(("${CONFIG_DEVICE_TYPE_ESP32_DEVKITC}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_C2_DEVKITM}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC}" STREQUAL "y"))
list(APPEND PRIV_INCLUDE_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/screen-framework/include")
set(PRIV_REQUIRES_LIST chip QRCode bt)
Expand Down
14 changes: 9 additions & 5 deletions examples/all-clusters-app/esp32/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ menu "Demo"
default DEVICE_TYPE_ESP32_DEVKITC if IDF_TARGET_ESP32
default DEVICE_TYPE_ESP32_C3_DEVKITM if IDF_TARGET_ESP32C3
default DEVICE_TYPE_ESP32_C2_DEVKITM if IDF_TARGET_ESP32C2
default DEVICE_TYPE_ESP32_C6_DEVKITC if IDF_TARGET_ESP32C6
help
Specifies the type of ESP32 device.

Expand All @@ -50,6 +51,9 @@ menu "Demo"
config DEVICE_TYPE_ESP32_C2_DEVKITM
bool "ESP32C2-DevKitM"
depends on IDF_TARGET_ESP32C2
config DEVICE_TYPE_ESP32_C6_DEVKITC
bool "ESP32C6-DevKitC"
depends on IDF_TARGET_ESP32C6
endchoice

choice
Expand Down Expand Up @@ -81,7 +85,7 @@ menu "Demo"
int
range 0 5
default 0 if DEVICE_TYPE_ESP32_DEVKITC
default 0 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM
default 0 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC
default 3 if DEVICE_TYPE_M5STACK
default 4 if DEVICE_TYPE_ESP32_WROVER_KIT

Expand All @@ -102,12 +106,12 @@ menu "Demo"
To reduce wear and heat the M5Stack's Display is automatically switched off after a few seconds

config STATUS_LED_GPIO_NUM
int
int
range 0 40
default 2 if DEVICE_TYPE_ESP32_DEVKITC #Use LED1 (blue LED) as status LED on DevKitC
default 2 if DEVICE_TYPE_ESP32_DEVKITC #Use LED1 (blue LED) as status LED on DevKitC
default 2 if DEVICE_TYPE_ESP32_ETHERNET_KIT
default 8 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM
default 26 if DEVICE_TYPE_ESP32_WROVER_KIT
default 8 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC
default 26 if DEVICE_TYPE_ESP32_WROVER_KIT
default 40 if DEVICE_TYPE_M5STACK
help
Each board has a status led, define its pin number.
Expand Down
10 changes: 5 additions & 5 deletions examples/all-clusters-app/esp32/main/LEDWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "esp_log.h"
#include "esp_system.h"
#include "esp_timer.h"
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC
#include "driver/rmt.h"
#include "led_strip.h"
#define RMT_TX_DEFAULT_GPIO GPIO_NUM_8
Expand All @@ -51,7 +51,7 @@ void LEDWidget::Init(gpio_num_t gpioNum)
mState = false;
mError = false;
errorTimer = NULL;
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC
if (gpioNum == RMT_TX_DEFAULT_GPIO)
{
rmt_config_t config = RMT_DEFAULT_CONFIG_TX(RMT_TX_DEFAULT_GPIO, RMT_TX_DEFAULT_CHANNEL);
Expand Down Expand Up @@ -98,7 +98,7 @@ void LEDWidget::Set(bool state)

void LEDWidget::SetBrightness(uint8_t brightness)
{
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC
if (strip)
{
uint8_t red, green, blue;
Expand Down Expand Up @@ -186,7 +186,7 @@ void LEDWidget::DoSet(bool state)
{
bool stateChange = (mState != state);
mState = state;
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC
if (strip)
{
uint8_t red, green, blue;
Expand Down Expand Up @@ -229,7 +229,7 @@ void LEDWidget::SetVLED(int id1, int id2)
}
#endif

#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC
void LEDWidget::SetColor(uint8_t Hue, uint8_t Saturation)
{
uint8_t red, green, blue;
Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-app/esp32/main/include/LEDWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class LEDWidget
void BlinkOnError();

void Animate();
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC
void SetColor(uint8_t Hue, uint8_t Saturation);

void HSB2rgb(uint16_t Hue, uint8_t Saturation, uint8_t brightness, uint8_t & red, uint8_t & green, uint8_t & blue);
Expand All @@ -61,7 +61,7 @@ class LEDWidget
uint32_t mBlinkOnTimeMS;
uint32_t mBlinkOffTimeMS;
uint8_t mDefaultOnBrightness;
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC
uint16_t mHue; // mHue [0, 360]
uint8_t mSaturation; // mSaturation [0, 100]
#endif
Expand Down
64 changes: 64 additions & 0 deletions examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c6
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
CONFIG_IDF_TARGET="esp32c6"

# Default to 921600 baud when flashing and monitoring device
CONFIG_ESPTOOLPY_BAUD_921600B=y
CONFIG_ESPTOOLPY_BAUD=921600
CONFIG_ESPTOOLPY_COMPRESSED=y
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
CONFIG_ESPTOOLPY_FLASHFREQ="40m"
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200

# libsodium
CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y


# NIMBLE
CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y
CONFIG_BT_NIMBLE_EXT_ADV=n
CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70
CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n

# Disable OpenThread
CONFIG_OPENTHREAD_ENABLED=n

# Disable lwip ipv6 autoconfig
CONFIG_LWIP_IPV6_AUTOCONFIG=n

# Use a custom partition table
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"

# LwIP config for OpenThread
CONFIG_LWIP_IPV6_NUM_ADDRESSES=8
CONFIG_LWIP_MULTICAST_PING=y

# mbedTLS
CONFIG_MBEDTLS_HARDWARE_AES=n
CONFIG_MBEDTLS_HARDWARE_MPI=n
CONFIG_MBEDTLS_HARDWARE_SHA=n
CONFIG_MBEDTLS_HARDWARE_ECC=y
CONFIG_MBEDTLS_CMAC_C=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECJPAKE=y
CONFIG_MBEDTLS_ECJPAKE_C=y

# MDNS platform
CONFIG_USE_MINIMAL_MDNS=y
CONFIG_ENABLE_EXTENDED_DISCOVERY=y

# FreeRTOS should use legacy API
CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y

# Wi-Fi Settings
CONFIG_ENABLE_WIFI_STATION=y
CONFIG_ENABLE_WIFI_AP=n
# Enable this to avoid implicit declaration of function 'esp_send_assoc_resp'
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y

# Enable OTA Requestor
CONFIG_ENABLE_OTA_REQUESTOR=y

# Enable chip shell
CONFIG_ENABLE_CHIP_SHELL=y
12 changes: 2 additions & 10 deletions examples/common/screen-framework/Display.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
* Copyright (c) 2020-2023 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
Expand All @@ -16,14 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file Display.cpp
*
* This file implements helper APIs for the M5Stack's display
*
*/

#include <string.h>

#include "driver/ledc.h"
Expand Down Expand Up @@ -54,7 +46,7 @@
// The M5Stack's backlight is on Channel 7
#define BACKLIGHT_CHANNEL LEDC_CHANNEL_7

extern const char * TAG;
static const char * TAG = "Display";

uint16_t DisplayHeight = 0;
uint16_t DisplayWidth = 0;
Expand Down
10 changes: 9 additions & 1 deletion examples/lighting-app/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2021 Project CHIP Authors
# Copyright (c) 2021-2023 Project CHIP Authors
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -29,6 +29,12 @@ set(EXTRA_COMPONENT_DIRS
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/QRCode"
)

if(${IDF_TARGET} STREQUAL "esp32")
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components/tft"
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components/spidriver"
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/screen-framework")
endif()

project(chip-lighting-app)

# C++17 is required for RPC build.
Expand All @@ -46,6 +52,8 @@ idf_build_set_property(COMPILE_OPTIONS "-Wno-error=maybe-uninitialized" APPEND)

#For the H2, -Werror=uninitialized will cause an error in "src/lib/support/LambdaBridge.h"
idf_build_set_property(COMPILE_OPTIONS "-Wno-error=uninitialized" APPEND)
#For ESP32-C6, -Werror=array-bounds will cause an error in 'third_party/nlfaultinjection/repo/src/nlfaultinjection.cpp'
idf_build_set_property(COMPILE_OPTIONS "-Wno-error=array-bounds" APPEND)

flashing_script()

Expand Down
Loading

0 comments on commit 203dd6f

Please sign in to comment.