Skip to content

Commit

Permalink
[Telink] Disable PWM identification in retention mode (#30744)
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiiSalamakha authored and pull[bot] committed Feb 13, 2024
1 parent 6f6748a commit 4745416
Show file tree
Hide file tree
Showing 20 changed files with 37 additions and 13 deletions.
2 changes: 2 additions & 0 deletions examples/air-quality-sensor-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/all-clusters-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/bridge-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion examples/chef/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/contact-sensor-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/light-switch-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/lighting-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions examples/lighting-app/telink/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "AppTaskCommon.h"
#include "PWMDevice.h"

class AppTask : public AppTaskCommon
{
Expand Down
6 changes: 3 additions & 3 deletions examples/lighting-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions examples/lock-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/ota-requestor-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions examples/platform/telink/common/include/AppTaskCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "LEDWidget.h"
#endif

#if APP_USE_IDENTIFY_PWM
#ifdef APP_USE_IDENTIFY_PWM
#include "PWMDevice.h"
#endif

Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions examples/platform/telink/common/src/AppTaskCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions examples/pump-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/pump-controller-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/smoke-co-alarm-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/thermostat/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/window-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4745416

Please sign in to comment.