mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Add RAC example
This commit is contained in:
@@ -47,3 +47,9 @@ examples/zigbee_bridge:
|
||||
- if: IDF_TARGET in ["esp32"]
|
||||
temporary: true
|
||||
reason: the other targets are not tested yet
|
||||
|
||||
examples/room_air_conditioner:
|
||||
enable:
|
||||
- if: IDF_TARGET in ["esp32", "esp32c3", "esp32c2", "esp32c6", "esp32h2"]
|
||||
temporary: true
|
||||
reason: the other targets are not tested yet
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
if(NOT DEFINED ENV{ESP_MATTER_PATH})
|
||||
message(FATAL_ERROR "Please set ESP_MATTER_PATH to the path of esp-matter repo")
|
||||
endif(NOT DEFINED ENV{ESP_MATTER_PATH})
|
||||
|
||||
if(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH})
|
||||
if("${IDF_TARGET}" STREQUAL "esp32" OR "${IDF_TARGET}" STREQUAL "")
|
||||
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32_devkit_c)
|
||||
elseif("${IDF_TARGET}" STREQUAL "esp32c3")
|
||||
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32c3_devkit_m)
|
||||
elseif("${IDF_TARGET}" STREQUAL "esp32c2")
|
||||
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32c2_devkit_m)
|
||||
elseif("${IDF_TARGET}" STREQUAL "esp32h2")
|
||||
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32h2_devkit_c)
|
||||
elseif("${IDF_TARGET}" STREQUAL "esp32s3")
|
||||
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32s3_devkit_c)
|
||||
elseif("${IDF_TARGET}" STREQUAL "esp32c6")
|
||||
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32c6_devkit_c)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported IDF_TARGET")
|
||||
endif()
|
||||
endif(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH})
|
||||
|
||||
set(PROJECT_VER "1.0")
|
||||
set(PROJECT_VER_NUMBER 1)
|
||||
|
||||
set(ESP_MATTER_PATH $ENV{ESP_MATTER_PATH})
|
||||
set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip)
|
||||
|
||||
# This should be done before using the IDF_TARGET variable.
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS
|
||||
"${ESP_MATTER_PATH}/examples/common"
|
||||
"${MATTER_SDK_PATH}/config/esp32/components"
|
||||
"${ESP_MATTER_PATH}/components"
|
||||
"${ESP_MATTER_PATH}/device_hal/device"
|
||||
${extra_components_dirs_append})
|
||||
|
||||
project(room_air_conditioner)
|
||||
|
||||
# WARNING: This is just an example for using key for decrypting the encrypted OTA image
|
||||
# Please do not use it as is.
|
||||
if(CONFIG_ENABLE_ENCRYPTED_OTA)
|
||||
target_add_binary_data(room_air_conditioner.elf "esp_image_encryption_key.pem" TEXT)
|
||||
endif()
|
||||
|
||||
if(CONFIG_IDF_TARGET_ESP32C2)
|
||||
include(relinker)
|
||||
endif()
|
||||
|
||||
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DCHIP_HAVE_CONFIG_H" APPEND)
|
||||
idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND)
|
||||
# For RISCV chips, project_include.cmake sets -Wno-format, but does not clear various
|
||||
# flags that depend on -Wformat
|
||||
idf_build_set_property(COMPILE_OPTIONS "-Wno-format-nonliteral;-Wno-format-security" APPEND)
|
||||
@@ -0,0 +1,14 @@
|
||||
# Room Air Conditioner
|
||||
|
||||
This example creates a Room Air Conditioner device using the ESP
|
||||
Matter data model.
|
||||
|
||||
See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html) for more information about building and flashing the firmware.
|
||||
|
||||
## 1. Additional Environment Setup
|
||||
|
||||
No additional setup is required.
|
||||
|
||||
## 2. Post Commissioning Setup
|
||||
|
||||
No additional setup is required.
|
||||
@@ -0,0 +1,8 @@
|
||||
set(PRIV_REQUIRES_LIST device esp_matter esp_matter_console app_reset)
|
||||
|
||||
idf_component_register(SRC_DIRS "."
|
||||
PRIV_INCLUDE_DIRS "."
|
||||
PRIV_REQUIRES ${PRIV_REQUIRES_LIST})
|
||||
|
||||
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H")
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <device.h>
|
||||
#include <esp_matter.h>
|
||||
#include <led_driver.h>
|
||||
|
||||
#include <app_priv.h>
|
||||
|
||||
using namespace chip::app::Clusters;
|
||||
using namespace esp_matter;
|
||||
|
||||
static const char *TAG = "app_driver";
|
||||
extern uint16_t room_air_conditioner_endpoint_id;
|
||||
|
||||
/* Do any conversions/remapping for the actual value here */
|
||||
static esp_err_t app_driver_room_air_conditioner_set_power(led_driver_handle_t handle, esp_matter_attr_val_t *val)
|
||||
{
|
||||
return led_driver_set_power(handle, val->val.b);
|
||||
}
|
||||
|
||||
static void app_driver_button_toggle_cb(void *arg, void *data)
|
||||
{
|
||||
ESP_LOGI(TAG, "Toggle button pressed");
|
||||
uint16_t endpoint_id = room_air_conditioner_endpoint_id;
|
||||
uint32_t cluster_id = OnOff::Id;
|
||||
uint32_t attribute_id = OnOff::Attributes::OnOff::Id;
|
||||
|
||||
node_t *node = node::get();
|
||||
endpoint_t *endpoint = endpoint::get(node, endpoint_id);
|
||||
cluster_t *cluster = cluster::get(endpoint, cluster_id);
|
||||
attribute_t *attribute = attribute::get(cluster, attribute_id);
|
||||
|
||||
esp_matter_attr_val_t val = esp_matter_invalid(NULL);
|
||||
attribute::get_val(attribute, &val);
|
||||
val.val.b = !val.val.b;
|
||||
attribute::update(endpoint_id, cluster_id, attribute_id, &val);
|
||||
}
|
||||
|
||||
esp_err_t app_driver_attribute_update(app_driver_handle_t driver_handle, uint16_t endpoint_id, uint32_t cluster_id,
|
||||
uint32_t attribute_id, esp_matter_attr_val_t *val)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
if (endpoint_id == room_air_conditioner_endpoint_id) {
|
||||
led_driver_handle_t handle = (led_driver_handle_t)driver_handle;
|
||||
if (cluster_id == OnOff::Id) {
|
||||
if (attribute_id == OnOff::Attributes::OnOff::Id) {
|
||||
err = app_driver_room_air_conditioner_set_power(handle, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t app_driver_room_air_conditioner_set_defaults(uint16_t endpoint_id)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
void *priv_data = endpoint::get_priv_data(endpoint_id);
|
||||
led_driver_handle_t handle = (led_driver_handle_t)priv_data;
|
||||
node_t *node = node::get();
|
||||
endpoint_t *endpoint = endpoint::get(node, endpoint_id);
|
||||
cluster_t *cluster = NULL;
|
||||
attribute_t *attribute = NULL;
|
||||
esp_matter_attr_val_t val = esp_matter_invalid(NULL);
|
||||
|
||||
/* Setting power */
|
||||
cluster = cluster::get(endpoint, OnOff::Id);
|
||||
attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id);
|
||||
attribute::get_val(attribute, &val);
|
||||
err |= app_driver_room_air_conditioner_set_power(handle, &val);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
app_driver_handle_t app_driver_room_air_conditioner_init()
|
||||
{
|
||||
/* Initialize led */
|
||||
led_driver_config_t config = led_driver_get_config();
|
||||
led_driver_handle_t handle = led_driver_init(&config);
|
||||
return (app_driver_handle_t)handle;
|
||||
}
|
||||
|
||||
app_driver_handle_t app_driver_button_init()
|
||||
{
|
||||
/* Initialize button */
|
||||
button_config_t config = button_driver_get_config();
|
||||
button_handle_t handle = iot_button_create(&config);
|
||||
iot_button_register_cb(handle, BUTTON_PRESS_DOWN, app_driver_button_toggle_cb, NULL);
|
||||
return (app_driver_handle_t)handle;
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include <esp_err.h>
|
||||
#include <esp_log.h>
|
||||
#include <nvs_flash.h>
|
||||
|
||||
#include <esp_matter.h>
|
||||
#include <esp_matter_console.h>
|
||||
#include <esp_matter_ota.h>
|
||||
|
||||
#include <app_priv.h>
|
||||
#include <app_reset.h>
|
||||
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
|
||||
#include <platform/ESP32/OpenthreadLauncher.h>
|
||||
#endif
|
||||
|
||||
#include <app/server/CommissioningWindowManager.h>
|
||||
#include <app/server/Server.h>
|
||||
|
||||
static const char *TAG = "app_main";
|
||||
uint16_t room_air_conditioner_endpoint_id = 0;
|
||||
|
||||
using namespace esp_matter;
|
||||
using namespace esp_matter::attribute;
|
||||
using namespace esp_matter::endpoint;
|
||||
using namespace chip::app::Clusters;
|
||||
|
||||
constexpr auto k_timeout_seconds = 300;
|
||||
|
||||
static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
|
||||
{
|
||||
switch (event->Type) {
|
||||
case chip::DeviceLayer::DeviceEventType::kInterfaceIpAddressChanged:
|
||||
ESP_LOGI(TAG, "Interface IP Address changed");
|
||||
break;
|
||||
|
||||
case chip::DeviceLayer::DeviceEventType::kCommissioningComplete:
|
||||
ESP_LOGI(TAG, "Commissioning complete");
|
||||
break;
|
||||
|
||||
case chip::DeviceLayer::DeviceEventType::kFailSafeTimerExpired:
|
||||
ESP_LOGI(TAG, "Commissioning failed, fail safe timer expired");
|
||||
break;
|
||||
|
||||
case chip::DeviceLayer::DeviceEventType::kCommissioningSessionStarted:
|
||||
ESP_LOGI(TAG, "Commissioning session started");
|
||||
break;
|
||||
|
||||
case chip::DeviceLayer::DeviceEventType::kCommissioningSessionStopped:
|
||||
ESP_LOGI(TAG, "Commissioning session stopped");
|
||||
break;
|
||||
|
||||
case chip::DeviceLayer::DeviceEventType::kCommissioningWindowOpened:
|
||||
ESP_LOGI(TAG, "Commissioning window opened");
|
||||
break;
|
||||
|
||||
case chip::DeviceLayer::DeviceEventType::kCommissioningWindowClosed:
|
||||
ESP_LOGI(TAG, "Commissioning window closed");
|
||||
break;
|
||||
|
||||
case chip::DeviceLayer::DeviceEventType::kFabricRemoved:
|
||||
{
|
||||
ESP_LOGI(TAG, "Fabric removed successfully");
|
||||
if (chip::Server::GetInstance().GetFabricTable().FabricCount() == 0)
|
||||
{
|
||||
chip::CommissioningWindowManager & commissionMgr = chip::Server::GetInstance().GetCommissioningWindowManager();
|
||||
constexpr auto kTimeoutSeconds = chip::System::Clock::Seconds16(k_timeout_seconds);
|
||||
if (!commissionMgr.IsCommissioningWindowOpen())
|
||||
{
|
||||
/* After removing last fabric, this example does not remove the Wi-Fi credentials
|
||||
* and still has IP connectivity so, only advertising on DNS-SD.
|
||||
*/
|
||||
CHIP_ERROR err = commissionMgr.OpenBasicCommissioningWindow(kTimeoutSeconds,
|
||||
chip::CommissioningWindowAdvertisement::kDnssdOnly);
|
||||
if (err != CHIP_NO_ERROR)
|
||||
{
|
||||
ESP_LOGE(TAG, "Failed to open commissioning window, err:%" CHIP_ERROR_FORMAT, err.Format());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case chip::DeviceLayer::DeviceEventType::kFabricWillBeRemoved:
|
||||
ESP_LOGI(TAG, "Fabric will be removed");
|
||||
break;
|
||||
|
||||
case chip::DeviceLayer::DeviceEventType::kFabricUpdated:
|
||||
ESP_LOGI(TAG, "Fabric is updated");
|
||||
break;
|
||||
|
||||
case chip::DeviceLayer::DeviceEventType::kFabricCommitted:
|
||||
ESP_LOGI(TAG, "Fabric is committed");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static esp_err_t app_identification_cb(identification::callback_type_t type, uint16_t endpoint_id, uint8_t effect_id,
|
||||
uint8_t effect_variant, void *priv_data)
|
||||
{
|
||||
ESP_LOGI(TAG, "Identification callback: type: %u, effect: %u, variant: %u", type, effect_id, effect_variant);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t app_attribute_update_cb(attribute::callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
|
||||
uint32_t attribute_id, esp_matter_attr_val_t *val, void *priv_data)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
if (type == PRE_UPDATE) {
|
||||
/* Driver update */
|
||||
app_driver_handle_t driver_handle = (app_driver_handle_t)priv_data;
|
||||
err = app_driver_attribute_update(driver_handle, endpoint_id, cluster_id, attribute_id, val);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
extern "C" void app_main()
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
/* Initialize the ESP NVS layer */
|
||||
nvs_flash_init();
|
||||
|
||||
/* Initialize driver */
|
||||
app_driver_handle_t room_air_conditioner_handle = app_driver_room_air_conditioner_init();
|
||||
app_driver_handle_t button_handle = app_driver_button_init();
|
||||
app_reset_button_register(button_handle);
|
||||
|
||||
/* Create a Matter node and add the mandatory Root Node device type on endpoint 0 */
|
||||
node::config_t node_config;
|
||||
node_t *node = node::create(&node_config, app_attribute_update_cb, app_identification_cb);
|
||||
|
||||
room_air_conditioner::config_t room_air_conditioner_config;
|
||||
room_air_conditioner_config.on_off.on_off = DEFAULT_POWER;
|
||||
endpoint_t *endpoint = room_air_conditioner::create(node, &room_air_conditioner_config, ENDPOINT_FLAG_NONE, room_air_conditioner_handle);
|
||||
|
||||
/* These node and endpoint handles can be used to create/add other endpoints and clusters. */
|
||||
if (!node || !endpoint) {
|
||||
ESP_LOGE(TAG, "Matter node creation failed");
|
||||
}
|
||||
|
||||
room_air_conditioner_endpoint_id = endpoint::get_id(endpoint);
|
||||
ESP_LOGI(TAG, "Room Air Conditioner created with endpoint_id %d", room_air_conditioner_endpoint_id);
|
||||
|
||||
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
|
||||
/* Set OpenThread platform config */
|
||||
esp_openthread_platform_config_t config = {
|
||||
.radio_config = ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG(),
|
||||
.host_config = ESP_OPENTHREAD_DEFAULT_HOST_CONFIG(),
|
||||
.port_config = ESP_OPENTHREAD_DEFAULT_PORT_CONFIG(),
|
||||
};
|
||||
set_openthread_platform_config(&config);
|
||||
#endif
|
||||
|
||||
/* Matter start */
|
||||
err = esp_matter::start(app_event_cb);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Matter start failed: %d", err);
|
||||
}
|
||||
|
||||
/* Starting driver with default values */
|
||||
app_driver_room_air_conditioner_set_defaults(room_air_conditioner_endpoint_id);
|
||||
|
||||
#if CONFIG_ENABLE_CHIP_SHELL
|
||||
esp_matter::console::diagnostics_register_commands();
|
||||
esp_matter::console::wifi_register_commands();
|
||||
esp_matter::console::init();
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <esp_err.h>
|
||||
#include <esp_matter.h>
|
||||
|
||||
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
|
||||
#include "esp_openthread_types.h"
|
||||
#endif
|
||||
|
||||
/** Default attribute values used during initialization */
|
||||
#define DEFAULT_POWER true
|
||||
|
||||
typedef void *app_driver_handle_t;
|
||||
|
||||
/** Initialize the room_air_conditioner driver
|
||||
*
|
||||
* This initializes the room_air_conditioner driver associated with the selected board.
|
||||
*
|
||||
* @return Handle on success.
|
||||
* @return NULL in case of failure.
|
||||
*/
|
||||
app_driver_handle_t app_driver_room_air_conditioner_init();
|
||||
|
||||
/** Initialize the button driver
|
||||
*
|
||||
* This initializes the button driver associated with the selected board.
|
||||
*
|
||||
* @return Handle on success.
|
||||
* @return NULL in case of failure.
|
||||
*/
|
||||
app_driver_handle_t app_driver_button_init();
|
||||
|
||||
/** Driver Update
|
||||
*
|
||||
* This API should be called to update the driver for the attribute being updated.
|
||||
* This is usually called from the common `app_attribute_update_cb()`.
|
||||
*
|
||||
* @param[in] endpoint_id Endpoint ID of the attribute.
|
||||
* @param[in] cluster_id Cluster ID of the attribute.
|
||||
* @param[in] attribute_id Attribute ID of the attribute.
|
||||
* @param[in] val Pointer to `esp_matter_attr_val_t`. Use appropriate elements as per the value type.
|
||||
*
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t app_driver_attribute_update(app_driver_handle_t driver_handle, uint16_t endpoint_id, uint32_t cluster_id,
|
||||
uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
|
||||
/** Set defaults for room_air_conditioner driver
|
||||
*
|
||||
* Set the attribute drivers to their default values from the created data model.
|
||||
*
|
||||
* @param[in] endpoint_id Endpoint ID of the driver.
|
||||
*
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t app_driver_room_air_conditioner_set_defaults(uint16_t endpoint_id);
|
||||
|
||||
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
|
||||
#define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \
|
||||
{ \
|
||||
.radio_mode = RADIO_MODE_NATIVE, \
|
||||
}
|
||||
|
||||
#define ESP_OPENTHREAD_DEFAULT_HOST_CONFIG() \
|
||||
{ \
|
||||
.host_connection_mode = HOST_CONNECTION_MODE_NONE, \
|
||||
}
|
||||
|
||||
#define ESP_OPENTHREAD_DEFAULT_PORT_CONFIG() \
|
||||
{ \
|
||||
.storage_partition_name = "ot_storage", .netif_queue_size = 10, .task_queue_size = 10, \
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
dependencies:
|
||||
espressif/cmake_utilities:
|
||||
version: 0.*
|
||||
rules: # will add "optional_component" only when all if clauses are True
|
||||
- if: "idf_version >=5.0"
|
||||
- if: "target in [esp32c2]"
|
||||
@@ -0,0 +1,10 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
# Note: Firmware partition offset needs to be 64K aligned, initial 36K (9 sectors) are reserved for bootloader and partition table
|
||||
esp_secure_cert, 0x3F, ,0xd000, 0x2000, encrypted
|
||||
nvs, data, nvs, 0x10000, 0x6000,
|
||||
nvs_keys, data, nvs_keys,, 0x1000, encrypted
|
||||
otadata, data, ota, , 0x2000
|
||||
phy_init, data, phy, , 0x1000,
|
||||
ota_0, app, ota_0, 0x20000, 0x1E0000,
|
||||
ota_1, app, ota_1, 0x200000, 0x1E0000,
|
||||
fctry, data, nvs, 0x3E0000, 0x6000
|
||||
|
@@ -0,0 +1,11 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
# Note: Firmware partition offset needs to be 64K aligned, initial 36K (9 sectors) are reserved for bootloader and partition table
|
||||
esp_secure_cert, 0x3F, ,0xd000, 0x2000, encrypted
|
||||
nvs, data, nvs, 0x10000, 0x6000,
|
||||
nvs_keys, data, nvs_keys, , 0x1000, encrypted
|
||||
otadata, data, ota, , 0x2000
|
||||
phy_init, data, phy, , 0x1000,
|
||||
ota_0, app, ota_0, , 0x1C0000,
|
||||
ota_1, app, ota_1, , 0x1C0000,
|
||||
# For Wi-Fi device, this partition can be deleted.
|
||||
ot_storage,data, fat, , 0x2000,
|
||||
|
@@ -0,0 +1,49 @@
|
||||
# Default to 921600 baud when flashing and monitoring device
|
||||
CONFIG_ESPTOOLPY_BAUD_921600B=y
|
||||
CONFIG_ESPTOOLPY_BAUD=921600
|
||||
CONFIG_ESPTOOLPY_COMPRESSED=y
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||
|
||||
#enable BT
|
||||
CONFIG_BT_ENABLED=y
|
||||
CONFIG_BT_NIMBLE_ENABLED=y
|
||||
|
||||
#disable BT connection reattempt
|
||||
CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n
|
||||
|
||||
#enable lwip ipv6 autoconfig
|
||||
CONFIG_LWIP_IPV6_AUTOCONFIG=y
|
||||
|
||||
# Use a custom partition table
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0xC000
|
||||
|
||||
# Enable chip shell
|
||||
CONFIG_ENABLE_CHIP_SHELL=y
|
||||
|
||||
#enable lwIP route hooks
|
||||
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
|
||||
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y
|
||||
|
||||
# Button
|
||||
CONFIG_BUTTON_PERIOD_TIME_MS=20
|
||||
CONFIG_BUTTON_LONG_PRESS_TIME_MS=5000
|
||||
|
||||
# disable softap by default
|
||||
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n
|
||||
|
||||
# Disable DS Peripheral
|
||||
CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=n
|
||||
|
||||
# Use compact attribute storage mode
|
||||
CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y
|
||||
|
||||
# Enable HKDF in mbedtls
|
||||
CONFIG_MBEDTLS_HKDF_C=y
|
||||
|
||||
# Increase LwIP IPv6 address number to 6 (MAX_FABRIC + 1)
|
||||
# unique local addresses for fabrics(MAX_FABRIC), a link local address(1)
|
||||
CONFIG_LWIP_IPV6_NUM_ADDRESSES=6
|
||||
@@ -0,0 +1,164 @@
|
||||
# Bluetooth
|
||||
CONFIG_BT_ENABLED=y
|
||||
CONFIG_BT_NIMBLE_ENABLED=y
|
||||
## NimBLE Options
|
||||
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1
|
||||
CONFIG_BT_NIMBLE_MAX_BONDS=2
|
||||
CONFIG_BT_NIMBLE_MAX_CCCDS=2
|
||||
CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=3072
|
||||
CONFIG_BT_NIMBLE_ROLE_CENTRAL=n
|
||||
CONFIG_BT_NIMBLE_ROLE_OBSERVER=n
|
||||
CONFIG_BT_NIMBLE_MSYS_1_BLOCK_COUNT=10
|
||||
CONFIG_BT_NIMBLE_MSYS_1_BLOCK_SIZE=100
|
||||
CONFIG_BT_NIMBLE_MSYS_2_BLOCK_COUNT=4
|
||||
CONFIG_BT_NIMBLE_ACL_BUF_COUNT=5
|
||||
CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT=5
|
||||
CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT=3
|
||||
CONFIG_BT_NIMBLE_GATT_MAX_PROCS=1
|
||||
CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n
|
||||
CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT=n
|
||||
CONFIG_BT_NIMBLE_WHITELIST_SIZE=1
|
||||
## Controller Options
|
||||
CONFIG_BT_LE_CONTROLLER_TASK_STACK_SIZE=3072
|
||||
CONFIG_BT_LE_LL_RESOLV_LIST_SIZE=1
|
||||
CONFIG_BT_LE_LL_DUP_SCAN_LIST_COUNT=1
|
||||
|
||||
# SPI Configuration
|
||||
CONFIG_SPI_MASTER_ISR_IN_IRAM=n
|
||||
CONFIG_SPI_SLAVE_ISR_IN_IRAM=n
|
||||
|
||||
# Ethernet
|
||||
CONFIG_ETH_USE_SPI_ETHERNET=n
|
||||
|
||||
# Event Loop Library
|
||||
CONFIG_ESP_EVENT_POST_FROM_ISR=n
|
||||
|
||||
# Chip revision
|
||||
CONFIG_ESP32C2_REV2_DEVELOPMENT=y
|
||||
|
||||
# ESP Ringbuf
|
||||
CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
|
||||
CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH=y
|
||||
|
||||
# ESP System Settings
|
||||
CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=16
|
||||
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2048
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE=3072
|
||||
|
||||
## Memory protection
|
||||
CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=n
|
||||
|
||||
# High resolution timer (esp_timer)
|
||||
CONFIG_ESP_TIMER_TASK_STACK_SIZE=2048
|
||||
|
||||
# Wi-Fi
|
||||
CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=n
|
||||
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=3
|
||||
CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=6
|
||||
CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=6
|
||||
CONFIG_ESP32_WIFI_IRAM_OPT=n
|
||||
CONFIG_ESP32_WIFI_RX_IRAM_OPT=n
|
||||
CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=n
|
||||
CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=n
|
||||
CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=n
|
||||
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n
|
||||
|
||||
# FreeRTOS
|
||||
## Kernel
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
|
||||
## Port
|
||||
CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=n
|
||||
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
|
||||
CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y
|
||||
|
||||
# Hardware Abstraction Layer (HAL) and Low Level (LL)
|
||||
CONFIG_HAL_ASSERTION_DISABLE=y
|
||||
|
||||
# LWIP
|
||||
CONFIG_LWIP_MAX_SOCKETS=5
|
||||
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=16
|
||||
CONFIG_LWIP_DHCPS=n
|
||||
CONFIG_LWIP_IPV6_AUTOCONFIG=y
|
||||
CONFIG_LWIP_MAX_ACTIVE_TCP=5
|
||||
CONFIG_LWIP_MAX_LISTENING_TCP=5
|
||||
CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=n
|
||||
CONFIG_LWIP_TCP_SYNMAXRTX=12
|
||||
CONFIG_LWIP_TCP_MSL=40000
|
||||
CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=16000
|
||||
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=4096
|
||||
CONFIG_LWIP_TCP_WND_DEFAULT=2440
|
||||
CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS=y
|
||||
CONFIG_LWIP_TCP_RTO_TIME=1500
|
||||
CONFIG_LWIP_MAX_UDP_PCBS=8
|
||||
CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=2560
|
||||
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
|
||||
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y
|
||||
|
||||
# mbedTLS
|
||||
CONFIG_MBEDTLS_DYNAMIC_BUFFER=y
|
||||
CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y
|
||||
CONFIG_MBEDTLS_DYNAMIC_FREE_CA_CERT=y
|
||||
CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH=y
|
||||
CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=n
|
||||
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y
|
||||
CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y
|
||||
CONFIG_MBEDTLS_SSL_PROTO_SSL3=n
|
||||
CONFIG_MBEDTLS_SSL_PROTO_TLS1=n
|
||||
CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=n
|
||||
|
||||
# ESP-MQTT Configurations
|
||||
CONFIG_MQTT_PROTOCOL_311=n
|
||||
|
||||
# Protocomm
|
||||
CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=n
|
||||
CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=n
|
||||
|
||||
# SPI Flash driver
|
||||
CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=n
|
||||
CONFIG_SPI_FLASH_ROM_IMPL=y
|
||||
|
||||
# Websocket
|
||||
CONFIG_WS_TRANSPORT=n
|
||||
|
||||
# Virtual file system
|
||||
CONFIG_VFS_SUPPORT_DIR=n
|
||||
CONFIG_VFS_SUPPORT_SELECT=n
|
||||
CONFIG_VFS_SUPPORT_TERMIOS=n
|
||||
|
||||
# Wear Levelling
|
||||
CONFIG_WL_SECTOR_SIZE_512=y
|
||||
|
||||
# CHIP Core
|
||||
## General Options
|
||||
CONFIG_MAX_EXCHANGE_CONTEXTS=6
|
||||
CONFIG_MAX_BINDINGS=6
|
||||
CONFIG_MAX_PEER_NODES=12
|
||||
CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS=6
|
||||
CONFIG_ENABLE_CHIP_SHELL=n
|
||||
CONFIG_DISABLE_IPV4=y
|
||||
CONFIG_BUILD_CHIP_TESTS=n
|
||||
## Networking Options
|
||||
CONFIG_NUM_TCP_ENDPOINTS=1
|
||||
CONFIG_NUM_UDP_ENDPOINTS=6
|
||||
## System Options
|
||||
CONFIG_NUM_TIMERS=24
|
||||
CONFIG_ENABLE_OTA_REQUESTOR=y
|
||||
|
||||
# CHIP Device Layer
|
||||
## General Options
|
||||
CONFIG_CHIP_TASK_STACK_SIZE=6144
|
||||
CONFIG_MAX_EVENT_QUEUE_SIZE=20
|
||||
## Event Logging Options
|
||||
CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE=256
|
||||
CONFIG_EVENT_LOGGING_INFO_BUFFER_SIZE=256
|
||||
CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE=256
|
||||
|
||||
# ESP Matter
|
||||
CONFIG_ESP_MATTER_MAX_DEVICE_TYPE_COUNT=4
|
||||
CONFIG_ESP_MATTER_MAX_DYNAMIC_ENDPOINT_COUNT=4
|
||||
|
||||
# CMake Utilities
|
||||
CONFIG_CU_RELINKER_ENABLE=y
|
||||
CONFIG_CU_RELINKER_ENABLE_CUSTOMIZED_CONFIGURATION_FILES=y
|
||||
CONFIG_CU_RELINKER_CUSTOMIZED_CONFIGURATION_FILES_PATH="../common/relinker/esp32c2"
|
||||
@@ -0,0 +1,40 @@
|
||||
CONFIG_IDF_TARGET="esp32c6"
|
||||
|
||||
# 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
|
||||
|
||||
# FreeRTOS should use legacy API
|
||||
CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y
|
||||
|
||||
# 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_thread.csv"
|
||||
|
||||
# Use minimal mDNS
|
||||
CONFIG_USE_MINIMAL_MDNS=y
|
||||
CONFIG_ENABLE_EXTENDED_DISCOVERY=y
|
||||
|
||||
# Enable OTA Requestor
|
||||
CONFIG_ENABLE_OTA_REQUESTOR=y
|
||||
|
||||
# Disable AP
|
||||
CONFIG_ENABLE_WIFI_STATION=y
|
||||
CONFIG_ENABLE_WIFI_AP=n
|
||||
|
||||
# Button
|
||||
CONFIG_BUTTON_PERIOD_TIME_MS=20
|
||||
CONFIG_BUTTON_LONG_PRESS_TIME_MS=5000
|
||||
|
||||
# Enable chip shell
|
||||
CONFIG_ENABLE_CHIP_SHELL=y
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
CONFIG_IDF_TARGET="esp32h2"
|
||||
|
||||
# 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
|
||||
|
||||
# FreeRTOS should use legacy API
|
||||
CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y
|
||||
|
||||
# Enable OpenThread
|
||||
CONFIG_OPENTHREAD_ENABLED=y
|
||||
CONFIG_OPENTHREAD_SRP_CLIENT=y
|
||||
CONFIG_OPENTHREAD_DNS_CLIENT=y
|
||||
CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC=n
|
||||
CONFIG_OPENTHREAD_LOG_LEVEL_NOTE=y
|
||||
CONFIG_OPENTHREAD_CLI=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_thread.csv"
|
||||
|
||||
# LwIP config for OpenThread
|
||||
CONFIG_LWIP_IPV6_NUM_ADDRESSES=8
|
||||
CONFIG_LWIP_MULTICAST_PING=y
|
||||
|
||||
# MDNS platform
|
||||
CONFIG_USE_MINIMAL_MDNS=n
|
||||
CONFIG_ENABLE_EXTENDED_DISCOVERY=y
|
||||
|
||||
# Enable OTA Requestor
|
||||
CONFIG_ENABLE_OTA_REQUESTOR=y
|
||||
|
||||
# Disable STA and AP for ESP32H2
|
||||
CONFIG_ENABLE_WIFI_STATION=n
|
||||
CONFIG_ENABLE_WIFI_AP=n
|
||||
|
||||
# Button
|
||||
CONFIG_BUTTON_PERIOD_TIME_MS=20
|
||||
CONFIG_BUTTON_LONG_PRESS_TIME_MS=5000
|
||||
|
||||
# Enable chip shell
|
||||
CONFIG_ENABLE_CHIP_SHELL=y
|
||||
|
||||
# Enable DS Peripheral
|
||||
CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=y
|
||||
@@ -0,0 +1,51 @@
|
||||
# Default to 921600 baud when flashing and monitoring device
|
||||
CONFIG_ESPTOOLPY_BAUD_921600B=y
|
||||
CONFIG_ESPTOOLPY_BAUD=921600
|
||||
CONFIG_ESPTOOLPY_COMPRESSED=y
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||
|
||||
#enable BT
|
||||
CONFIG_BT_ENABLED=y
|
||||
CONFIG_BT_NIMBLE_ENABLED=y
|
||||
|
||||
#disable BT connection reattempt
|
||||
CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n
|
||||
|
||||
#enable lwip ipv6 autoconfig
|
||||
CONFIG_LWIP_IPV6_AUTOCONFIG=y
|
||||
|
||||
# Use a custom partition table
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
|
||||
# Disable chip shell
|
||||
CONFIG_ENABLE_CHIP_SHELL=n
|
||||
|
||||
# Disable chip tests
|
||||
CONFIG_BUILD_CHIP_TESTS=n
|
||||
|
||||
#enable lwIP route hooks
|
||||
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
|
||||
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y
|
||||
|
||||
# Button
|
||||
CONFIG_BUTTON_PERIOD_TIME_MS=20
|
||||
CONFIG_BUTTON_LONG_PRESS_TIME_MS=5000
|
||||
|
||||
# External Platform
|
||||
CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM=y
|
||||
CONFIG_CHIP_EXTERNAL_PLATFORM_DIR="../../../../../platform/ESP32_custom"
|
||||
|
||||
# disable softap by default
|
||||
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n
|
||||
|
||||
# Disable DS Peripheral
|
||||
CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=n
|
||||
|
||||
# Use compact attribute storage mode
|
||||
CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y
|
||||
|
||||
# Enable HKDF in mbedtls
|
||||
CONFIG_MBEDTLS_HKDF_C=y
|
||||
Reference in New Issue
Block a user