Skip to content

Commit

Permalink
Fix build and update ZAP
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian-Nordic committed Nov 4, 2021
1 parent 216e876 commit 8a56f40
Show file tree
Hide file tree
Showing 26 changed files with 3,112 additions and 4,908 deletions.
90 changes: 42 additions & 48 deletions examples/weather_station/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
#
# Copyright (c) 2021 Nordic Semiconductor ASA
# Copyright (c) 2020 Project CHIP Authors
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
# 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.
#
cmake_minimum_required(VERSION 3.13.1)

get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../.. REALPATH)
get_filename_component(NLIO_ROOT ${CHIP_ROOT}/third_party/nlio/repo/include REALPATH)
get_filename_component(NRFCONNECT_COMMON ${CHIP_ROOT}/examples/platform/nrfconnect REALPATH)

cmake_minimum_required(VERSION 3.20.0)
include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake)

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ZDebug)
Expand All @@ -13,55 +28,34 @@ endif()
set(CONF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/prj_${CMAKE_BUILD_TYPE}.conf)
set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml)

list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module)
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})

project(matter-weather-station)

set(COMMON_ROOT ${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common)
set(NLIO_ROOT ${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/third_party/nlio/repo)
include(${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/config/nrfconnect/app/enable-gnu-std.cmake)
include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake)
include(${CHIP_ROOT}/src/app/chip_data_model.cmake)

# NORDIC SDK APP START
target_include_directories(app PRIVATE src ${COMMON_ROOT}/src ${NLIO_ROOT}/include)
target_include_directories(app PRIVATE
src
${COMMON_ROOT}/src
${NRFCONNECT_COMMON}/util/include
${NLIO_ROOT}
${CHIP_ROOT}/zzz_generated/app-common
)

target_sources(app PRIVATE
src/app_task.cpp
src/main.cpp
src/gen/attribute-size.cpp
src/gen/IMClusterCommandHandler.cpp
src/gen/callback-stub.cpp
${COMMON_ROOT}/src/thread_util.cpp
${COMMON_ROOT}/src/led_widget.cpp
${COMMON_ROOT}/src/dfu_over_smp.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/DataModelHandler.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/reporting/reporting-default-configuration.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/reporting/reporting.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/af-event.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/af-main-common.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/attribute-list-byte-span.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/attribute-size-util.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/attribute-storage.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/attribute-table.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/binding-table.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/chip-message-send.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/client-api.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/ember-compatibility-functions.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/ember-print.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/error-mapping.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/message.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/process-cluster-message.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/process-global-message.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/util/util.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/clusters/basic/basic.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/clusters/bindings/bindings.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/clusters/network-commissioning/network-commissioning-ember.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/clusters/network-commissioning/network-commissioning.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/server/EchoHandler.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/server/Mdns.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/server/OnboardingCodesUtil.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/server/RendezvousServer.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/server/Server.cpp
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/server/StorablePeerConnection.cpp)
# NORDIC SDK APP END
src/app_task.cpp
src/main.cpp
src/zap-generated/attribute-size.cpp
src/zap-generated/IMClusterCommandHandler.cpp
src/zap-generated/callback-stub.cpp
${NRFCONNECT_COMMON}/util/LEDWidget.cpp
${NRFCONNECT_COMMON}/util/ThreadUtil.cpp
${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp
)

chip_configure_data_model(app
INCLUDE_SERVER
ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/weather-station.zap
)
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16

# External flash memory configuration
CONFIG_PM_EXTERNAL_FLASH_SUPPORT_LEGACY=y
CONFIG_PM_EXTERNAL_FLASH=y
CONFIG_PM_EXTERNAL_FLASH_DEV_NAME="MX25R64"
CONFIG_PM_EXTERNAL_FLASH_SIZE=0x800000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16

# External flash memory configuration
CONFIG_PM_EXTERNAL_FLASH_SUPPORT_LEGACY=y
CONFIG_PM_EXTERNAL_FLASH=y
CONFIG_PM_EXTERNAL_FLASH_DEV_NAME="MX25R64"
CONFIG_PM_EXTERNAL_FLASH_SIZE=0x800000
Expand Down
35 changes: 27 additions & 8 deletions examples/weather_station/src/app_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,37 @@

#pragma once

#include <cstdint>

class LEDWidget;

struct AppEvent {
enum class Type {
kButtonPush,
kButtonRelease,
kTimer,
enum FunctionEventType : uint8_t {
FunctionPress,
FunctionRelease,
FunctionTimer,
MeasurementsTimer,
};

enum UpdateLedStateEventType : uint8_t { UpdateLedState = MeasurementsTimer + 1 };

enum OtherEventType : uint8_t {
#ifdef CONFIG_MCUMGR_SMP_BT
kStartSMPAdvertising
StartSMPAdvertising = UpdateLedState + 1
#endif
};

using Handler = void (*)(AppEvent *);
AppEvent() = default;

explicit AppEvent(FunctionEventType type) : Type(type) {}

AppEvent(UpdateLedStateEventType type, LEDWidget *ledWidget) : Type(type), UpdateLedStateEvent{ ledWidget } {}

explicit AppEvent(OtherEventType type) : Type(type) {}

uint8_t Type;

Type mType;
Handler mHandler;
struct {
LEDWidget *LedWidget;
} UpdateLedStateEvent;
};
Loading

0 comments on commit 8a56f40

Please sign in to comment.