forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ESP32: Add lit-icd-app example for ESP32-H2 and ESP32-C6 (project-chi…
…p#32784) * Add lit-icd-app example for ESP32-H2 and ESP32-C6 * Restyled by prettier-markdown --------- Co-authored-by: Restyled.io <[email protected]>
- Loading branch information
1 parent
f1abb59
commit 6c89640
Showing
16 changed files
with
494 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.vscode | ||
|
||
/build/ | ||
/sdkconfig | ||
/sdkconfig.old |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# | ||
# Copyright (c) 2024 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# 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. | ||
|
||
# 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 "v1.0") | ||
set(PROJECT_VER_NUMBER 1) | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
|
||
|
||
set(EXTRA_COMPONENT_DIRS | ||
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components" | ||
) | ||
|
||
project(lit-icd-app) | ||
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 the RISC-V 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) | ||
|
||
# -Wmaybe-uninitialized has too many false positives, including on std::optional | ||
# and chip::Optional. Make it nonfatal. | ||
# | ||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 | ||
idf_build_set_property(COMPILE_OPTIONS "-Wno-error=maybe-uninitialized" APPEND) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Matter ESP32 LIT ICD Example | ||
|
||
This example is meant to represent a power-save application. | ||
|
||
Please | ||
[setup ESP-IDF and CHIP Environment](../../../docs/guides/esp32/setup_idf_chip.md) | ||
and refer | ||
[building and commissioning](../../../docs/guides/esp32/build_app_and_commission.md) | ||
guides to get started. | ||
|
||
**Note**: Currently only Thread devices can run this example. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# | ||
# Copyright (c) 2024 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# 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. | ||
# | ||
# | ||
|
||
get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH) | ||
|
||
set(PRIV_INCLUDE_DIRS_LIST | ||
"${CMAKE_CURRENT_LIST_DIR}/include" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" | ||
) | ||
set(SRC_DIRS_LIST | ||
"${CMAKE_CURRENT_LIST_DIR}" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/bindings" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fixed-label-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/icd-management-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" | ||
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" | ||
) | ||
|
||
idf_component_register(PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST} | ||
SRC_DIRS ${SRC_DIRS_LIST}) | ||
|
||
include("${CHIP_ROOT}/build/chip/esp32/esp32_codegen.cmake") | ||
chip_app_component_codegen("${CHIP_ROOT}/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter") | ||
chip_app_component_zapgen("${CHIP_ROOT}/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap") | ||
|
||
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) | ||
target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") | ||
target_compile_options(${COMPONENT_LIB} PUBLIC | ||
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* | ||
* Copyright (c) 2024 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* @file DeviceCallbacks.cpp | ||
* | ||
* Implements all the callbacks to the application from the CHIP Stack | ||
* | ||
**/ | ||
#include "DeviceCallbacks.h" | ||
|
||
static const char TAG[] = "devicecallbacks"; | ||
|
||
using namespace ::chip; | ||
using namespace ::chip::Inet; | ||
using namespace ::chip::System; | ||
|
||
void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, | ||
uint8_t type, uint16_t size, uint8_t * value) | ||
{ | ||
ESP_LOGI(TAG, "PostAttributeChangeCallback - Cluster ID: '0x%" PRIx32 "', EndPoint ID: '0x%x', Attribute ID: '0x%" PRIx32 "'", | ||
clusterId, endpointId, attributeId); | ||
|
||
// TODO handle this callback in switch statement | ||
ESP_LOGI(TAG, "Unhandled cluster ID: %" PRIu32, clusterId); | ||
|
||
ESP_LOGI(TAG, "Current free heap: %d\n", heap_caps_get_free_size(MALLOC_CAP_8BIT)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# | ||
# Copyright (c) 2020 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# 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. | ||
# | ||
# Description: | ||
# Configuration options CHIP ESP32 demo application. | ||
# | ||
|
||
menu "Demo" | ||
|
||
choice | ||
prompt "Rendezvous Mode" | ||
default RENDEZVOUS_MODE_BLE | ||
help | ||
Specifies the Rendezvous mode of the peripheral. | ||
|
||
config RENDEZVOUS_MODE_WIFI | ||
bool "Wi-Fi" | ||
config RENDEZVOUS_MODE_BLE | ||
bool "BLE" | ||
config RENDEZVOUS_MODE_THREAD | ||
bool "Thread" | ||
config RENDEZVOUS_MODE_ETHERNET | ||
bool "Ethernet" | ||
endchoice | ||
|
||
config RENDEZVOUS_MODE | ||
int | ||
range 0 8 | ||
default 1 if RENDEZVOUS_MODE_WIFI | ||
default 2 if RENDEZVOUS_MODE_BLE | ||
default 4 if RENDEZVOUS_MODE_THREAD | ||
default 8 if RENDEZVOUS_MODE_ETHERNET | ||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* | ||
* Copyright (c) 2024 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* @file DeviceCallbacks.h | ||
* | ||
* Implementations for the DeviceManager callbacks for this application | ||
* | ||
**/ | ||
|
||
#ifndef DEVICE_CALLBACKS_H | ||
#define DEVICE_CALLBACKS_H | ||
|
||
#include <common/CHIPDeviceManager.h> | ||
#include <common/CommonDeviceCallbacks.h> | ||
|
||
class AppDeviceCallbacks : public CommonDeviceCallbacks | ||
{ | ||
public: | ||
virtual void PostAttributeChangeCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId, | ||
uint8_t type, uint16_t size, uint8_t * value); | ||
}; | ||
|
||
#endif // DEVICE_CALLBACKS_H |
Oops, something went wrong.