diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 47c702a94..9e8ed51db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -164,7 +164,6 @@ variables: before_script: - *add_gitlab_ssh_key - *get_build_caches - - *chip_submodule_update - *setup_idf - cd ${ESP_MATTER_PATH} - mkdir -p ${REPOS_PATH} @@ -361,7 +360,7 @@ build_upstream_examples: build_managed_component_light: extends: - .build_managed_component_light_example - when: manual + when: always script: - cd ${ESP_MATTER_PATH}/examples/managed_component_light - idf.py set-target esp32c3 diff --git a/docs/en/developing.rst b/docs/en/developing.rst index 593bad8a0..e52f08dd7 100644 --- a/docs/en/developing.rst +++ b/docs/en/developing.rst @@ -4,11 +4,10 @@ Please refer the :project_file:`Release Notes ` to know more about the releases -2.1 Development Setup +2.1 ESP-IDF Setup --------------------- -This section talks about setting up your development host, fetching the -Git repositories, and instructions to build and flash. +This section talks about setting up ESP-IDF. 2.1.1 Host Setup ~~~~~~~~~~~~~~~~ @@ -46,20 +45,17 @@ For using VSCode for development, please check `Developing in WSL -2.1.2 Getting the Repositories +2.1.2 Getting the Repository ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Before cloning the repositories please confirm that the following Prerequisites are fulfilled. -The Prerequisites for ESP-IDF and Matter: +The Prerequisites for ESP-IDF: - Please get the `Prerequisites for ESP-IDF`_. For beginners, please check `step by step installation guide`_ for esp-idf. -- Please get the `Prerequisites for Matter`_. .. note:: ``git clone`` command accepts the optional argument ``--jobs N``, which can significantly speed up the process by parallelizing submodule cloning. Consider using this option when cloning repositories. - It is also applicable when using ``./scripts/checkout_submodules.py`` to clone Matter submodules. Cloning esp-idf: @@ -70,6 +66,35 @@ Cloning esp-idf: ./install.sh cd .. + +2.1.3 Configuring the Environment +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This should be done each time a new terminal is opened + +:: + + cd esp-idf; source ./export.sh; cd .. + + +2.2 ESP Matter Setup +-------------------- + +There are two options to setup esp-matter, you can select one according to demand: + +- ESP matter repository, including esp-matter SDK and tools (e.g., CHIP-tool, CHIP-cert, ZAP, ...). +- ESP matter component, including esp-matter SDK. + +2.2.1 ESP-Matter Repository +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +2.2.1.1 Getting the Repository +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The Prerequisites for Matter: + +- Please get the `Prerequisites for Matter`_. + Cloning the esp-matter repository takes a while due to a lot of submodules in the upstream connectedhomeip, so if you want to do a shallow clone use the following command: @@ -139,8 +164,8 @@ To clone the esp-matter repository with all the submodules, use the following co It's probably caused by some network connectivity issue, a VPN is required for most of the cases. -2.1.3 Configuring the Environment -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +2.2.1.2 Configuring the Environment +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This should be done each time a new terminal is opened @@ -162,7 +187,27 @@ Ccache caches the previous compilations and speeds up recompilation in subsequen Above can also be added to your shell’s profile file (.profile, .bashrc, .zprofile, etc.) to enable ccache every time you open a new terminal. -2.1.4 Building Applications +2.2.2 ESP Matter Component (experimental) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can check the component in `Espressif Component Registry `__. + +To add the esp_matter component to your project, run: + +:: + + idf.py add-dependency "espressif/esp_matter^0.0.2" + +An example with esp_matter component is offered: + +- :project_file:`Managed Component Light ` + +.. note:: + + To use this component, the version of IDF component management should be 1.4.*. + Use ``compote version`` to show the version. Use ``pip install 'idf-component-manager~=1.4.0'`` to install. + +2.2.3 Building Applications ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :project_file:`Light ` @@ -171,7 +216,7 @@ to enable ccache every time you open a new terminal. - :project_file:`Zigbee Bridge ` - :project_file:`BLE Mesh Bridge ` -2.1.5 Flashing the Firmware +2.2.4 Flashing the Firmware ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Choose IDF target. @@ -254,7 +299,8 @@ Choose IDF target. pip install -r $IDF_PATH/requirements.txt -2.2 Commissioning and Control + +2.3 Commissioning and Control ----------------------------- There are a few implementations of Matter commissioners present in the `connectedhomeip `__ repository. @@ -263,7 +309,7 @@ CHIP Tool is an example implementation of Matter commissioner and used for devel Espressif also has an iOS application, `Espressif-Matter `__, to commission and control the Matter devices. Please follow `profile installation instructions `__ in order to use the application. Also, make sure to enable Developer Mode on the iOS. -2.2.1 Test Setup (CHIP Tool) +2.3.1 Test Setup (CHIP Tool) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A host-based chip-tool can be used as a commissioner to commission and control a Matter device. During the previous ``install.sh`` step, the ``chip-tool`` is generated under the folder: @@ -272,7 +318,7 @@ A host-based chip-tool can be used as a commissioner to commission and control a ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/out/host -2.2.1.1 Commissioning +2.3.1.1 Commissioning ^^^^^^^^^^^^^^^^^^^^^ Use ``chip-tool`` in interactive mode to commission the device: @@ -381,7 +427,7 @@ If you want to use different values for commissioning the device, please use the to generate the factory partition which has to be flashed on the device. It also generates the new pairing code and QR code image using which you can commission the device. -2.2.1.2 Post Commissioning Setup +2.3.1.2 Post Commissioning Setup ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The device would need additional configuration depending on the example, @@ -393,7 +439,7 @@ for it to work. Check the "Post Commissioning Setup" section in examples for mor - :project_file:`Zigbee Bridge ` - :project_file:`BLE Mesh Bridge ` -2.2.1.3 Cluster Control +2.3.1.3 Cluster Control ^^^^^^^^^^^^^^^^^^^^^^^ Use the cluster commands to control the attributes. @@ -426,7 +472,7 @@ chip-tool when used in interactive mode uses CASE resumption as against establis For more details on chip-tool usage, check https://github.com/espressif/connectedhomeip/tree/v1.0.0.2/examples/chip-tool -2.3 Device console +2.4 Device console ------------------ The console on the device can be used to run commands for testing. It is configurable through menuconfig and enabled by default in the firmware. Here are some useful commands: @@ -499,13 +545,13 @@ Additional Matter specific commands: matter esp wifi connect -2.4 Developing your Product +2.5 Developing your Product --------------------------- Understanding the structure before actually modifying and customising the device is helpful. -2.4.1 Building a Color Temperature Lightbulb +2.5.1 Building a Color Temperature Lightbulb ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A device is represented in Matter in terms of its data model. As a first @@ -515,7 +561,7 @@ can use. Please refer to the `Espressif Matter Blog `__ for clarity on the terms like endpoints, clusters, etc. that are used in this section. -2.4.1.1 Data Model +2.5.1.1 Data Model ^^^^^^^^^^^^^^^^^^ - Typically, the data model is defined in the example's *app_main.cpp*. @@ -543,7 +589,7 @@ for clarity on the terms like endpoints, clusters, etc. that are used in this se endpoints can be created on the same node. Check the following sections for more info. -2.4.1.2 Attribute Callback +2.5.1.2 Attribute Callback ^^^^^^^^^^^^^^^^^^^^^^^^^^ - Whenever a Matter client makes changes to the device, they end up @@ -571,7 +617,7 @@ for clarity on the terms like endpoints, clusters, etc. that are used in this se return err; } -2.4.1.3 Device Drivers +2.5.1.3 Device Drivers ^^^^^^^^^^^^^^^^^^^^^^ - The drivers, depending on the device, are typically initialized and @@ -631,13 +677,13 @@ for clarity on the terms like endpoints, clusters, etc. that are used in this se } -2.4.2 Defining your own data model +2.5.2 Defining your own data model ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This section demonstrates creating standard endpoints, clusters, attributes, and commands that are defined in the Matter specification -2.4.2.1 Endpoints +2.5.2.1 Endpoints ^^^^^^^^^^^^^^^^^ The device can be customized by editing the endpoint/device_type @@ -688,7 +734,7 @@ creating in the *app_main.cpp* of the example. Examples: Once a ``config_t`` instance has been instantiated, these three values cannot be modified. -2.4.2.2 Clusters +2.5.2.2 Clusters ^^^^^^^^^^^^^^^^ Additional clusters can also be added to an endpoint. Examples: @@ -729,7 +775,7 @@ Additional clusters can also be added to an endpoint. Examples: maximum pressure, maximum speed and maximum flow values. If they aren't set, they will be set to null by default. Once a ``config_t`` instance has been instantiated, these three values cannot be modified. -2.4.2.3 Attributes and Commands +2.5.2.3 Attributes and Commands ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Additional attributes and commands can also be added to a cluster. @@ -761,7 +807,7 @@ Examples: command_t *command = level_control::command::create_move_to_level(cluster); -2.4.2.4 Features +2.5.2.4 Features ^^^^^^^^^^^^^^^^^^ Optional features which are applicable to a cluster can also be added. @@ -772,14 +818,14 @@ Optional features which are applicable to a cluster can also be added. cluster_t* cluster = cluster::get(endpoint, Descriptor::Id); descriptor::feature::taglist::add(cluster); -2.4.3 Adding custom data model fields +2.5.3 Adding custom data model fields ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This section demonstrates creating custom endpoints, clusters, attributes, and commands that are not defined in the Matter specification and can be specific to the vendor. -2.4.3.1 Endpoints +2.5.3.1 Endpoints ^^^^^^^^^^^^^^^^^ Non-Standard endpoint can be created, without any clusters. @@ -790,7 +836,7 @@ Non-Standard endpoint can be created, without any clusters. endpoint_t *endpoint = endpoint::create(node, ENDPOINT_FLAG_NONE); -2.4.3.2 Clusters +2.5.3.2 Clusters ^^^^^^^^^^^^^^^^ Non-Standard/Custom clusters can also be created: @@ -802,7 +848,7 @@ Non-Standard/Custom clusters can also be created: uint32_t custom_cluster_id = 0x131bfc00; cluster_t *cluster = cluster::create(endpoint, custom_cluster_id, CLUSTER_FLAG_SERVER); -2.4.3.3 Attributes and Commands +2.5.3.3 Attributes and Commands ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Non-Standard/Custom attributes can also be created on any cluster: @@ -829,11 +875,11 @@ Non-Standard/Custom attributes can also be created on any cluster: uint32_t custom_command_id = 0x0; command_t *command = command::create(cluster, custom_command_id, COMMAND_FLAG_ACCEPTED, command_callback); -2.4.4 Advanced Setup +2.5.4 Advanced Setup ~~~~~~~~~~~~~~~~~~~~ This section explains adding external platforms for Matter. This step is **optional** for most devices. Espressif's SDK for Matter provides support for overriding the default platform layer, so the BLE and Wi-Fi implementations can be customized. Here are the required steps for adding an external platform layer. -2.4.4.1 Creating the external platform directory +2.5.4.1 Creating the external platform directory ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Create a directory ``platform/${NEW_PLATFORM_NAME}`` in your codebase. @@ -844,7 +890,7 @@ as a start. Note that the new platform name should be something other than directory must be under ``platform`` folder to meet the Matter include path conventions. -2.4.4.2 Modifying the BUILD.gn target +2.5.4.2 Modifying the BUILD.gn target ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ There is an example :project_file:`BUILD.gn ` file for @@ -856,7 +902,7 @@ platform in Matter without any modifications. - Multiple build configs must be exported to the build system. See the ``buildconfig_header`` section in the file for the required definitions. -2.4.4.3 Editing Kconfigs +2.5.4.3 Editing Kconfigs ^^^^^^^^^^^^^^^^^^^^^^^^ - Enable ``CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM``. @@ -877,7 +923,7 @@ platform in Matter without any modifications. - If your external platform does not support the *connectedhomeip/connectedhomeip/src/lib/shell/* provided in the Matter shell library, then disable ``CONFIG_ENABLE_CHIP_SHELL``. -2.4.4.4 Example Usage +2.5.4.4 Example Usage ^^^^^^^^^^^^^^^^^^^^^ As an example, you can build *light* example on ``ESP32_custom`` platform with following steps: @@ -891,10 +937,10 @@ As an example, you can build *light* example on ``ESP32_custom`` platform with f cp sdkconfig.defaults.ext_plat_ci sdkconfig.defaults idf.py build -2.5 Factory Data Providers +2.6 Factory Data Providers -------------------------- -2.5.1 Providers Introduction +2.6.1 Providers Introduction ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There are four factory data providers, each with its own implementation, that need to be configured. These providers supply the device with necessary factory data, which is then read by the device according to their respective implementations. @@ -914,7 +960,7 @@ There are four factory data providers, each with its own implementation, that ne This particular provider is responsible for retrieving device information, which includes fixed-labels, user-labels, supported-locales, and supported-calendar-types. -2.5.2 Configuration Options +2.6.2 Configuration Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Different implementations of the four providers can be chosen in meuconfig: @@ -956,15 +1002,15 @@ Different implementations of the four providers can be chosen in meuconfig: When selecting ``Device Info - Custom``, the device will use custom defined Device Info Provider to obtain the Device Information. ``esp_matter::set_custom_device_info_provider`` should be called before ``esp_matter::start()`` to set the custom provider. -2.5.3 Custom Providers +2.6.3 Custom Providers ~~~~~~~~~~~~~~~~~~~~~~ In order to use custom providers, you need to define implementations of the four base classes of the providers and override the functions within them. And the custom providers should be set before ``esp_matter::start()`` is called. -2.6 Using esp_secure_cert partition +2.7 Using esp_secure_cert partition ----------------------------------- -2.6.1 Configuration Options +2.7.1 Configuration Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Build the firmware with below configuration options @@ -984,7 +1030,7 @@ Build the firmware with below configuration options CONFIG_FACTORY_DEVICE_INSTANCE_INFO_PROVIDER=y -2.6.2 Certification Declaration +2.7.2 Certification Declaration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If you do not have an certification declaration file then you can generate the test CD with the help of below mentioned steps. @@ -1010,7 +1056,7 @@ For more info about the arguments, please check `here `__ in the connectedhomeip repository for generating a Matter OTA image and performing OTA. -2.7.1 Encrypted Matter OTA +2.8.1 Encrypted Matter OTA ~~~~~~~~~~~~~~~~~~~~~~~~~~ The esp-matter SDK supports using a pre-encrypted application image for OTA upgrades. @@ -1129,23 +1175,23 @@ Please follow the steps below to enable and use encrypted application images for file, or reading it from the NVS. We have demonstrated the use of the private key by embedding it as a text file in the light example. -2.8 Mode Select +2.9 Mode Select --------------- This cluster provides an interface for controlling a characteristic of a device that can be set to one of several predefined values. For example, the light pattern of a disco ball, the mode of a massage chair, or the wash cycle of a laundry machine. -2.8.1 Attribute Supported Modes +2.9.1 Attribute Supported Modes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This attribute is the list of supported modes that may be selected for the CurrentMode attribute. Each item in this list represents a unique mode as indicated by the Mode field of the ModeOptionStruct. Each entry in this list SHALL have a unique value for the Mode field. ESP_MATTER uses factory partition to set the values of Supported Modes attribute. -2.8.2 Generate Factory Partition Using mfg_tool +2.9.2 Generate Factory Partition Using mfg_tool ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Use `mfg_tool `__ to generate factory partition of the supported modes attribute. -2.8.2.1 Usage +2.9.2.1 Usage ^^^^^^^^^^^^^ :: @@ -1163,7 +1209,7 @@ Use `mfg_tool `__ to commission the device and send commands to the end-device. All of the controller commands begin with the prefix ``matter esp controller``. -2.9.2 Pairing commands -~~~~~~~~~~~~~~~~~~~~~~ +2.10.2 Pairing commands +~~~~~~~~~~~~~~~~~~~~~~~ The ``pairing`` commands are used for commissioning end-devices and are available when the ``Enable matter commissioner`` option is enabled. Here are three standard pairing methods: - Onnetwork pairing. Prior to executing this commissioning method, it is necessary to connect both the controller and the end-device to the same network and ensure that the commissioning window of the end-device is open. To complete this process, you can use the command ``matter esp wifi connect``. After the devices are connected, the pairing process can be initiated. @@ -1231,8 +1277,8 @@ The ``pairing`` commands are used for commissioning end-devices and are availabl matter esp wifi connect matter esp controller pairing ble-thread -2.9.3 Cluster commands -~~~~~~~~~~~~~~~~~~~~~~ +2.10.3 Cluster commands +~~~~~~~~~~~~~~~~~~~~~~~ The ``invoke-cmd`` command is used for sending cluster commands to the end-devices. It utilizes a ``cluster_command`` class to establish the sessions and send the command packets. The class constructor function could accept two callback inputs: - **Success callback**: @@ -1276,8 +1322,8 @@ Here are some examples of the ``command-data`` format. matter esp controller invoke-cmd 0x4 0 "{\"0:U16\": 1, \"1:STR\": \"grp1\"}" -2.9.4 Read commands -~~~~~~~~~~~~~~~~~~~ +2.10.4 Read commands +~~~~~~~~~~~~~~~~~~~~ The ``read_command`` class is used for sending read commands to other end-devices. Its constructor function could accept two callback inputs: - **Attribute report callback**: @@ -1286,8 +1332,8 @@ The ``read_command`` class is used for sending read commands to other end-device - **Event report callback**: This callback will be called upon the reception of the event report for read-event commands. -2.9.4.1 Read attribute commands -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2.10.4.1 Read attribute commands +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The ``read-attr`` commands are used for sending the commands of reading attributes on end-devices. - Send the read-attribute command: @@ -1296,8 +1342,8 @@ The ``read-attr`` commands are used for sending the commands of reading attribut matter esp controller read-attr -2.9.4.2 Read event commands -^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2.10.4.2 Read event commands +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The ``read-event`` commands are used for sending the commands of reading events on end-devices. - Send the read-event command: @@ -1306,8 +1352,8 @@ The ``read-event`` commands are used for sending the commands of reading events matter esp controller read-event -2.9.5 Write attribute commands -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +2.10.5 Write attribute commands +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``write-attr`` command is used for sending the commands of writing attributes on the end-device. - Send the write-attribute command: @@ -1342,8 +1388,8 @@ For ACL attribute of AccessControl cluster, you should use the following JSON st matter esp controller write-attr 31 0 "{\"0:ARR-OBJ\":[{\"1:U8\": 5, \"2:U8\": 2, \"3:ARR-U64\": [112233], \"4:NULL\": null}, {\"1:U8\": 4, \"2:U8\": 3, \"3:ARR-U64\": [1], \"4:NULL\": null}]}" -2.9.6 Subscribe commands -~~~~~~~~~~~~~~~~~~~~~~~~ +2.10.6 Subscribe commands +~~~~~~~~~~~~~~~~~~~~~~~~~ The ``subscribe_command`` class is used for sending subscribe commands to other end-devices. Its constructor function could accept four callback inputs: - **Attribute report callback**: @@ -1358,8 +1404,8 @@ The ``subscribe_command`` class is used for sending subscribe commands to other - **Subscribe failure callback**: This callback will be invoked upon the failure of establishing CASE session. -2.9.6.1 Subscribe attribute commands -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2.10.6.1 Subscribe attribute commands +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The ``subs-attr`` commands are used for sending the commands of subscribing attributes on end-devices. - Send the subscribe-attribute command: @@ -1368,8 +1414,8 @@ The ``subs-attr`` commands are used for sending the commands of subscribing attr matter esp controller subs-attr -2.9.6.2 Subscribe event commands -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2.10.6.2 Subscribe event commands +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The ``subs-event`` commands are used for sending the commands of subscribing events on end-devices. - Send the subscribe-event command: @@ -1378,8 +1424,8 @@ The ``subs-event`` commands are used for sending the commands of subscribing eve matter esp controller subs-event -2.9.7 Group settings commands -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +2.10.7 Group settings commands +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``group-settings`` commands are used to set group information of the controller. They are available when the ``Enable matter commissioner`` option is enabled in menuconfig. If the controller wants to send multicast commands to end-devices, it should be in the same group as the end-devices. - Set group information of the controller: @@ -1395,8 +1441,8 @@ The ``group-settings`` commands are used to set group information of the control matter esp controller group-settings bind-keyset matter esp controller group-settings unbind-keyset -2.9.8 Attestation Trust Storage -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +2.10.8 Attestation Trust Storage +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The controller example offers two options for the Attestation Trust Storage which is used to store and utilize the PAA certificates for the Device Attestation verification. This feature is available when the ``Enable matter commissioner`` option is enabled in menuconfig. You can modify this setting in menuconfig ``Components`` -> ``ESP Matter Controller`` -> ``Attestation Trust Store`` - ``Attestation Trust Store - Test`` diff --git a/examples/.build-rules.yml b/examples/.build-rules.yml index b92eba669..ffe6a94da 100644 --- a/examples/.build-rules.yml +++ b/examples/.build-rules.yml @@ -86,3 +86,9 @@ examples/demo/badge: - if: IDF_TARGET in ["esp32"] temporary: true reason: the other targets are not tested yet + +examples/managed_component_light: + enable: + - if: IDF_TARGET in [""] + temporary: true + reason: this should be compiled without setting up environment, another CI has been added diff --git a/examples/managed_component_light/CMakeLists.txt b/examples/managed_component_light/CMakeLists.txt new file mode 100644 index 000000000..ec0fa29af --- /dev/null +++ b/examples/managed_component_light/CMakeLists.txt @@ -0,0 +1,31 @@ +# 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) + +set(PROJECT_VER "1.0") +set(PROJECT_VER_NUMBER 1) + +# This should be done before using the IDF_TARGET variable. +include($ENV{IDF_PATH}/tools/cmake/project.cmake) + +set(EXTRA_COMPONENT_DIRS + "../common/app_reset" + ${extra_components_dirs_append}) + +project(managed_component_light) + +# 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(light.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++17;-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) diff --git a/examples/managed_component_light/README.md b/examples/managed_component_light/README.md new file mode 100644 index 000000000..c7f0303fc --- /dev/null +++ b/examples/managed_component_light/README.md @@ -0,0 +1,8 @@ +# Managed Component Light + +This example creates a Color Temperature Light device using the esp_matter component downloaded from [Espressif Component Registry](https://components.espressif.com/) instead of the extra component in local, so the example can work without setting the esp-matter environment. + +// TODO: IDF-9801 +> Note: To prevent the hash problem during building, the version [IDF component management](https://docs.espressif.com/projects/idf-component-manager/en/latest/) should be 1.4.*. Use `compote version` to show the version. Use `pip install 'idf-component-manager~=1.4.0'` to install. + +See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html) for more information about building and flashing the firmware. diff --git a/examples/managed_component_light/main/CMakeLists.txt b/examples/managed_component_light/main/CMakeLists.txt new file mode 100644 index 000000000..b91d6b8e5 --- /dev/null +++ b/examples/managed_component_light/main/CMakeLists.txt @@ -0,0 +1,6 @@ +idf_component_register(SRC_DIRS "." + INCLUDE_DIRS "." + PRIV_INCLUDE_DIRS "../../common/utils") + +set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) +target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") \ No newline at end of file diff --git a/examples/managed_component_light/main/app_driver.cpp b/examples/managed_component_light/main/app_driver.cpp new file mode 100644 index 000000000..777850a78 --- /dev/null +++ b/examples/managed_component_light/main/app_driver.cpp @@ -0,0 +1,207 @@ +/* + 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 +#include +#include + +#include +#include "bsp/esp-bsp.h" + +#include +#include "sdkconfig.h" + +using namespace chip::app::Clusters; +using namespace esp_matter; + +static const char *TAG = "app_driver"; +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 CONFIG_BSP_LEDS_NUM > 0 + esp_err_t err = ESP_OK; + 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, "LED set power: %d", val->val.b); + return ESP_OK; +#endif +} + +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 CONFIG_BSP_LEDS_NUM > 0 + return led_indicator_set_brightness(handle, value); +#else + ESP_LOGI(TAG, "LED set brightness: %d", value); + return ESP_OK; +#endif +} + +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 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; +#endif +} + +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 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; +#endif +} + +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 CONFIG_BSP_LEDS_NUM > 0 + return led_indicator_set_color_temperature(handle, value); +#else + ESP_LOGI(TAG, "LED set temperature: %ld", value); + return ESP_OK; +#endif +} + +static void app_driver_button_toggle_cb(void *arg, void *data) +{ + ESP_LOGI(TAG, "Toggle button pressed"); + uint16_t endpoint_id = light_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 == light_endpoint_id) { + led_indicator_handle_t handle = (led_indicator_handle_t)driver_handle; + if (cluster_id == OnOff::Id) { + if (attribute_id == OnOff::Attributes::OnOff::Id) { + err = app_driver_light_set_power(handle, val); + } + } else if (cluster_id == LevelControl::Id) { + if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) { + err = app_driver_light_set_brightness(handle, val); + } + } else if (cluster_id == ColorControl::Id) { + if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { + err = app_driver_light_set_hue(handle, val); + } else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) { + err = app_driver_light_set_saturation(handle, val); + } else if (attribute_id == ColorControl::Attributes::ColorTemperatureMireds::Id) { + err = app_driver_light_set_temperature(handle, val); + } + } + } + return err; +} + +esp_err_t app_driver_light_set_defaults(uint16_t endpoint_id) +{ + esp_err_t err = ESP_OK; + void *priv_data = endpoint::get_priv_data(endpoint_id); + led_indicator_handle_t handle = (led_indicator_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 brightness */ + cluster = cluster::get(endpoint, LevelControl::Id); + attribute = attribute::get(cluster, LevelControl::Attributes::CurrentLevel::Id); + attribute::get_val(attribute, &val); + err |= app_driver_light_set_brightness(handle, &val); + + /* Setting color */ + cluster = cluster::get(endpoint, ColorControl::Id); + attribute = attribute::get(cluster, ColorControl::Attributes::ColorMode::Id); + attribute::get_val(attribute, &val); + if (val.val.u8 == (uint8_t)ColorControl::ColorMode::kCurrentHueAndCurrentSaturation) { + /* Setting hue */ + attribute = attribute::get(cluster, ColorControl::Attributes::CurrentHue::Id); + attribute::get_val(attribute, &val); + err |= app_driver_light_set_hue(handle, &val); + /* Setting saturation */ + attribute = attribute::get(cluster, ColorControl::Attributes::CurrentSaturation::Id); + attribute::get_val(attribute, &val); + err |= app_driver_light_set_saturation(handle, &val); + } else if (val.val.u8 == (uint8_t)ColorControl::ColorMode::kColorTemperature) { + /* Setting temperature */ + attribute = attribute::get(cluster, ColorControl::Attributes::ColorTemperatureMireds::Id); + attribute::get_val(attribute, &val); + err |= app_driver_light_set_temperature(handle, &val); + } else { + ESP_LOGE(TAG, "Color mode not supported"); + } + + /* Setting power */ + cluster = cluster::get(endpoint, OnOff::Id); + attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id); + attribute::get_val(attribute, &val); + err |= app_driver_light_set_power(handle, &val); + + return err; +} + +app_driver_handle_t app_driver_light_init() +{ +#if CONFIG_BSP_LEDS_NUM > 0 + /* Initialize led */ + 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]; +#else + return NULL; +#endif +} + +app_driver_handle_t app_driver_button_init() +{ + /* Initialize button */ + button_handle_t btns[BSP_BUTTON_NUM]; + ESP_ERROR_CHECK(bsp_iot_button_create(btns, NULL, BSP_BUTTON_NUM)); + ESP_ERROR_CHECK(iot_button_register_cb(btns[0], BUTTON_PRESS_DOWN, app_driver_button_toggle_cb, NULL)); + + return (app_driver_handle_t)btns[0]; +} diff --git a/examples/managed_component_light/main/app_main.cpp b/examples/managed_component_light/main/app_main.cpp new file mode 100644 index 000000000..1d61acb2b --- /dev/null +++ b/examples/managed_component_light/main/app_main.cpp @@ -0,0 +1,224 @@ +/* + 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 +#include +#include + +#include +#include +#include + +#include +#include +#include +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD +#include +#endif + +#include +#include + +static const char *TAG = "app_main"; +uint16_t light_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; + +#if CONFIG_ENABLE_ENCRYPTED_OTA +extern const char decryption_key_start[] asm("_binary_esp_image_encryption_key_pem_start"); +extern const char decryption_key_end[] asm("_binary_esp_image_encryption_key_pem_end"); + +static const char *s_decryption_key = decryption_key_start; +static const uint16_t s_decryption_key_len = decryption_key_end - decryption_key_start; +#endif // CONFIG_ENABLE_ENCRYPTED_OTA + +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; + + case chip::DeviceLayer::DeviceEventType::kBLEDeinitialized: + ESP_LOGI(TAG, "BLE deinitialized and memory reclaimed"); + break; + + default: + break; + } +} + +// This callback is invoked when clients interact with the Identify Cluster. +// In the callback implementation, an endpoint can identify itself. (e.g., by flashing an LED or light). +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; +} + +// This callback is called for every attribute update. The callback implementation shall +// handle the desired attributes and return an appropriate error code. If the attribute +// is not of your interest, please do not return an error code and strictly 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 light_handle = app_driver_light_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 handle can be used to add/modify other endpoints. + node_t *node = node::create(&node_config, app_attribute_update_cb, app_identification_cb); + ABORT_APP_ON_FAILURE(node != nullptr, ESP_LOGE(TAG, "Failed to create Matter node")); + + extended_color_light::config_t light_config; + light_config.on_off.on_off = DEFAULT_POWER; + light_config.on_off.lighting.start_up_on_off = nullptr; + light_config.level_control.current_level = DEFAULT_BRIGHTNESS; + light_config.level_control.lighting.start_up_current_level = DEFAULT_BRIGHTNESS; + light_config.color_control.color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; + light_config.color_control.enhanced_color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; + light_config.color_control.color_temperature.startup_color_temperature_mireds = nullptr; + + // endpoint handles can be used to add/modify clusters. + endpoint_t *endpoint = extended_color_light::create(node, &light_config, ENDPOINT_FLAG_NONE, light_handle); + ABORT_APP_ON_FAILURE(endpoint != nullptr, ESP_LOGE(TAG, "Failed to create extended color light endpoint")); + + light_endpoint_id = endpoint::get_id(endpoint); + ESP_LOGI(TAG, "Light created with endpoint_id %d", light_endpoint_id); + + /* Mark deferred persistence for some attributes that might be changed rapidly */ + cluster_t *level_control_cluster = cluster::get(endpoint, LevelControl::Id); + attribute_t *current_level_attribute = attribute::get(level_control_cluster, LevelControl::Attributes::CurrentLevel::Id); + attribute::set_deferred_persistence(current_level_attribute); + + cluster_t *color_control_cluster = cluster::get(endpoint, ColorControl::Id); + attribute_t *current_x_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::CurrentX::Id); + attribute::set_deferred_persistence(current_x_attribute); + attribute_t *current_y_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::CurrentY::Id); + attribute::set_deferred_persistence(current_y_attribute); + attribute_t *color_temp_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::ColorTemperatureMireds::Id); + attribute::set_deferred_persistence(color_temp_attribute); + +#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); + ABORT_APP_ON_FAILURE(err == ESP_OK, ESP_LOGE(TAG, "Failed to start Matter, err:%d", err)); + + /* Starting driver with default values */ + app_driver_light_set_defaults(light_endpoint_id); + +#if CONFIG_ENABLE_ENCRYPTED_OTA + err = esp_matter_ota_requestor_encrypted_init(s_decryption_key, s_decryption_key_len); + ABORT_APP_ON_FAILURE(err == ESP_OK, ESP_LOGE(TAG, "Failed to initialized the encrypted OTA, err: %d", err)); +#endif // CONFIG_ENABLE_ENCRYPTED_OTA + +#if CONFIG_ENABLE_CHIP_SHELL + esp_matter::console::diagnostics_register_commands(); + esp_matter::console::wifi_register_commands(); +#if CONFIG_OPENTHREAD_CLI + esp_matter::console::otcli_register_commands(); +#endif + esp_matter::console::init(); +#endif +} diff --git a/examples/managed_component_light/main/app_priv.h b/examples/managed_component_light/main/app_priv.h new file mode 100644 index 000000000..7844ce5bc --- /dev/null +++ b/examples/managed_component_light/main/app_priv.h @@ -0,0 +1,98 @@ +/* + 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 +#include + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD +#include "esp_openthread_types.h" +#endif + +/** Standard max values (used for remapping attributes) */ +#define STANDARD_BRIGHTNESS 255 +#define STANDARD_HUE 360 +#define STANDARD_SATURATION 255 +#define STANDARD_TEMPERATURE_FACTOR 1000000 + +/** Matter max values (used for remapping attributes) */ +#define MATTER_BRIGHTNESS 254 +#define MATTER_HUE 254 +#define MATTER_SATURATION 254 +#define MATTER_TEMPERATURE_FACTOR 1000000 + +/** Default attribute values used during initialization */ +#define DEFAULT_POWER true +#define DEFAULT_BRIGHTNESS 64 +#define DEFAULT_HUE 128 +#define DEFAULT_SATURATION 254 + +typedef void *app_driver_handle_t; + +/** Initialize the light driver + * + * This initializes the light driver associated with the selected board. + * + * @return Handle on success. + * @return NULL in case of failure. + */ +app_driver_handle_t app_driver_light_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 light 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_light_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 = "nvs", .netif_queue_size = 10, .task_queue_size = 10, \ + } +#endif diff --git a/examples/managed_component_light/main/idf_component.yml b/examples/managed_component_light/main/idf_component.yml new file mode 100644 index 000000000..bf6c9ddae --- /dev/null +++ b/examples/managed_component_light/main/idf_component.yml @@ -0,0 +1,10 @@ +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]" + esp_bsp_generic: + version: "^1.1.0" + espressif/esp_matter: + version: "^0.0.2" \ No newline at end of file diff --git a/examples/managed_component_light/partitions.csv b/examples/managed_component_light/partitions.csv new file mode 100644 index 000000000..ffe5f242e --- /dev/null +++ b/examples/managed_component_light/partitions.csv @@ -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, 0xC000, +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 diff --git a/examples/managed_component_light/sdkconfig.defaults b/examples/managed_component_light/sdkconfig.defaults new file mode 100644 index 000000000..4dd60fc42 --- /dev/null +++ b/examples/managed_component_light/sdkconfig.defaults @@ -0,0 +1,58 @@ +# 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 + +# ESP32-DevKitC 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 diff --git a/examples/managed_component_light/sdkconfig.defaults.c6_thread b/examples/managed_component_light/sdkconfig.defaults.c6_thread new file mode 100644 index 000000000..0c65765db --- /dev/null +++ b/examples/managed_component_light/sdkconfig.defaults.c6_thread @@ -0,0 +1,51 @@ +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 + +# 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.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 ESP32C6 +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 diff --git a/examples/managed_component_light/sdkconfig.defaults.esp32c2 b/examples/managed_component_light/sdkconfig.defaults.esp32c2 new file mode 100644 index 000000000..125c77e0f --- /dev/null +++ b/examples/managed_component_light/sdkconfig.defaults.esp32c2 @@ -0,0 +1,181 @@ +# 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 + +# Release BT IRAM memory +CONFIG_BT_RELEASE_IRAM=y + +# 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" + +# ESP32-C2-DevKitM-1 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=1 +CONFIG_BSP_LED_TYPE_RGB_CLASSIC=y +CONFIG_BSP_LED_RGB_RED_GPIO=0 +CONFIG_BSP_LED_RGB_GREEN_GPIO=1 +CONFIG_BSP_LED_RGB_BLUE_GPIO=8 + diff --git a/examples/managed_component_light/sdkconfig.defaults.esp32c3 b/examples/managed_component_light/sdkconfig.defaults.esp32c3 new file mode 100644 index 000000000..1c873a0cf --- /dev/null +++ b/examples/managed_component_light/sdkconfig.defaults.esp32c3 @@ -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 + diff --git a/examples/managed_component_light/sdkconfig.defaults.esp32c6 b/examples/managed_component_light/sdkconfig.defaults.esp32c6 new file mode 100644 index 000000000..abc81be82 --- /dev/null +++ b/examples/managed_component_light/sdkconfig.defaults.esp32c6 @@ -0,0 +1,52 @@ +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=y + +# FreeRTOS should use legacy API +CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y + +# Disable lwip ipv6 autoconfig +CONFIG_LWIP_IPV6_AUTOCONFIG=y + +# Use a custom partition table +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.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 + +# ESP32-C6-DevKitM-1 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 + diff --git a/examples/managed_component_light/sdkconfig.defaults.esp32h2 b/examples/managed_component_light/sdkconfig.defaults.esp32h2 new file mode 100644 index 000000000..8e60916dc --- /dev/null +++ b/examples/managed_component_light/sdkconfig.defaults.esp32h2 @@ -0,0 +1,67 @@ +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.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 + +# ESP32-H2-DevKitM-1 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 diff --git a/examples/managed_component_light/sdkconfig.defaults.esp32s2 b/examples/managed_component_light/sdkconfig.defaults.esp32s2 new file mode 100644 index 000000000..cfab47266 --- /dev/null +++ b/examples/managed_component_light/sdkconfig.defaults.esp32s2 @@ -0,0 +1,40 @@ +# 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 lwip ipv6 autoconfig +CONFIG_LWIP_IPV6_AUTOCONFIG=y + +# Use a custom partition table +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" + +# 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 BLE +CONFIG_ENABLE_CHIPOBLE=n + +# ESP32-S2-DevKitM-1 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=1 +CONFIG_BSP_LED_TYPE_RGB=y +CONFIG_BSP_LED_RGB_GPIO=18 +CONFIG_BSP_LED_RGB_BACKEND_RMT=y diff --git a/examples/managed_component_light/sdkconfig.defaults.esp32s3 b/examples/managed_component_light/sdkconfig.defaults.esp32s3 new file mode 100644 index 000000000..111eb7ebd --- /dev/null +++ b/examples/managed_component_light/sdkconfig.defaults.esp32s3 @@ -0,0 +1,53 @@ +#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 + +# ESP32-S3-DevKitC-1 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=1 +CONFIG_BSP_LED_TYPE_RGB=y +CONFIG_BSP_LED_RGB_GPIO=48 +CONFIG_BSP_LED_RGB_BACKEND_RMT=y diff --git a/examples/managed_component_light/sdkconfig.defaults.ext_plat_ci b/examples/managed_component_light/sdkconfig.defaults.ext_plat_ci new file mode 100644 index 000000000..e03657152 --- /dev/null +++ b/examples/managed_component_light/sdkconfig.defaults.ext_plat_ci @@ -0,0 +1,61 @@ +# 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" +CONFIG_CHIP_EXTERNAL_PLATFORM_INCLUDE_DIR="../../../../.." + +# 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 + +# 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 \ No newline at end of file