mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'feature/move_drivers_components_to_examples_common' into 'main'
Move drivers components to device_hal See merge request app-frameworks/esp-matter!29
This commit is contained in:
@@ -33,11 +33,15 @@ variables:
|
||||
|
||||
.build_examples: &build_examples
|
||||
- cd $ESP_MATTER_PATH/examples/light
|
||||
- idf.py set-target esp32
|
||||
- idf.py build
|
||||
- idf.py set-target esp32c3
|
||||
- idf.py build
|
||||
- cd $REPOS_PATH
|
||||
- git clone --depth 1 --single-branch --recursive https://github.com/espressif/esp-rainmaker.git
|
||||
- export ESP_RMAKER_PATH=$PWD/esp-rainmaker
|
||||
- cd $ESP_MATTER_PATH/examples/rainmaker_light
|
||||
- idf.py set-target esp32
|
||||
- idf.py build
|
||||
|
||||
build_esp_matter_examples:
|
||||
|
||||
@@ -43,18 +43,18 @@ $ export ESPPORT=/dev/cu.SLAB_USBtoUART (or /dev/ttyUSB0 or /dev/ttyUSB1 on Linu
|
||||
|
||||
### Building and Flashing the Firmware
|
||||
|
||||
Selecting board:
|
||||
Choose IDF target.
|
||||
```
|
||||
$ idf.py menuconfig
|
||||
idf.py set-target esp32c3 (or esp32 or other supported targets)
|
||||
```
|
||||
* menuconfig -> ESP Matter Board Selection -> Select the supported board
|
||||
* The boards here are dependent on the IDF_TARGET. If your board uses a different chip, set the correct target and try again.
|
||||
|
||||
* The default device for `esp32`/`esp32c3` is `esp32-devkit-c`/`esp32c3-devkit-m`. If you want to use another device, you can export `ESP_MATTER_DEVICE_PATH` after choosing correct target, e.g for `m5stack` device:
|
||||
```
|
||||
idf.py set-target esp32c3 (or esp32 or other supported targets)
|
||||
$ export ESP_MATTER_DEVICE_PATH=/path/to/esp_matter/device_hal/device/m5stack
|
||||
```
|
||||
* The other peripheral components like led_driver, button_driver, etc are selected based on the board selected.
|
||||
* The configuration of the peripheral components can be found in `esp-matter/components/board/<board_name>/board.c`.
|
||||
* If the board that you have is of a different revision, and is not working as expected, the GPIO and other configuration can be changed in the `board.c` file.
|
||||
* If the device that you have is of a different revision, and is not working as expected, you can create a new device and export your device path.
|
||||
* The other peripheral components like led_driver, button_driver, etc are selected based on the device selected.
|
||||
* The configuration of the peripheral components can be found in `$ESP_MATTER_DEVICE_PATH/esp_matter_device.cmake`.
|
||||
|
||||
Build and flash:
|
||||
```
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
idf_component_register(SRC_DIRS "${CONFIG_BOARD_NAME}"
|
||||
INCLUDE_DIRS include
|
||||
PRIV_REQUIRES button_driver led_driver)
|
||||
@@ -1,50 +0,0 @@
|
||||
menu "ESP Matter Board Selection"
|
||||
|
||||
choice BOARD_NAME
|
||||
prompt "Board Name"
|
||||
default BOARD_NAME_ESP32_DEVKIT_C if IDF_TARGET_ESP32
|
||||
default BOARD_NAME_ESP32C3_DEVKIT_M if IDF_TARGET_ESP32C3
|
||||
help
|
||||
Board name from esp-matter/components/board
|
||||
|
||||
config BOARD_NAME_ESP32_DEVKIT_C
|
||||
bool "ESP32-DevKitC"
|
||||
depends on IDF_TARGET_ESP32
|
||||
|
||||
config BOARD_NAME_ESP32C3_DEVKIT_M
|
||||
bool "ESP32-C3-DevKitM"
|
||||
depends on IDF_TARGET_ESP32C3
|
||||
|
||||
config BOARD_NAME_M5STACK
|
||||
bool "M5Stack"
|
||||
depends on IDF_TARGET_ESP32
|
||||
|
||||
config BOARD_NAME_HOLLOW
|
||||
bool "Hollow"
|
||||
endchoice
|
||||
|
||||
config TFT_PREDEFINED_DISPLAY_TYPE
|
||||
int
|
||||
range 0 5
|
||||
default 0 if BOARD_NAME_ESP32_DEVKIT_C || BOARD_NAME_ESP32C3_DEVKIT_M || BOARD_NAME_HOLLOW
|
||||
default 3 if BOARD_NAME_M5STACK
|
||||
|
||||
config BOARD_NAME
|
||||
string
|
||||
default "esp32_devkit_c" if BOARD_NAME_ESP32_DEVKIT_C
|
||||
default "esp32c3_devkit_m" if BOARD_NAME_ESP32C3_DEVKIT_M
|
||||
default "m5stack" if BOARD_NAME_M5STACK
|
||||
default "hollow" if BOARD_NAME_HOLLOW
|
||||
|
||||
config LED_DRIVER
|
||||
string
|
||||
default "gpio" if BOARD_NAME_ESP32_DEVKIT_C
|
||||
default "rmt" if BOARD_NAME_ESP32C3_DEVKIT_M
|
||||
default "vled" if BOARD_NAME_M5STACK
|
||||
default "hollow" if BOARD_NAME_HOLLOW
|
||||
|
||||
config BUTTON_DRIVER
|
||||
string
|
||||
default "hollow"
|
||||
|
||||
endmenu
|
||||
@@ -1,44 +0,0 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
#include <button_driver.h>
|
||||
|
||||
static const char *TAG = "board";
|
||||
|
||||
static esp_err_t board_led_init()
|
||||
{
|
||||
led_driver_config_t config = {
|
||||
.gpio = -1,
|
||||
.channel = -1,
|
||||
};
|
||||
return led_driver_init(&config);
|
||||
}
|
||||
|
||||
static esp_err_t board_button_init()
|
||||
{
|
||||
button_driver_config_t config = {
|
||||
.gpio = -1,
|
||||
};
|
||||
return button_driver_init(&config);
|
||||
}
|
||||
|
||||
esp_err_t board_init()
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing board");
|
||||
board_led_init();
|
||||
board_button_init();
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
idf_component_register(SRCS ${CONFIG_BUTTON_DRIVER}/button_driver.c
|
||||
INCLUDE_DIRS include)
|
||||
@@ -1,23 +0,0 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <button_driver.h>
|
||||
|
||||
static const char *TAG = "button_driver_no_button";
|
||||
|
||||
esp_err_t button_driver_init(button_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing button driver");
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
set(priv_requires_list )
|
||||
|
||||
# Chip specific components. Try and remove this later.
|
||||
if(${IDF_TARGET} STREQUAL "esp32")
|
||||
list(APPEND priv_requires_list tft spidriver)
|
||||
elseif(${IDF_TARGET} STREQUAL "esp32c3")
|
||||
list(APPEND priv_requires_list led_strip)
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS ${CONFIG_LED_DRIVER}/led_driver.c color_format/color_format.c
|
||||
INCLUDE_DIRS include
|
||||
PRIV_REQUIRES ${priv_requires_list})
|
||||
@@ -1,73 +0,0 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <led_driver.h>
|
||||
|
||||
static const char *TAG = "led_driver_no_led";
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing led driver");
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_power(bool power)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_hue(uint16_t hue)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
bool led_driver_get_power()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_brightness()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t led_driver_get_hue()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_saturation()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t led_driver_get_temperature()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake)
|
||||
set(button_requires )
|
||||
idf_component_register(SRCS ${button_type}/button_driver.c
|
||||
INCLUDE_DIRS include
|
||||
REQUIRES ${button_requires})
|
||||
@@ -0,0 +1,4 @@
|
||||
include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake)
|
||||
idf_component_register(SRC_DIRS "${device_name}"
|
||||
INCLUDE_DIRS include
|
||||
PRIV_REQUIRES ${used_driver})
|
||||
+19
-12
@@ -13,29 +13,36 @@
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
#include <light_driver.h>
|
||||
#include <button_driver.h>
|
||||
|
||||
static const char *TAG = "board";
|
||||
#define DEVICE_VERSION_1_0
|
||||
|
||||
static esp_err_t board_led_init()
|
||||
#ifdef DEVICE_VERSION_1_0
|
||||
#define LED_GPIO_PIN 12 /* GPIO_NUM_12 */
|
||||
#define LED_CHANNEL 0 /* LEDC_CHANNEL_0 */
|
||||
#endif
|
||||
|
||||
static const char *TAG = "device";
|
||||
|
||||
static esp_err_t device_light_init()
|
||||
{
|
||||
led_driver_config_t config = {
|
||||
.gpio = 8, /* GPIO_NUM_8 */
|
||||
.channel = 0, /* RMT_CHANNEL_0 */
|
||||
light_driver_config_t config = {
|
||||
.gpio = LED_GPIO_PIN,
|
||||
.channel = LED_CHANNEL,
|
||||
};
|
||||
return led_driver_init(&config);
|
||||
return light_driver_init(&config);
|
||||
}
|
||||
|
||||
static esp_err_t board_button_init()
|
||||
static esp_err_t device_button_init()
|
||||
{
|
||||
return button_driver_init(NULL);
|
||||
}
|
||||
|
||||
esp_err_t board_init()
|
||||
esp_err_t device_init()
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing board");
|
||||
board_led_init();
|
||||
board_button_init();
|
||||
ESP_LOGI(TAG, "Initializing device");
|
||||
device_light_init();
|
||||
device_button_init();
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
if(NOT ("${IDF_TARGET}" STREQUAL "esp32" ))
|
||||
message(FATAL_ERROR "please set esp32 as the IDF_TARGET using 'idf.py set-target esp32'")
|
||||
endif()
|
||||
|
||||
SET(device_hal_path $ENV{ESP_MATTER_DEVICE_PATH}/../../)
|
||||
SET(device_name esp32_devkit_c)
|
||||
SET(light_type gpio)
|
||||
SET(button_type hollow)
|
||||
SET(used_driver light_driver button_driver)
|
||||
SET(extra_components_dirs_append "${device_hal_path}/light_driver"
|
||||
"${device_hal_path}/button_driver")
|
||||
|
||||
|
||||
+20
-12
@@ -13,29 +13,37 @@
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
#include <light_driver.h>
|
||||
#include <button_driver.h>
|
||||
|
||||
static const char *TAG = "board";
|
||||
#define DEVICE_VERSION_1_0
|
||||
|
||||
static esp_err_t board_led_init()
|
||||
#ifdef DEVICE_VERSION_1_0
|
||||
#define LED_GPIO_PIN 8 /* GPIO_NUM_8 */
|
||||
#define LED_CHANNEL 0 /* RMT_CHANNEL_0 */
|
||||
#endif
|
||||
|
||||
|
||||
static const char *TAG = "device";
|
||||
|
||||
static esp_err_t device_light_init()
|
||||
{
|
||||
led_driver_config_t config = {
|
||||
.gpio = 12, /* GPIO_NUM_12 */
|
||||
.channel = 0, /* LEDC_CHANNEL_0 */
|
||||
light_driver_config_t config = {
|
||||
.gpio = LED_GPIO_PIN,
|
||||
.channel = LED_CHANNEL,
|
||||
};
|
||||
return led_driver_init(&config);
|
||||
return light_driver_init(&config);
|
||||
}
|
||||
|
||||
static esp_err_t board_button_init()
|
||||
static esp_err_t device_button_init()
|
||||
{
|
||||
return button_driver_init(NULL);
|
||||
}
|
||||
|
||||
esp_err_t board_init()
|
||||
esp_err_t device_init()
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing board");
|
||||
board_led_init();
|
||||
board_button_init();
|
||||
ESP_LOGI(TAG, "Initializing device");
|
||||
device_light_init();
|
||||
device_button_init();
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
if (NOT ("${IDF_TARGET}" STREQUAL "esp32c3" ))
|
||||
message(FATAL_ERROR "please set esp32c3 as the IDF_TARGET using 'idf.py set-target esp32c3'")
|
||||
endif()
|
||||
|
||||
SET(device_hal_path $ENV{ESP_MATTER_DEVICE_PATH}/../../)
|
||||
SET(device_name esp32c3_devkit_m)
|
||||
SET(light_type ws2812)
|
||||
SET(button_type hollow)
|
||||
SET(used_driver light_driver button_driver)
|
||||
SET(extra_components_dirs_append "${device_hal_path}/light_driver"
|
||||
"${device_hal_path}/button_driver"
|
||||
"$ENV{IDF_PATH}/examples/peripherals/rmt/led_strip/components")
|
||||
@@ -19,7 +19,7 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
esp_err_t board_init();
|
||||
esp_err_t device_init();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@@ -13,29 +13,35 @@
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
#include <light_driver.h>
|
||||
#include <button_driver.h>
|
||||
|
||||
static const char *TAG = "board";
|
||||
#define DEVICE_VERSION_1_0
|
||||
|
||||
static esp_err_t board_led_init()
|
||||
#ifdef DEVICE_VERSION_1_0
|
||||
#define LED_GPIO_PIN 32 /* PIN_NUM_BCKL for M5Stack TFT */
|
||||
#define LED_CHANNEL 7 /* LEDC_CHANNEL_7 */
|
||||
#endif
|
||||
static const char *TAG = "device";
|
||||
|
||||
static esp_err_t device_light_init()
|
||||
{
|
||||
led_driver_config_t config = {
|
||||
.gpio = 32, /* PIN_NUM_BCKL for M5Stack TFT */
|
||||
.channel = 7, /* LEDC_CHANNEL_7 */
|
||||
light_driver_config_t config = {
|
||||
.gpio = 32,
|
||||
.channel = 7,
|
||||
};
|
||||
return led_driver_init(&config);
|
||||
return light_driver_init(&config);
|
||||
}
|
||||
|
||||
static esp_err_t board_button_init()
|
||||
static esp_err_t device_button_init()
|
||||
{
|
||||
return button_driver_init(NULL);
|
||||
}
|
||||
|
||||
esp_err_t board_init()
|
||||
esp_err_t device_init()
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing board");
|
||||
board_led_init();
|
||||
board_button_init();
|
||||
device_light_init();
|
||||
device_button_init();
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
if(NOT ("${IDF_TARGET}" STREQUAL "esp32" ))
|
||||
message(FATAL_ERROR "please set esp32 as the IDF_TARGET using 'idf.py set-target esp32'")
|
||||
endif()
|
||||
|
||||
SET(device_hal_path $ENV{ESP_MATTER_DEVICE_PATH}/../../)
|
||||
SET(device_name m5stack)
|
||||
SET(light_type vled)
|
||||
SET(button_type hollow)
|
||||
SET(used_driver light_driver button_driver)
|
||||
SET(extra_components_dirs_append "${device_hal_path}/light_driver"
|
||||
"${device_hal_path}/button_driver"
|
||||
"$ENV{ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/examples/common/m5stack-tft/repo/components/tft/"
|
||||
"$ENV{ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/examples/common/m5stack-tft/repo/components/spidriver/")
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake)
|
||||
set(light_requires )
|
||||
if ("${light_type}" STREQUAL "ws2812")
|
||||
list(APPEND light_requires led_strip)
|
||||
elseif ("${light_type}" STREQUAL "vled")
|
||||
list(APPEND light_requires tft spidriver)
|
||||
endif()
|
||||
idf_component_register(SRC_DIRS ${light_type} utils
|
||||
INCLUDE_DIRS include
|
||||
PRIV_REQUIRES ${light_requires})
|
||||
+14
-14
@@ -15,15 +15,15 @@
|
||||
#include <driver/ledc.h>
|
||||
#include <hal/ledc_types.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
#include <light_driver.h>
|
||||
|
||||
static const char *TAG = "led_driver_gpio";
|
||||
static const char *TAG = "light_driver_gpio";
|
||||
static bool current_power = false;
|
||||
static uint8_t current_brightness = 0;
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
esp_err_t light_driver_init(light_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing led driver");
|
||||
ESP_LOGI(TAG, "Initializing light driver");
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
ledc_timer_config_t ledc_timer = {
|
||||
@@ -56,13 +56,13 @@ esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_power(bool power)
|
||||
esp_err_t light_driver_set_power(bool power)
|
||||
{
|
||||
current_power = power;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
esp_err_t light_driver_set_brightness(uint8_t brightness)
|
||||
{
|
||||
esp_err_t err;
|
||||
|
||||
@@ -85,42 +85,42 @@ esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_hue(uint16_t hue)
|
||||
esp_err_t light_driver_set_hue(uint16_t hue)
|
||||
{
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation)
|
||||
esp_err_t light_driver_set_saturation(uint8_t saturation)
|
||||
{
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature)
|
||||
esp_err_t light_driver_set_temperature(uint32_t temperature)
|
||||
{
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
bool led_driver_get_power()
|
||||
bool light_driver_get_power()
|
||||
{
|
||||
return current_power;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_brightness()
|
||||
uint8_t light_driver_get_brightness()
|
||||
{
|
||||
return current_brightness;
|
||||
}
|
||||
|
||||
uint16_t led_driver_get_hue()
|
||||
uint16_t light_driver_get_hue()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_saturation()
|
||||
uint8_t light_driver_get_saturation()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t led_driver_get_temperature()
|
||||
uint32_t light_driver_get_temperature()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+14
-14
@@ -12,24 +12,24 @@
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <led_driver.h>
|
||||
#include <light_driver.h>
|
||||
#include <color_format.h>
|
||||
|
||||
static const char *TAG = "led_driver_hollow";
|
||||
static const char *TAG = "light_driver_hollow";
|
||||
static bool current_power = false;
|
||||
static uint8_t current_brightness = 0;
|
||||
static HS_color_t current_HS = {0, 0};
|
||||
static uint32_t current_temperature = 6600;
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
esp_err_t light_driver_init(light_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing led driver");
|
||||
ESP_LOGI(TAG, "Initializing light driver");
|
||||
/* Initialize the driver here */
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_power(bool power)
|
||||
esp_err_t light_driver_set_power(bool power)
|
||||
{
|
||||
ESP_LOGI(TAG, "Setting power to: %d", power);
|
||||
/* Set the power state here */
|
||||
@@ -37,7 +37,7 @@ esp_err_t led_driver_set_power(bool power)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
esp_err_t light_driver_set_brightness(uint8_t brightness)
|
||||
{
|
||||
ESP_LOGI(TAG, "Setting brightness to: %d", brightness);
|
||||
/* Set the brightness level here */
|
||||
@@ -45,7 +45,7 @@ esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_hue(uint16_t hue)
|
||||
esp_err_t light_driver_set_hue(uint16_t hue)
|
||||
{
|
||||
ESP_LOGI(TAG, "Setting hue to: %d", hue);
|
||||
/* Set the color hue here */
|
||||
@@ -53,7 +53,7 @@ esp_err_t led_driver_set_hue(uint16_t hue)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation)
|
||||
esp_err_t light_driver_set_saturation(uint8_t saturation)
|
||||
{
|
||||
ESP_LOGI(TAG, "Setting saturation to: %d", saturation);
|
||||
/* Set the color saturation here */
|
||||
@@ -61,7 +61,7 @@ esp_err_t led_driver_set_saturation(uint8_t saturation)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature)
|
||||
esp_err_t light_driver_set_temperature(uint32_t temperature)
|
||||
{
|
||||
ESP_LOGI(TAG, "Setting temperature to: %d", temperature);
|
||||
/* Set the color temp here*/
|
||||
@@ -69,27 +69,27 @@ esp_err_t led_driver_set_temperature(uint32_t temperature)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
bool led_driver_get_power()
|
||||
bool light_driver_get_power()
|
||||
{
|
||||
return current_power;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_brightness()
|
||||
uint8_t light_driver_get_brightness()
|
||||
{
|
||||
return current_brightness;
|
||||
}
|
||||
|
||||
uint16_t led_driver_get_hue()
|
||||
uint16_t light_driver_get_hue()
|
||||
{
|
||||
return current_HS.hue;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_saturation()
|
||||
uint8_t light_driver_get_saturation()
|
||||
{
|
||||
return current_HS.saturation;
|
||||
}
|
||||
|
||||
uint32_t led_driver_get_temperature()
|
||||
uint32_t light_driver_get_temperature()
|
||||
{
|
||||
return current_temperature;
|
||||
}
|
||||
+1
-1
@@ -32,7 +32,7 @@ typedef struct {
|
||||
|
||||
void temp_to_hs(uint32_t temperature, HS_color_t *HS);
|
||||
|
||||
void hsb_to_rgb(HS_color_t HS,uint8_t brightness, RGB_color_t *RGB);
|
||||
void hsv_to_rgb(HS_color_t HS,uint8_t brightness, RGB_color_t *RGB);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
+12
-12
@@ -22,20 +22,20 @@ extern "C"
|
||||
typedef struct {
|
||||
int gpio;
|
||||
int channel;
|
||||
} led_driver_config_t;
|
||||
} light_driver_config_t;
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config);
|
||||
esp_err_t led_driver_set_power(bool power);
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness);
|
||||
esp_err_t led_driver_set_hue(uint16_t hue);
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation);
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature);
|
||||
esp_err_t light_driver_init(light_driver_config_t *config);
|
||||
esp_err_t light_driver_set_power(bool power);
|
||||
esp_err_t light_driver_set_brightness(uint8_t brightness);
|
||||
esp_err_t light_driver_set_hue(uint16_t hue);
|
||||
esp_err_t light_driver_set_saturation(uint8_t saturation);
|
||||
esp_err_t light_driver_set_temperature(uint32_t temperature);
|
||||
|
||||
bool led_driver_get_power(void);
|
||||
uint8_t led_driver_get_brightness(void);
|
||||
uint16_t led_driver_get_hue(void);
|
||||
uint8_t led_driver_get_saturation(void);
|
||||
uint32_t led_driver_get_temperature(void);
|
||||
bool light_driver_get_power(void);
|
||||
uint8_t light_driver_get_brightness(void);
|
||||
uint16_t light_driver_get_hue(void);
|
||||
uint8_t light_driver_get_saturation(void);
|
||||
uint32_t light_driver_get_temperature(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <color_format.h>
|
||||
|
||||
void hsb_to_rgb(HS_color_t HS,uint8_t brightness, RGB_color_t *RGB)
|
||||
void hsv_to_rgb(HS_color_t HS,uint8_t brightness, RGB_color_t *RGB)
|
||||
{
|
||||
uint16_t sector = HS.hue / 60;
|
||||
uint16_t rgb_max = brightness;
|
||||
+23
-23
@@ -18,14 +18,14 @@
|
||||
#include <tft.h>
|
||||
#include <tftspi.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
#include <light_driver.h>
|
||||
#include <color_format.h>
|
||||
|
||||
#define TFT_SPI_CLOCK_INIT_HZ 8000000
|
||||
#define LEDC_PWM_HZ 1000
|
||||
#define BRIGHTNESS_MAX 255
|
||||
|
||||
static const char *TAG = "led_driver_vled";
|
||||
static const char *TAG = "light_driver_vled";
|
||||
static bool current_power = false;
|
||||
static uint8_t current_brightness = 0;
|
||||
static HS_color_t current_HS = {0, 0};
|
||||
@@ -35,7 +35,7 @@ static uint16_t DisplayHeight;
|
||||
static uint16_t DisplayWidth;
|
||||
static int led_driver_channel = -1;
|
||||
|
||||
static void SetupBrightnessControl(led_driver_config_t *config)
|
||||
static void SetupBrightnessControl(light_driver_config_t *config)
|
||||
{
|
||||
ledc_timer_config_t ledc_timer;
|
||||
memset(&ledc_timer, 0, sizeof(ledc_timer));
|
||||
@@ -124,7 +124,7 @@ static esp_err_t InitDisplay()
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
esp_err_t light_driver_init(light_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing led driver");
|
||||
esp_err_t err = ESP_OK;
|
||||
@@ -137,19 +137,19 @@ esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_power(bool power)
|
||||
esp_err_t light_driver_set_power(bool power)
|
||||
{
|
||||
current_power = power;
|
||||
return ESP_OK;
|
||||
}
|
||||
esp_err_t led_driver_set_RGB()
|
||||
esp_err_t light_driver_set_RGB()
|
||||
{
|
||||
TFT_fillWindow(TFT_BLACK);
|
||||
TFT_fillCircle(DisplayWidth / 2, DisplayHeight / 2, DisplayWidth / 4, (color_t) {mRGB.red, mRGB.green, mRGB.blue});
|
||||
TFT_drawCircle(DisplayWidth / 2, DisplayHeight / 2, DisplayWidth / 4, (color_t) {255, 255, 255});
|
||||
return ESP_OK;
|
||||
}
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
esp_err_t light_driver_set_brightness(uint8_t brightness)
|
||||
{
|
||||
if (brightness != 0) {
|
||||
current_brightness = brightness;
|
||||
@@ -157,56 +157,56 @@ esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
if (!current_power) {
|
||||
brightness = 0;
|
||||
}
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
hsv_to_rgb(current_HS, brightness, &mRGB);
|
||||
return light_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_hue(uint16_t hue)
|
||||
esp_err_t light_driver_set_hue(uint16_t hue)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_HS.hue = hue;
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
hsv_to_rgb(current_HS, brightness, &mRGB);
|
||||
return light_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation)
|
||||
esp_err_t light_driver_set_saturation(uint8_t saturation)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_HS.saturation = saturation;
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
hsv_to_rgb(current_HS, brightness, &mRGB);
|
||||
return light_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature)
|
||||
esp_err_t light_driver_set_temperature(uint32_t temperature)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_temperature = temperature;
|
||||
temp_to_hs(current_temperature,¤t_HS);
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
hsv_to_rgb(current_HS, brightness, &mRGB);
|
||||
return light_driver_set_RGB();
|
||||
}
|
||||
|
||||
bool led_driver_get_power()
|
||||
bool light_driver_get_power()
|
||||
{
|
||||
return current_power;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_brightness()
|
||||
uint8_t light_driver_get_brightness()
|
||||
{
|
||||
return current_brightness;
|
||||
}
|
||||
|
||||
uint16_t led_driver_get_hue()
|
||||
uint16_t light_driver_get_hue()
|
||||
{
|
||||
return current_HS.hue;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_saturation()
|
||||
uint8_t light_driver_get_saturation()
|
||||
{
|
||||
return current_HS.saturation;
|
||||
}
|
||||
|
||||
uint32_t led_driver_get_temperature()
|
||||
uint32_t light_driver_get_temperature()
|
||||
{
|
||||
return current_temperature;
|
||||
}
|
||||
+23
-23
@@ -15,9 +15,9 @@
|
||||
#include <driver/rmt.h>
|
||||
#include <led_strip.h>
|
||||
#include <color_format.h>
|
||||
#include <led_driver.h>
|
||||
#include <light_driver.h>
|
||||
|
||||
static const char *TAG = "led_driver_rmt";
|
||||
static const char *TAG = "light_driver_ws2812";
|
||||
static bool current_power = false;
|
||||
static uint8_t current_brightness = 0;
|
||||
static uint32_t current_temp = 6600;
|
||||
@@ -25,9 +25,9 @@ static HS_color_t current_HS = {0, 0};
|
||||
static RGB_color_t mRGB;
|
||||
static led_strip_t *strip = NULL;
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
esp_err_t light_driver_init(light_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing led driver");
|
||||
ESP_LOGI(TAG, "Initializing light driver");
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
rmt_config_t rmt_cfg = RMT_DEFAULT_CONFIG_TX(config->gpio, config->channel);
|
||||
@@ -50,13 +50,13 @@ esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_power(bool power)
|
||||
esp_err_t light_driver_set_power(bool power)
|
||||
{
|
||||
current_power = power;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_RGB()
|
||||
esp_err_t light_driver_set_RGB()
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
if (!strip) {
|
||||
@@ -77,7 +77,7 @@ esp_err_t led_driver_set_RGB()
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
esp_err_t light_driver_set_brightness(uint8_t brightness)
|
||||
{
|
||||
if (brightness != 0) {
|
||||
current_brightness = brightness;
|
||||
@@ -85,56 +85,56 @@ esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
if (!current_power) {
|
||||
brightness = 0;
|
||||
}
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
hsv_to_rgb(current_HS, brightness, &mRGB);
|
||||
return light_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_hue(uint16_t hue)
|
||||
esp_err_t light_driver_set_hue(uint16_t hue)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_HS.hue = hue;
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
hsv_to_rgb(current_HS, brightness, &mRGB);
|
||||
return light_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation)
|
||||
esp_err_t light_driver_set_saturation(uint8_t saturation)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_HS.saturation = saturation;
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
hsv_to_rgb(current_HS, brightness, &mRGB);
|
||||
return light_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature)
|
||||
esp_err_t light_driver_set_temperature(uint32_t temperature)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_temp = temperature;
|
||||
temp_to_hs(current_temp, ¤t_HS);
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
hsv_to_rgb(current_HS, brightness, &mRGB);
|
||||
return light_driver_set_RGB();
|
||||
}
|
||||
|
||||
bool led_driver_get_power()
|
||||
bool light_driver_get_power()
|
||||
{
|
||||
return current_power;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_brightness()
|
||||
uint8_t light_driver_get_brightness()
|
||||
{
|
||||
return current_brightness;
|
||||
}
|
||||
|
||||
uint16_t led_driver_get_hue()
|
||||
uint16_t light_driver_get_hue()
|
||||
{
|
||||
return current_HS.hue;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_saturation()
|
||||
uint8_t light_driver_get_saturation()
|
||||
{
|
||||
return current_HS.saturation;
|
||||
}
|
||||
|
||||
uint32_t led_driver_get_temperature()
|
||||
uint32_t light_driver_get_temperature()
|
||||
{
|
||||
return current_temp;
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake)
|
||||
idf_component_register(SRCS app_driver.c
|
||||
INCLUDE_DIRS .
|
||||
PRIV_REQUIRES board led_driver button_driver)
|
||||
PRIV_REQUIRES device ${used_driver})
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include <esp_log.h>
|
||||
|
||||
#include <app_driver.h>
|
||||
#include <board.h>
|
||||
#include <led_driver.h>
|
||||
#include <device.h>
|
||||
#include <light_driver.h>
|
||||
|
||||
typedef struct driver_src {
|
||||
char name[SRC_MAX_NAMELEN];
|
||||
@@ -24,7 +24,7 @@ static driver_src_t *s_driver_src = NULL;
|
||||
|
||||
esp_err_t app_driver_init()
|
||||
{
|
||||
return board_init();
|
||||
return device_init();
|
||||
}
|
||||
|
||||
esp_err_t app_driver_register_src(const char *name, app_driver_param_callback_t *callbacks)
|
||||
@@ -58,7 +58,7 @@ esp_err_t app_driver_update_and_report_power(bool power, const char *src)
|
||||
driver_src_t *cur_src = s_driver_src;
|
||||
|
||||
/* Update */
|
||||
ret = led_driver_set_power(power);
|
||||
ret = light_driver_set_power(power);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ esp_err_t app_driver_update_and_report_brightness(uint8_t brightness, const char
|
||||
driver_src_t *cur_src = s_driver_src;
|
||||
|
||||
/* Update */
|
||||
ret = led_driver_set_brightness(brightness);
|
||||
ret = light_driver_set_brightness(brightness);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
@@ -104,7 +104,7 @@ esp_err_t app_driver_update_and_report_hue(uint16_t hue, const char *src)
|
||||
driver_src_t *cur_src = s_driver_src;
|
||||
|
||||
/* Update */
|
||||
ret = led_driver_set_hue(hue);
|
||||
ret = light_driver_set_hue(hue);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ esp_err_t app_driver_update_and_report_saturation(uint8_t saturation, const char
|
||||
driver_src_t *cur_src = s_driver_src;
|
||||
|
||||
/* Update */
|
||||
ret = led_driver_set_saturation(saturation);
|
||||
ret = light_driver_set_saturation(saturation);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ esp_err_t app_driver_update_and_report_temperature(uint32_t temperature, const c
|
||||
driver_src_t *cur_src = s_driver_src;
|
||||
|
||||
/* Update */
|
||||
ret = led_driver_set_temperature(temperature);
|
||||
ret = light_driver_set_temperature(temperature);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
@@ -169,25 +169,25 @@ esp_err_t app_driver_update_and_report_temperature(uint32_t temperature, const c
|
||||
|
||||
bool app_driver_get_power()
|
||||
{
|
||||
return led_driver_get_power();
|
||||
return light_driver_get_power();
|
||||
}
|
||||
|
||||
uint8_t app_driver_get_brightness()
|
||||
{
|
||||
return led_driver_get_brightness();
|
||||
return light_driver_get_brightness();
|
||||
}
|
||||
|
||||
uint16_t app_driver_get_hue()
|
||||
{
|
||||
return led_driver_get_hue();
|
||||
return light_driver_get_hue();
|
||||
}
|
||||
|
||||
uint8_t app_driver_get_saturation()
|
||||
{
|
||||
return led_driver_get_saturation();
|
||||
return light_driver_get_saturation();
|
||||
}
|
||||
|
||||
uint32_t app_driver_get_temperature()
|
||||
{
|
||||
return led_driver_get_temperature();
|
||||
return light_driver_get_temperature();
|
||||
}
|
||||
|
||||
@@ -5,27 +5,28 @@ 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")
|
||||
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)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported IDF_TARGT")
|
||||
endif()
|
||||
endif(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH})
|
||||
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
|
||||
"../common"
|
||||
"${MATTER_SDK_PATH}/config/esp32/components"
|
||||
"${ESP_MATTER_PATH}/components")
|
||||
|
||||
if(${IDF_TARGET} STREQUAL "esp32")
|
||||
list(APPEND EXTRA_COMPONENT_DIRS
|
||||
"${MATTER_SDK_PATH}/examples/common/m5stack-tft/repo/components/tft"
|
||||
"${MATTER_SDK_PATH}/examples/common/m5stack-tft/repo/components/spidriver"
|
||||
)
|
||||
elseif(${IDF_TARGET} STREQUAL "esp32c3")
|
||||
list(APPEND EXTRA_COMPONENT_DIRS
|
||||
"$ENV{IDF_PATH}/examples/peripherals/rmt/led_strip/components"
|
||||
)
|
||||
endif()
|
||||
"${ESP_MATTER_PATH}/components"
|
||||
"${ESP_MATTER_PATH}/device_hal/device"
|
||||
${extra_components_dirs_append})
|
||||
|
||||
project(light)
|
||||
|
||||
|
||||
@@ -5,6 +5,15 @@ 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")
|
||||
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)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported IDF_TARGET")
|
||||
endif()
|
||||
endif(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH})
|
||||
set(ESP_MATTER_PATH $ENV{ESP_MATTER_PATH})
|
||||
set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip)
|
||||
|
||||
@@ -14,24 +23,15 @@ endif(NOT DEFINED ENV{ESP_RMAKER_PATH})
|
||||
|
||||
# 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
|
||||
"../common"
|
||||
"${MATTER_SDK_PATH}/config/esp32/components"
|
||||
"${ESP_MATTER_PATH}/components"
|
||||
"${ESP_MATTER_PATH}/device_hal/device"
|
||||
"$ENV{ESP_RMAKER_PATH}/components"
|
||||
)
|
||||
|
||||
if(${IDF_TARGET} STREQUAL "esp32")
|
||||
list(APPEND EXTRA_COMPONENT_DIRS
|
||||
"${MATTER_SDK_PATH}/examples/common/m5stack-tft/repo/components/tft"
|
||||
"${MATTER_SDK_PATH}/examples/common/m5stack-tft/repo/components/spidriver"
|
||||
)
|
||||
elseif(${IDF_TARGET} STREQUAL "esp32c3")
|
||||
list(APPEND EXTRA_COMPONENT_DIRS
|
||||
"$ENV{IDF_PATH}/examples/peripherals/rmt/led_strip/components"
|
||||
)
|
||||
endif()
|
||||
${extra_components_dirs_append})
|
||||
|
||||
project(rainmaker_light)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user