mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'bsp_integration4' into 'main'
change demo badge example to use bsp See merge request app-frameworks/esp-matter!722
This commit is contained in:
@@ -6,13 +6,9 @@ if(NOT DEFINED ENV{ESP_MATTER_PATH})
|
||||
message(FATAL_ERROR "Please set ESP_MATTER_PATH to the path of esp-matter repo")
|
||||
endif(NOT DEFINED ENV{ESP_MATTER_PATH})
|
||||
|
||||
if(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH})
|
||||
if("${IDF_TARGET}" STREQUAL "esp32" OR "${IDF_TARGET}" STREQUAL "")
|
||||
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32_devkit_c)
|
||||
else()
|
||||
message(FATAL_ERROR "Espressif Badge is only supported on ESP32 target")
|
||||
endif()
|
||||
endif(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH})
|
||||
if(NOT "${IDF_TARGET}" STREQUAL "esp32" AND NOT "${IDF_TARGET}" STREQUAL "")
|
||||
message(FATAL_ERROR "Espressif Badge is only supported on ESP32 target")
|
||||
endif()
|
||||
|
||||
set(PROJECT_VER "1.0")
|
||||
set(PROJECT_VER_NUMBER 1)
|
||||
@@ -22,13 +18,11 @@ set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip)
|
||||
|
||||
# This should be done before using the IDF_TARGET variable.
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS
|
||||
"${ESP_MATTER_PATH}/examples/common"
|
||||
"${MATTER_SDK_PATH}/config/esp32/components"
|
||||
"${ESP_MATTER_PATH}/components"
|
||||
"${ESP_MATTER_PATH}/device_hal/device"
|
||||
${extra_components_dirs_append})
|
||||
|
||||
project(demo-badge)
|
||||
|
||||
@@ -10,9 +10,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <device.h>
|
||||
#include <esp_matter.h>
|
||||
#include <led_driver.h>
|
||||
#include "bsp/esp-bsp.h"
|
||||
|
||||
#include <app_priv.h>
|
||||
|
||||
@@ -38,7 +37,7 @@ static esp_err_t set_default_epaper(esp_matter_attr_val_t *val)
|
||||
}
|
||||
|
||||
/* Do any conversions/remapping for the actual value here */
|
||||
static esp_err_t app_driver_light_set_power(led_driver_handle_t handle, esp_matter_attr_val_t *val)
|
||||
static esp_err_t app_driver_light_set_power(led_indicator_handle_t handle, esp_matter_attr_val_t *val)
|
||||
{
|
||||
return set_default_epaper(val);
|
||||
}
|
||||
@@ -133,7 +132,7 @@ 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_driver_handle_t handle = (led_driver_handle_t)priv_data;
|
||||
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;
|
||||
@@ -193,15 +192,10 @@ static void factory_reset_badge(void *arg, void *data)
|
||||
app_driver_handle_t app_driver_button_init()
|
||||
{
|
||||
/* Initialize button */
|
||||
button_config_t config = {
|
||||
.type = BUTTON_TYPE_GPIO,
|
||||
.gpio_button_config = {
|
||||
.gpio_num = 39,
|
||||
.active_level = 0,
|
||||
}
|
||||
};
|
||||
button_handle_t handle = iot_button_create(&config);
|
||||
iot_button_register_cb(handle, BUTTON_PRESS_DOWN, app_driver_button_toggle_cb, NULL);
|
||||
iot_button_register_cb(handle, BUTTON_LONG_PRESS_START, factory_reset_badge, NULL);
|
||||
return (app_driver_handle_t)handle;
|
||||
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));
|
||||
ESP_ERROR_CHECK(iot_button_register_cb(btns[0], BUTTON_LONG_PRESS_START, factory_reset_badge, NULL));
|
||||
|
||||
return (app_driver_handle_t)btns[0];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
dependencies:
|
||||
espressif/esp_bsp_generic:
|
||||
version: "^1.1.0"
|
||||
@@ -53,3 +53,10 @@ CONFIG_SPI_MASTER_ISR_IN_IRAM=n
|
||||
CONFIG_SPI_SLAVE_ISR_IN_IRAM=n
|
||||
CONFIG_HAL_SPI_MASTER_FUNC_IN_IRAM=n
|
||||
CONFIG_HAL_SPI_SLAVE_FUNC_IN_IRAM=n
|
||||
|
||||
# ESP32-DFR0676 Settings
|
||||
# Buttons
|
||||
CONFIG_BSP_BUTTONS_NUM=1
|
||||
CONFIG_BSP_BUTTON_1_TYPE_GPIO=y
|
||||
CONFIG_BSP_BUTTON_1_GPIO=39
|
||||
CONFIG_BSP_BUTTON_1_LEVEL=0
|
||||
|
||||
Reference in New Issue
Block a user