Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Telink] Create common apps files #26087

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7671d8d
[Telink] Bridge-App demo draft added
interfer Mar 7, 2023
cddc3d4
Merge remote-tracking branch 'origin/HEAD' into bridge-app-demo
interfer Mar 9, 2023
a195b8d
[Telink] Thermostat endpoint draft added
interfer Mar 9, 2023
c62e560
[Telink] bridge included to Github CI
interfer Mar 10, 2023
82410af
[Telink] Bridged Temperature sensor added
interfer Mar 22, 2023
5467a00
[Telink] cleanup & styling
interfer Mar 23, 2023
95c5722
Merge branch 'master' into bridge-app-demo
s07641069 Mar 23, 2023
d749afb
[Telink] Code cleanup
s07641069 Mar 23, 2023
9ad7223
[Telink] Set correct bridge app name
s07641069 Mar 23, 2023
171db90
Merge branch 'master' into bridge-app-demo
s07641069 Mar 23, 2023
53d1c8e
[Telink] Fix typo after auto merge
s07641069 Mar 23, 2023
59fea53
[Telink] removed needless atribute condition
interfer Mar 24, 2023
d84542d
Merge branch 'master' into bridge-app-demo
s07641069 Mar 27, 2023
256fde4
[Telink] PRODUCT_ID mod to fix Google Home pairing
interfer Apr 3, 2023
e1272de
[Telink] Add common apps files
serhiiSalamakha Apr 3, 2023
181c91f
[Telink] Update all-clusters-minimal-app example after add common app…
serhiiSalamakha Apr 3, 2023
05e08fb
[Telink] Update light-switch-app example after add common apps files
serhiiSalamakha Apr 3, 2023
2c9352e
[Telink] Update lighting-app example after add common apps files
serhiiSalamakha Apr 3, 2023
96011ab
[Telink] Update all-clusters-app example after add common apps files
serhiiSalamakha Apr 3, 2023
9ee32f1
[Telink] Update contact-sensor-app example after add common apps files
serhiiSalamakha Apr 3, 2023
61d9b8e
[Telink] Update lock-app example after add common apps files
serhiiSalamakha Apr 3, 2023
200d5de
[Telink] Update ota-requestor-app example after add common apps files
serhiiSalamakha Apr 3, 2023
e7a3af3
[Telink] Update pump-app example after add common apps files
serhiiSalamakha Apr 3, 2023
db13048
[Telink] Update pump-controller-app example after add common apps files
serhiiSalamakha Apr 3, 2023
3eb3b7a
[Telink] Update temperature-measurement-app example after add common …
serhiiSalamakha Apr 3, 2023
312af31
[Telink] Update thermostat example after add common apps files
serhiiSalamakha Apr 3, 2023
62a214c
[Telink] Update window-app example after add common apps files
serhiiSalamakha Apr 3, 2023
7334b94
[Telink] Update bridge-app example after add common apps files
serhiiSalamakha Apr 3, 2023
f6b6bc7
[Telink] Use correct "app" log module
s07641069 Apr 5, 2023
7a5574a
Merge branch 'master' into telink_create_common_apps_files
serhiiSalamakha Apr 13, 2023
3f8b8b7
Merge branch 'master' into telink_create_common_apps_files
serhiiSalamakha Apr 13, 2023
1b6771c
Merge branch 'master' into telink_create_common_apps_files
serhiiSalamakha Apr 14, 2023
82ab896
Restyled by whitespace
restyled-commits Apr 14, 2023
05fd47c
Restyled by clang-format
restyled-commits Apr 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Telink] Update ota-requestor-app example after add common apps files
  • Loading branch information
serhiiSalamakha committed Apr 14, 2023
commit 200d5dea78c3bed94c445d40041a6e3f38acfdcd
9 changes: 5 additions & 4 deletions examples/all-clusters-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#pragma once

// ---- All Clusters Application example config ----
#define APP_USE_EXAMPLE_START_BUTTON 0
#define APP_USE_THREAD_START_BUTTON 1
#define APP_SET_DEVICE_INFO_PROVIDER 1
#define APP_USE_IDENTIFY_PWM 1 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"
#define APP_USE_EXAMPLE_START_BUTTON 0
#define APP_USE_THREAD_START_BUTTON 1
#define APP_SET_DEVICE_INFO_PROVIDER 1
#define APP_SET_NETWORK_COMM_ENDPOINT_SEC 1
#define APP_USE_IDENTIFY_PWM 1 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"

#include "AppConfigCommon.h"
15 changes: 0 additions & 15 deletions examples/all-clusters-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,17 @@

#include "binding-handler.h"

#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <credentials/examples/DeviceAttestationCredsExample.h>

#include <zephyr/logging/log.h>
#include <zephyr/zephyr.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);

namespace {
constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE;
} // namespace

AppTask AppTask::sAppTask;

CHIP_ERROR AppTask::Init(void)
{
InitCommonParts();

// We only have network commissioning on endpoint 0.
// Set up a valid Network Commissioning cluster on endpoint 0 is done in
// src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp
emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false);

// Configure Bindings
CHIP_ERROR err = InitBindingHandlers();
if (err != CHIP_NO_ERROR)
Expand Down
9 changes: 5 additions & 4 deletions examples/all-clusters-minimal-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@

// ---- All Clusters Minimal Application example config ----

#define APP_USE_EXAMPLE_START_BUTTON 0
#define APP_USE_THREAD_START_BUTTON 0
#define APP_SET_DEVICE_INFO_PROVIDER 0
#define APP_USE_IDENTIFY_PWM 0 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"
#define APP_USE_EXAMPLE_START_BUTTON 0
#define APP_USE_THREAD_START_BUTTON 0
#define APP_SET_DEVICE_INFO_PROVIDER 0
#define APP_SET_NETWORK_COMM_ENDPOINT_SEC 1
#define APP_USE_IDENTIFY_PWM 0 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"

#include "AppConfigCommon.h"
11 changes: 0 additions & 11 deletions examples/all-clusters-minimal-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,17 @@
#include "AppTask.h"
#include "binding-handler.h"

#include <app/util/attribute-storage.h>

#include <zephyr/logging/log.h>
#include <zephyr/zephyr.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);

namespace {
constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE;
} // namespace

AppTask AppTask::sAppTask;

CHIP_ERROR AppTask::Init()
{
InitCommonParts();

// We only have network commissioning on endpoint 0.
// Set up a valid Network Commissioning cluster on endpoint 0 is done in
// src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp
emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false);

// Configure Bindings
CHIP_ERROR err = InitBindingHandlers();
if (err != CHIP_NO_ERROR)
Expand Down
9 changes: 5 additions & 4 deletions examples/contact-sensor-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
#pragma once

// ---- All Clusters Application example config ----
#define APP_USE_EXAMPLE_START_BUTTON 1
#define APP_USE_THREAD_START_BUTTON 0
#define APP_SET_DEVICE_INFO_PROVIDER 1
#define APP_USE_IDENTIFY_PWM 1 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"
#define APP_USE_EXAMPLE_START_BUTTON 1
#define APP_USE_THREAD_START_BUTTON 0
#define APP_SET_DEVICE_INFO_PROVIDER 1
#define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0
#define APP_USE_IDENTIFY_PWM 1 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"

#include "AppConfigCommon.h"

Expand Down
9 changes: 5 additions & 4 deletions examples/light-switch-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@

// ---- Light Switch Example App Config ----

#define APP_USE_EXAMPLE_START_BUTTON 1
#define APP_USE_THREAD_START_BUTTON 1
#define APP_SET_DEVICE_INFO_PROVIDER 1
#define APP_USE_IDENTIFY_PWM 1 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"
#define APP_USE_EXAMPLE_START_BUTTON 1
#define APP_USE_THREAD_START_BUTTON 1
#define APP_SET_DEVICE_INFO_PROVIDER 1
#define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0
#define APP_USE_IDENTIFY_PWM 1 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"

#include "AppConfigCommon.h"
9 changes: 5 additions & 4 deletions examples/lighting-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@

// ---- Lighting Example App Config ----

#define APP_USE_EXAMPLE_START_BUTTON 1
#define APP_USE_THREAD_START_BUTTON 1
#define APP_SET_DEVICE_INFO_PROVIDER 1
#define APP_USE_IDENTIFY_PWM 1 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"
#define APP_USE_EXAMPLE_START_BUTTON 1
#define APP_USE_THREAD_START_BUTTON 1
#define APP_SET_DEVICE_INFO_PROVIDER 1
#define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0
#define APP_USE_IDENTIFY_PWM 1 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"

#include "AppConfigCommon.h"

Expand Down
9 changes: 5 additions & 4 deletions examples/lock-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@

// ---- Lock Example App Config ----

#define APP_USE_EXAMPLE_START_BUTTON 1
#define APP_USE_THREAD_START_BUTTON 1
#define APP_SET_DEVICE_INFO_PROVIDER 1
#define APP_USE_IDENTIFY_PWM 1 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"
#define APP_USE_EXAMPLE_START_BUTTON 1
#define APP_USE_THREAD_START_BUTTON 1
#define APP_SET_DEVICE_INFO_PROVIDER 1
#define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0
#define APP_USE_IDENTIFY_PWM 1 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"

#include "AppConfigCommon.h"

Expand Down
4 changes: 3 additions & 1 deletion examples/ota-requestor-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ target_include_directories(app PRIVATE
include
${GEN_DIR}/app-common
${GEN_DIR}/ota-requestor-app
${TELINK_COMMON}/common/include
${TELINK_COMMON}/util/include
${TELINK_COMMON}/app/include)

Expand All @@ -68,8 +69,9 @@ add_definitions(

target_sources(app PRIVATE
src/AppTask.cpp
src/main.cpp
src/ZclCallbacks.cpp
${TELINK_COMMON}/common/src/mainCommon.cpp
${TELINK_COMMON}/common/src/AppTaskCommon.cpp
${TELINK_COMMON}/util/src/LEDWidget.cpp
${TELINK_COMMON}/util/src/ButtonManager.cpp
${TELINK_COMMON}/util/src/ThreadUtil.cpp
Expand Down
17 changes: 6 additions & 11 deletions examples/ota-requestor-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,10 @@

// ---- OTA Requestor Example App Config ----

// Buttons config
#define BUTTON_PORT DEVICE_DT_GET(DT_NODELABEL(gpioc))
#define APP_USE_EXAMPLE_START_BUTTON 0
#define APP_USE_THREAD_START_BUTTON 1
#define APP_SET_DEVICE_INFO_PROVIDER 1
#define APP_SET_NETWORK_COMM_ENDPOINT_SEC 1
#define APP_USE_IDENTIFY_PWM 1 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"

#define BUTTON_PIN_1 2
#define BUTTON_PIN_3 3
#define BUTTON_PIN_4 1
#define BUTTON_PIN_2 0

// LEDs config
#define LEDS_PORT DEVICE_DT_GET(DT_NODELABEL(gpiob))
#define SYSTEM_STATE_LED 7
#define LIGHTING_PWM_SPEC_IDENTIFY_GREEN PWM_DT_SPEC_GET(DT_ALIAS(pwm_led3))
#include "AppConfigCommon.h"
65 changes: 0 additions & 65 deletions examples/ota-requestor-app/telink/include/AppEvent.h

This file was deleted.

65 changes: 4 additions & 61 deletions examples/ota-requestor-app/telink/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,74 +18,17 @@

#pragma once

#include "AppEvent.h"
#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED
#include "LEDWidget.h"
#endif
#include "PWMDevice.h"
#include "AppTaskCommon.h"

#include <zephyr/drivers/gpio.h>

#include <platform/CHIPDeviceLayer.h>

#include <cstdint>

struct k_timer;
struct Identify;

class AppTask
class AppTask : public AppTaskCommon
{
public:
CHIP_ERROR StartApp(void);

enum Action_t : uint8_t
{
ON_ACTION = 0,
OFF_ACTION,
LEVEL_ACTION,

INVALID_ACTION
};

void PostLightingActionRequest(Action_t aAction);
void PostEvent(AppEvent * event);
static void IdentifyEffectHandler(EmberAfIdentifyEffectIdentifier aEffect);

private:
friend AppTask & GetAppTask(void);
CHIP_ERROR Init(void);

static void ActionInitiated(AppTask::Action_t aAction, int32_t aActor);
static void ActionCompleted(AppTask::Action_t aAction, int32_t aActor);
static void ActionIdentifyStateUpdateHandler(k_timer * timer);

void DispatchEvent(AppEvent * event);

#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED
static void UpdateLedStateEventHandler(AppEvent * aEvent);
static void LEDStateUpdateHandler(LEDWidget * ledWidget);
static void UpdateStatusLED();
#endif
static void FactoryResetButtonEventHandler(void);
static void StartThreadButtonEventHandler(void);
static void StartBleAdvButtonEventHandler(void);

static void ChipEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg);

static void FactoryResetTimerTimeoutCallback(k_timer * timer);

static void FactoryResetTimerEventHandler(AppEvent * aEvent);
static void FactoryResetHandler(AppEvent * aEvent);
static void StartThreadHandler(AppEvent * aEvent);
static void StartBleAdvHandler(AppEvent * aEvent);
static void UpdateIdentifyStateEventHandler(AppEvent * aEvent);

static void InitButtons(void);
friend class AppTaskCommon;

static void ThreadProvisioningHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg);
CHIP_ERROR Init();

static AppTask sAppTask;
PWMDevice mPwmIdentifyLed;
};

inline AppTask & GetAppTask(void)
Expand Down
6 changes: 6 additions & 0 deletions examples/ota-requestor-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
# Enable CHIP pairing automatically on application start.
CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y

# Disable factory data support.
CONFIG_CHIP_FACTORY_DATA=n
CONFIG_CHIP_FACTORY_DATA_BUILD=n
CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n
CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n

# CHIP shell
CONFIG_CHIP_LIB_SHELL=n

Expand Down
Loading