Skip to content

Commit

Permalink
Added contact sensor example for QPG platform
Browse files Browse the repository at this point in the history
  • Loading branch information
adamb-q committed Nov 19, 2024
1 parent d8ededa commit ab2266e
Show file tree
Hide file tree
Showing 24 changed files with 8,985 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/examples-qpg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
--target qpg-qpg6105-light \
--target qpg-qpg6105-light-switch \
--target qpg-qpg6105-thermostat \
--target qpg-qpg6105-contact-sensor \
build \
--copy-artifacts-to out/artifacts \
"
Expand Down
28 changes: 28 additions & 0 deletions examples/contact-sensor-app/qpg/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2020 Project CHIP Authors
#
# 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.

import("//build_overrides/build.gni")

# The location of the build configuration file.
buildconfig = "${build_root}/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

default_args = {
target_cpu = "arm"
target_os = "freertos"

import("//args.gni")
}
17 changes: 17 additions & 0 deletions examples/contact-sensor-app/qpg/APPLICATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Matter QPG6105 Contact Sensor Example Application

## Contact Sensor app

A contact sensor example application showing the use of
[Matter](https://github.com/project-chip/connectedhomeip) on the Qorvo QPG6105
can be found in this folder.

## Qorvo SDK

More detailed information on the Qorvo SDK can be found in the
[Qorvo Matter SDK](https://github.com/Qorvo/QMatter).

## More information

For more information on our product line and support options, please visit
[www.qorvo.com](https://www.qorvo.com) or contact us at <[email protected]>
112 changes: 112 additions & 0 deletions examples/contact-sensor-app/qpg/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Copyright(c) 2021 Project CHIP Authors
#
# 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.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/openthread.gni")
import("//build_overrides/qpg_sdk.gni")

import("${build_root}/config/defaults.gni")
import("${chip_root}/src/platform/device.gni")
import("${qpg_sdk_build_root}/qpg_executable.gni")
import("${qpg_sdk_build_root}/qpg_sdk.gni")

# declares chip_build_libshell = false
import("${chip_root}/src/lib/lib.gni")

assert(current_os == "freertos")

qpg_project_dir = "${chip_root}/examples/contact-sensor-app/qpg"
examples_plat_dir = "${chip_root}/examples/platform/qpg"

qpg_sdk("sdk") {
include_dirs = [
"${chip_root}/src/platform/qpg",
"${examples_plat_dir}",
"${qpg_project_dir}/include",
]
}

qpg_executable("contact_sensor_app") {
output_name = "chip-${qpg_target_ic}${qpg_flavour}-contact-sensor-example.out"

sources = [
"${examples_plat_dir}/app/battery.cpp",
"${examples_plat_dir}/app/main.cpp",
"${examples_plat_dir}/ota/ota.cpp",
"${qpg_sdk_root}/Applications/Matter/shared/src/application_header.c",
"src/AppTask.cpp",
"src/DoorWindowManager.cpp",
"src/ZclCallbacks.cpp",
]

deps = [
":sdk",
"${chip_root}/examples/contact-sensor-app/qpg/zap/",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
"${chip_root}/third_party/qpg_sdk:qpg_doorwindow_factorydata",
"${chip_root}/third_party/qpg_sdk:qpg_doorwindow_firmwaredata_lib",
]

if (chip_openthread_ftd) {
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ]
} else {
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ]
}

include_dirs = [
"include",
"${examples_plat_dir}/ota",
"${qpg_sdk_root}/Components/Qorvo/HAL_PLATFORM/halCortexM4/inc",
"${qpg_sdk_root}/Components/ThirdParty/secure_element/software/esec/libs/common",
"${qpg_sdk_root}/Components/ThirdParty/secure_element/software/esec/libs/base/include", # esec_reatures.h
"${qpg_sdk_root}/Libraries/Qorvo/QorvoStack/gen/QorvoStack_qpg6200", #esec_config.h
]

defines = [ "GP_APP_DIVERSITY_POWERCYCLECOUNTING" ]

cflags = [ "-Wconversion" ]

if (chip_build_libshell) {
deps += [ "${examples_plat_dir}:qpg-matter-shell" ]
} else {
if (chip_openthread_ftd) {
deps +=
[ "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd" ]
} else {
deps +=
[ "${chip_root}/third_party/openthread/repo:libopenthread-cli-mtd" ]
}
}

ldscript = "${qpg_sdk_root}/Applications/Matter/base/gen/base_${qpg_target_ic}${qpg_flavour}_development/base_${qpg_target_ic}${qpg_flavour}_development.ld"

inputs = [ ldscript ]

ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]

output_dir = root_out_dir
}

group("qpg") {
deps = [ ":contact_sensor_app" ]
}

group("default") {
deps = [ ":qpg" ]
}
15 changes: 15 additions & 0 deletions examples/contact-sensor-app/qpg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
orphan: true
---

# Matter QPG6105 SDK

## Qorvo SDK

More detailed information on the Qorvo SDK can be found in the
[Qorvo Matter SDK](https://github.com/Qorvo/QMatter).

## More information

For more information on our product line and support options, please visit
[www.qorvo.com](https://www.qorvo.com) or contact us at <[email protected]>
35 changes: 35 additions & 0 deletions examples/contact-sensor-app/qpg/args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (c) 2020 Project CHIP Authors
#
# 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.

import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")
import("${chip_root}/config/standalone/args.gni")
import("${chip_root}/examples/platform/qpg/args.gni")

qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_enable_ota_requestor = true
chip_openthread_ftd = false
enable_sleepy_device = true
chip_enable_icd_server = true
chip_enable_icd_lit = false
chip_persist_subscriptions = true
chip_subscription_timeout_resumption = true

# Disable lock tracking, since our FreeRTOS configuration does not set
# INCLUDE_xSemaphoreGetMutexHolder
chip_stack_lock_tracking = "none"

matter_device_vid = "0xFFF1"
matter_device_pid = "0x8006"
1 change: 1 addition & 0 deletions examples/contact-sensor-app/qpg/build_overrides
35 changes: 35 additions & 0 deletions examples/contact-sensor-app/qpg/include/AppConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
*
* Copyright (c) 2022 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.
*/

#ifndef APP_CONFIG_H
#define APP_CONFIG_H

#define APP_TASK_NAME "APP"

// Mapping of Functional buttons
#define DOORWINDOW_SENSOR_BUTTON BTN_SW2 // GP_PB_4
#define APP_FUNCTION_BUTTON BTN_SW5 // GP_PB_5

// Mapping of LEDs
#define SYSTEM_STATE_LED LED_GREEN
#define DOORWINDOW_SENSOR_LED LED_WHITE

// Enable/Disable DoorWindow Status LED
#define CONFIG_ENABLE_DOORWINDOW_SENSOR_STATUS_LED 1

#endif // APP_CONFIG_H
56 changes: 56 additions & 0 deletions examples/contact-sensor-app/qpg/include/AppEvent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
*
* Copyright (c) 2022 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.
*/

#ifndef APP_EVENT_H
#define APP_EVENT_H

struct AppEvent;
typedef void (*EventHandler)(AppEvent *);

struct AppEvent
{
enum AppEventTypes
{
kEventType_Button = 0,
kEventType_Timer,
kEventType_DoorWindow,
};

uint16_t Type;

union
{
struct
{
uint8_t ButtonIdx;
uint8_t Action;
} ButtonEvent;
struct
{
void * Context;
} TimerEvent;
struct
{
uint8_t Action;
} DoorWindowEvent;
};

EventHandler Handler;
};

#endif // APP_EVENT_H
Loading

0 comments on commit ab2266e

Please sign in to comment.