Skip to content

Commit 2779f20

Browse files
authored
Update matter example (#152)
1 parent 7577d49 commit 2779f20

15 files changed

+564
-838
lines changed
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
cmake_minimum_required(VERSION 3.16.0)
2-
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
1+
# The following lines of boilerplate have to be in your project's
2+
# CMakeLists in this exact order for cmake to work correctly
3+
cmake_minimum_required(VERSION 3.5)
4+
35
set(PROJECT_VER "1.0")
46
set(PROJECT_VER_NUMBER 1)
57

6-
project(matter-light)
8+
# This should be done before using the IDF_TARGET variable.
9+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
710

11+
idf_build_set_property(MINIMAL_BUILD ON)
12+
project(arduino_managed_component_light)
813

914
# WARNING: This is just an example for using key for decrypting the encrypted OTA image
1015
# Please do not use it as is.
@@ -16,8 +21,8 @@ if(CONFIG_IDF_TARGET_ESP32C2)
1621
include(relinker)
1722
endif()
1823

19-
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H" APPEND)
24+
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++2a;-Os;-DCHIP_HAVE_CONFIG_H" APPEND)
2025
idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND)
2126
# For RISCV chips, project_include.cmake sets -Wno-format, but does not clear various
2227
# flags that depend on -Wformat
23-
idf_build_set_property(COMPILE_OPTIONS "-Wno-format-nonliteral;-Wno-format-security" APPEND)
28+
idf_build_set_property(COMPILE_OPTIONS "-Wno-format-nonliteral;-Wno-format-security" APPEND)

examples/espidf-arduino-matter-light/README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
| Supported Targets | ESP32-S3 | ESP32-C3 | ESP32-C6 |
2-
| ----------------- | -------- | -------- | -------- |
1+
| Supported Targets | ESP32-C3 | ESP32-C6 |
2+
| ----------------- | -------- | -------- |
33

44

55
# Managed Component Light
66

7-
This example is configured by default to work with the ESP32-S3, which has the RGB LED GPIO set as pin 48 and the BOOT button on GPIO 0.
7+
This example is configured by default to work with the ESP32-C6, which has the RGB LED GPIO set as pin 8 and the BOOT button on GPIO 9.
88

9-
This example creates a Color Temperature Light device using the esp_matter component downloaded from the [Espressif Component Registry](https://components.espressif.com/) instead of an extra component locally, so the example can work without setting up the esp-matter environment.
10-
11-
See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html) for more information about building and flashing the firmware.
9+
This example creates a Color Temperature Light device using the esp_matter component automatically downloaded from the [Espressif Component Registry](https://components.espressif.com/). See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html) for more information about matter.
1210

1311
The code is based on the Arduino API and uses Arduino as an IDF Component.
1412

@@ -27,8 +25,8 @@ There is no QR Code to be used when the Smartphone APP wants to add the Matter D
2725
Please enter the code manually: `34970112332`
2826

2927
The devboard has a built-in LED that will be used as the Matter Light.
30-
The default setting of the code uses pin 48 for the ESP32-S3.
31-
Please change it in `main/matter_accessory_driver.h` or in the `sdkconfig.defaults.<SOC>` file.
28+
The default setting of the code uses pin 8 for the ESP32-C6,
29+
Please change it in `main/matter_accessory_driver.h` or in the `sdkconfig.defaults` file.
3230

3331
## LED Status and Factory Mode
3432

@@ -53,9 +51,9 @@ Holding the BOOT button pressed for more than 10 seconds and then releasing it w
5351

5452
## Building the Application using WiFi and Matter
5553

56-
This example has been tested with Arduino Core 3.0.4. It should work with newer versions too.
54+
This example has been tested with Arduino Core 3.2.0. It should work with newer versions too.
5755

58-
There is a configuration file for these SoC: esp32s3, esp32c3, esp32c6.
56+
There is a configuration file for these SoCs: esp32c3, esp32c6.
5957
Those are the tested devices that have a WS2812 RGB LED and can run BLE, WiFi and Matter.
6058

6159
In case it is necessary to change the Button Pin or the REG LED Pin, please use the `menuconfig` and change the Menu Option `Light Matter Accessory`

examples/espidf-arduino-matter-light/main/Kconfig.projbuild

Lines changed: 18 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -3,100 +3,40 @@ menu "Light Matter Accessory"
33
config BUTTON_PIN
44
int
55
prompt "Button 1 GPIO"
6-
default ENV_GPIO_BOOT_BUTTON
6+
default 9 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C6
7+
default 0
78
range -1 ENV_GPIO_IN_RANGE_MAX
89
help
910
The GPIO pin for button that will be used to turn on/off the Matter Light. It shall be connected to a push button. It can use the BOOT button of the development board.
1011
endmenu
1112

12-
1313
menu "LEDs"
1414
config WS2812_PIN
1515
int
1616
prompt "WS2812 RGB LED GPIO"
17-
default ENV_GPIO_RGB_LED
17+
default 8 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C6
18+
default 48
1819
range -1 ENV_GPIO_OUT_RANGE_MAX
1920
help
2021
The GPIO pin for the Matter Light that will be driven by RMT. It shall be connected to one single WS2812 RGB LED.
2122
endmenu
2223

23-
# TARGET CONFIGURATION
24-
if IDF_TARGET_ESP32C3
25-
config ENV_GPIO_RANGE_MIN
26-
int
27-
default 0
28-
29-
config ENV_GPIO_RANGE_MAX
30-
int
31-
default 19
32-
# GPIOs 20/21 are always used by UART in examples
33-
34-
config ENV_GPIO_IN_RANGE_MAX
35-
int
36-
default ENV_GPIO_RANGE_MAX
37-
38-
config ENV_GPIO_OUT_RANGE_MAX
39-
int
40-
default ENV_GPIO_RANGE_MAX
41-
42-
config ENV_GPIO_BOOT_BUTTON
43-
int
44-
default 9
45-
46-
config ENV_GPIO_RGB_LED
47-
int
48-
default 8
49-
endif
50-
if IDF_TARGET_ESP32C6
51-
config ENV_GPIO_RANGE_MIN
52-
int
53-
default 0
24+
config ENV_GPIO_RANGE_MIN
25+
int
26+
default 0
5427

55-
config ENV_GPIO_RANGE_MAX
56-
int
57-
default 30
58-
# GPIOs 16/17 are always used by UART in examples
28+
config ENV_GPIO_RANGE_MAX
29+
int
30+
default 19 if IDF_TARGET_ESP32C3
31+
default 30 if IDF_TARGET_ESP32C6
32+
default 48
5933

60-
config ENV_GPIO_IN_RANGE_MAX
61-
int
62-
default ENV_GPIO_RANGE_MAX
34+
config ENV_GPIO_IN_RANGE_MAX
35+
int
36+
default ENV_GPIO_RANGE_MAX
6337

64-
config ENV_GPIO_OUT_RANGE_MAX
65-
int
66-
default ENV_GPIO_RANGE_MAX
67-
68-
config ENV_GPIO_BOOT_BUTTON
69-
int
70-
default 9
71-
72-
config ENV_GPIO_RGB_LED
73-
int
74-
default 8
75-
endif
76-
if IDF_TARGET_ESP32S3
77-
config ENV_GPIO_RANGE_MIN
78-
int
79-
default 0
80-
81-
config ENV_GPIO_RANGE_MAX
82-
int
83-
default 48
84-
85-
config ENV_GPIO_IN_RANGE_MAX
86-
int
87-
default ENV_GPIO_RANGE_MAX
88-
89-
config ENV_GPIO_OUT_RANGE_MAX
90-
int
91-
default ENV_GPIO_RANGE_MAX
92-
93-
config ENV_GPIO_BOOT_BUTTON
94-
int
95-
default 0
96-
97-
config ENV_GPIO_RGB_LED
98-
int
99-
default 48
100-
endif
38+
config ENV_GPIO_OUT_RANGE_MAX
39+
int
40+
default ENV_GPIO_RANGE_MAX
10141

10242
endmenu

0 commit comments

Comments
 (0)