From 1328464615ee037de2f965799e63a4fe1be43abe Mon Sep 17 00:00:00 2001 From: Serhii Salamakha Date: Thu, 30 Nov 2023 21:23:12 +0200 Subject: [PATCH] [Telink] Disable PWM identification in retention mode (#30744) --- .../air-quality-sensor-app/telink/include/AppConfig.h | 2 ++ examples/all-clusters-app/telink/include/AppConfig.h | 2 ++ .../telink/include/AppConfig.h | 1 - examples/bridge-app/telink/include/AppConfig.h | 2 ++ examples/chef/telink/include/AppConfig.h | 1 - examples/contact-sensor-app/telink/include/AppConfig.h | 2 ++ examples/light-switch-app/telink/include/AppConfig.h | 2 ++ examples/lighting-app/telink/include/AppConfig.h | 2 ++ examples/lighting-app/telink/include/AppTask.h | 1 + examples/lighting-app/telink/src/AppTask.cpp | 6 +++--- examples/lock-app/telink/include/AppConfig.h | 2 ++ examples/ota-requestor-app/telink/include/AppConfig.h | 2 ++ .../platform/telink/common/include/AppTaskCommon.h | 4 ++-- examples/platform/telink/common/src/AppTaskCommon.cpp | 10 +++++----- examples/pump-app/telink/include/AppConfig.h | 2 ++ .../pump-controller-app/telink/include/AppConfig.h | 2 ++ examples/smoke-co-alarm-app/telink/include/AppConfig.h | 2 ++ .../telink/include/AppConfig.h | 1 - examples/thermostat/telink/include/AppConfig.h | 2 ++ examples/window-app/telink/include/AppConfig.h | 2 ++ 20 files changed, 37 insertions(+), 13 deletions(-) diff --git a/examples/air-quality-sensor-app/telink/include/AppConfig.h b/examples/air-quality-sensor-app/telink/include/AppConfig.h index ec5c54343cf852..7513ed3771b961 100644 --- a/examples/air-quality-sensor-app/telink/include/AppConfig.h +++ b/examples/air-quality-sensor-app/telink/include/AppConfig.h @@ -25,4 +25,6 @@ #define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif diff --git a/examples/all-clusters-app/telink/include/AppConfig.h b/examples/all-clusters-app/telink/include/AppConfig.h index 0329fd5f8a4392..68263bbda460db 100644 --- a/examples/all-clusters-app/telink/include/AppConfig.h +++ b/examples/all-clusters-app/telink/include/AppConfig.h @@ -24,4 +24,6 @@ #define APP_USE_THREAD_START_BUTTON 1 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 1 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif diff --git a/examples/all-clusters-minimal-app/telink/include/AppConfig.h b/examples/all-clusters-minimal-app/telink/include/AppConfig.h index 7cd1d6e62a3fc7..5ef62e04203e1b 100644 --- a/examples/all-clusters-minimal-app/telink/include/AppConfig.h +++ b/examples/all-clusters-minimal-app/telink/include/AppConfig.h @@ -25,4 +25,3 @@ #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 diff --git a/examples/bridge-app/telink/include/AppConfig.h b/examples/bridge-app/telink/include/AppConfig.h index 15a358a2920abe..e5e26efb2871d1 100644 --- a/examples/bridge-app/telink/include/AppConfig.h +++ b/examples/bridge-app/telink/include/AppConfig.h @@ -25,4 +25,6 @@ #define APP_USE_THREAD_START_BUTTON 1 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif diff --git a/examples/chef/telink/include/AppConfig.h b/examples/chef/telink/include/AppConfig.h index e5c7b0417ef160..b3092856c49902 100644 --- a/examples/chef/telink/include/AppConfig.h +++ b/examples/chef/telink/include/AppConfig.h @@ -25,4 +25,3 @@ #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 0 diff --git a/examples/contact-sensor-app/telink/include/AppConfig.h b/examples/contact-sensor-app/telink/include/AppConfig.h index bd38d80b41282d..feb2b82d7417fc 100644 --- a/examples/contact-sensor-app/telink/include/AppConfig.h +++ b/examples/contact-sensor-app/telink/include/AppConfig.h @@ -24,4 +24,6 @@ #define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif diff --git a/examples/light-switch-app/telink/include/AppConfig.h b/examples/light-switch-app/telink/include/AppConfig.h index 3ee892f2494bad..8258f39573039c 100644 --- a/examples/light-switch-app/telink/include/AppConfig.h +++ b/examples/light-switch-app/telink/include/AppConfig.h @@ -25,4 +25,6 @@ #define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif diff --git a/examples/lighting-app/telink/include/AppConfig.h b/examples/lighting-app/telink/include/AppConfig.h index e677ba3a2ef7db..b616746393ff03 100644 --- a/examples/lighting-app/telink/include/AppConfig.h +++ b/examples/lighting-app/telink/include/AppConfig.h @@ -25,7 +25,9 @@ #define APP_USE_THREAD_START_BUTTON 1 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif // Lighting LED config #define USE_RGB_PWM 0 diff --git a/examples/lighting-app/telink/include/AppTask.h b/examples/lighting-app/telink/include/AppTask.h index 764cb209505a82..67b69ef84e2e45 100644 --- a/examples/lighting-app/telink/include/AppTask.h +++ b/examples/lighting-app/telink/include/AppTask.h @@ -19,6 +19,7 @@ #pragma once #include "AppTaskCommon.h" +#include "PWMDevice.h" class AppTask : public AppTaskCommon { diff --git a/examples/lighting-app/telink/src/AppTask.cpp b/examples/lighting-app/telink/src/AppTask.cpp index 7dbb9e1aac2102..fde4a836c90886 100644 --- a/examples/lighting-app/telink/src/AppTask.cpp +++ b/examples/lighting-app/telink/src/AppTask.cpp @@ -30,10 +30,10 @@ namespace { #ifdef CONFIG_WS2812_STRIP const struct device * const ws2812_dev = DEVICE_DT_GET(DT_ALIAS(led_strip)); #else -const struct pwm_dt_spec sPwmRgbSpecBlueLed = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0)); +const struct pwm_dt_spec sPwmRgbSpecBlueLed = PWM_DT_SPEC_GET_OR(DT_ALIAS(pwm_led0), {}); #if USE_RGB_PWM -const struct pwm_dt_spec sPwmRgbSpecGreenLed = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led1)); -const struct pwm_dt_spec sPwmRgbSpecRedLed = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led2)); +const struct pwm_dt_spec sPwmRgbSpecGreenLed = PWM_DT_SPEC_GET_OR(DT_ALIAS(pwm_led1), {}); +const struct pwm_dt_spec sPwmRgbSpecRedLed = PWM_DT_SPEC_GET_OR(DT_ALIAS(pwm_led2), {}); #endif #endif // CONFIG_WS2812_STRIP diff --git a/examples/lock-app/telink/include/AppConfig.h b/examples/lock-app/telink/include/AppConfig.h index f4b55ec79564af..05bbd6afa79d46 100644 --- a/examples/lock-app/telink/include/AppConfig.h +++ b/examples/lock-app/telink/include/AppConfig.h @@ -34,4 +34,6 @@ #define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif diff --git a/examples/ota-requestor-app/telink/include/AppConfig.h b/examples/ota-requestor-app/telink/include/AppConfig.h index 9cda66df104ff7..05e62e8b612725 100644 --- a/examples/ota-requestor-app/telink/include/AppConfig.h +++ b/examples/ota-requestor-app/telink/include/AppConfig.h @@ -25,4 +25,6 @@ #define APP_USE_THREAD_START_BUTTON 1 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 1 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif diff --git a/examples/platform/telink/common/include/AppTaskCommon.h b/examples/platform/telink/common/include/AppTaskCommon.h index 8cb25d4e8cbede..7bacaeb4377ee4 100644 --- a/examples/platform/telink/common/include/AppTaskCommon.h +++ b/examples/platform/telink/common/include/AppTaskCommon.h @@ -25,7 +25,7 @@ #include "LEDWidget.h" #endif -#if APP_USE_IDENTIFY_PWM +#ifdef APP_USE_IDENTIFY_PWM #include "PWMDevice.h" #endif @@ -121,7 +121,7 @@ class AppTaskCommon static void ChipEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); -#if APP_USE_IDENTIFY_PWM +#ifdef APP_USE_IDENTIFY_PWM PWMDevice mPwmIdentifyLed; static void ActionIdentifyStateUpdateHandler(k_timer * timer); diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index d2aa42bfdeb258..cd3831caa40c1c 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -64,7 +64,7 @@ const struct gpio_dt_spec sButtonRow1Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matr const struct gpio_dt_spec sButtonRow2Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_row2), gpios); #endif -#if APP_USE_IDENTIFY_PWM +#ifdef APP_USE_IDENTIFY_PWM constexpr uint32_t kIdentifyBlinkRateMs = 200; constexpr uint32_t kIdentifyOkayOnRateMs = 50; constexpr uint32_t kIdentifyOkayOffRateMs = 950; @@ -73,7 +73,7 @@ constexpr uint32_t kIdentifyFinishOffRateMs = 50; constexpr uint32_t kIdentifyChannelChangeRateMs = 1000; constexpr uint32_t kIdentifyBreatheRateMs = 1000; -const struct pwm_dt_spec sPwmIdentifySpecGreenLed = PWM_DT_SPEC_GET_OR(DT_ALIAS(pwm_led3), {}); +const struct pwm_dt_spec sPwmIdentifySpecGreenLed = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led3)); #endif #if APP_SET_NETWORK_COMM_ENDPOINT_SEC @@ -110,7 +110,7 @@ bool sHaveBLEConnections = false; chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; #endif -#if APP_USE_IDENTIFY_PWM +#ifdef APP_USE_IDENTIFY_PWM void OnIdentifyTriggerEffect(Identify * identify) { AppTaskCommon::IdentifyEffectHandler(identify->mCurrentEffectIdentifier); @@ -272,7 +272,7 @@ CHIP_ERROR AppTaskCommon::InitCommonParts(void) k_timer_init(&sFactoryResetTimer, &AppTask::FactoryResetTimerTimeoutCallback, nullptr); k_timer_user_data_set(&sFactoryResetTimer, this); -#if APP_USE_IDENTIFY_PWM +#ifdef APP_USE_IDENTIFY_PWM // Initialize PWM Identify led err = GetAppTask().mPwmIdentifyLed.Init(&sPwmIdentifySpecGreenLed, kDefaultMinLevel, kDefaultMaxLevel, kDefaultMaxLevel); if (err != CHIP_NO_ERROR) @@ -464,7 +464,7 @@ void AppTaskCommon::UpdateStatusLED() } #endif -#if APP_USE_IDENTIFY_PWM +#ifdef APP_USE_IDENTIFY_PWM void AppTaskCommon::ActionIdentifyStateUpdateHandler(k_timer * timer) { AppEvent event; diff --git a/examples/pump-app/telink/include/AppConfig.h b/examples/pump-app/telink/include/AppConfig.h index 03aee4e8063bf8..85792a55a3d316 100644 --- a/examples/pump-app/telink/include/AppConfig.h +++ b/examples/pump-app/telink/include/AppConfig.h @@ -25,7 +25,9 @@ #define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif // Time it takes in ms for the simulated pump to move from one state to another. #define PUMP_START_PERIOS_MS 2000 diff --git a/examples/pump-controller-app/telink/include/AppConfig.h b/examples/pump-controller-app/telink/include/AppConfig.h index c843625ced4207..1650e13ca88d8c 100644 --- a/examples/pump-controller-app/telink/include/AppConfig.h +++ b/examples/pump-controller-app/telink/include/AppConfig.h @@ -25,7 +25,9 @@ #define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif // Time it takes in ms for the simulated pump to move from one state to another. #define PUMP_START_PERIOS_MS 2000 diff --git a/examples/smoke-co-alarm-app/telink/include/AppConfig.h b/examples/smoke-co-alarm-app/telink/include/AppConfig.h index bfaeb98eb8ac15..f002310df57420 100644 --- a/examples/smoke-co-alarm-app/telink/include/AppConfig.h +++ b/examples/smoke-co-alarm-app/telink/include/AppConfig.h @@ -25,4 +25,6 @@ #define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif diff --git a/examples/temperature-measurement-app/telink/include/AppConfig.h b/examples/temperature-measurement-app/telink/include/AppConfig.h index 76e68ac1b1349c..b0e7847e16fdcb 100644 --- a/examples/temperature-measurement-app/telink/include/AppConfig.h +++ b/examples/temperature-measurement-app/telink/include/AppConfig.h @@ -25,4 +25,3 @@ #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 0 diff --git a/examples/thermostat/telink/include/AppConfig.h b/examples/thermostat/telink/include/AppConfig.h index 8fc6ceac48ad19..9b427c5644145f 100644 --- a/examples/thermostat/telink/include/AppConfig.h +++ b/examples/thermostat/telink/include/AppConfig.h @@ -25,4 +25,6 @@ #define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif diff --git a/examples/window-app/telink/include/AppConfig.h b/examples/window-app/telink/include/AppConfig.h index f729f0a018d8d9..f0ace63aecd608 100644 --- a/examples/window-app/telink/include/AppConfig.h +++ b/examples/window-app/telink/include/AppConfig.h @@ -24,4 +24,6 @@ #define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) #define APP_USE_IDENTIFY_PWM 1 +#endif