Sfoglia il codice sorgente

[Telink] LEDs & Buttons DTS improvements (#27034)

Co-authored-by: Andrei Litvin <andy314@gmail.com>
Alex Tsitsiura 2 anni fa
parent
commit
b552c54940
27 ha cambiato i file con 49 aggiunte e 144 eliminazioni
  1. 1 3
      examples/all-clusters-app/telink/include/AppConfig.h
  2. 1 3
      examples/all-clusters-minimal-app/telink/include/AppConfig.h
  3. 1 5
      examples/bridge-app/telink/include/AppConfig.h
  4. 1 1
      examples/bridge-app/telink/src/AppTask.cpp
  5. 1 5
      examples/contact-sensor-app/telink/include/AppConfig.h
  6. 1 1
      examples/contact-sensor-app/telink/src/AppTask.cpp
  7. 1 3
      examples/light-switch-app/telink/include/AppConfig.h
  8. 1 9
      examples/lighting-app/telink/include/AppConfig.h
  9. 3 3
      examples/lighting-app/telink/src/AppTask.cpp
  10. 1 5
      examples/lock-app/telink/include/AppConfig.h
  11. 1 1
      examples/lock-app/telink/src/AppTask.cpp
  12. 1 3
      examples/ota-requestor-app/telink/include/AppConfig.h
  13. 0 39
      examples/platform/telink/common/include/AppConfigCommon.h
  14. 10 11
      examples/platform/telink/common/src/AppTaskCommon.cpp
  15. 2 4
      examples/platform/telink/util/include/LEDWidget.h
  16. 1 1
      examples/platform/telink/util/src/ButtonManager.cpp
  17. 6 16
      examples/platform/telink/util/src/LEDWidget.cpp
  18. 1 4
      examples/pump-app/telink/include/AppConfig.h
  19. 1 1
      examples/pump-app/telink/src/AppTask.cpp
  20. 1 4
      examples/pump-controller-app/telink/include/AppConfig.h
  21. 1 1
      examples/pump-controller-app/telink/src/AppTask.cpp
  22. 1 3
      examples/temperature-measurement-app/telink/include/AppConfig.h
  23. 1 3
      examples/thermostat/telink/include/AppConfig.h
  24. 1 7
      examples/window-app/telink/include/AppConfig.h
  25. 6 6
      examples/window-app/telink/src/AppTask.cpp
  26. 2 2
      examples/window-app/telink/src/WindowCovering.cpp
  27. 1 0
      src/platform/telink/tlsr9518adk80d.overlay

+ 1 - 3
examples/all-clusters-app/telink/include/AppConfig.h

@@ -23,6 +23,4 @@
 #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"
+#define APP_USE_IDENTIFY_PWM 1

+ 1 - 3
examples/all-clusters-minimal-app/telink/include/AppConfig.h

@@ -24,6 +24,4 @@
 #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"
+#define APP_USE_IDENTIFY_PWM 0

+ 1 - 5
examples/bridge-app/telink/include/AppConfig.h

@@ -24,8 +24,4 @@
 #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"
-
-#define LIGHTING_PWM_SPEC_RGB_BLUE PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0))
+#define APP_USE_IDENTIFY_PWM 1

+ 1 - 1
examples/bridge-app/telink/src/AppTask.cpp

@@ -26,7 +26,7 @@
 LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);
 
 namespace {
-const struct pwm_dt_spec sPwmRgbSpecBlueLed = LIGHTING_PWM_SPEC_RGB_BLUE;
+const struct pwm_dt_spec sPwmRgbSpecBlueLed = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0));
 } // namespace
 
 AppTask AppTask::sAppTask;

+ 1 - 5
examples/contact-sensor-app/telink/include/AppConfig.h

@@ -23,8 +23,4 @@
 #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"
-
-#define CONTACT_STATE_LED 6
+#define APP_USE_IDENTIFY_PWM 1

+ 1 - 1
examples/contact-sensor-app/telink/src/AppTask.cpp

@@ -41,7 +41,7 @@ CHIP_ERROR AppTask::Init(void)
     InitCommonParts();
 
 #if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED
-    sContactSensorLED.Init(CONTACT_STATE_LED);
+    sContactSensorLED.Init(GPIO_DT_SPEC_GET(DT_ALIAS(led2), gpios));
     sContactSensorLED.Set(ContactSensorMgr().IsContactClosed());
 #endif
 

+ 1 - 3
examples/light-switch-app/telink/include/AppConfig.h

@@ -24,6 +24,4 @@
 #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"
+#define APP_USE_IDENTIFY_PWM 1

+ 1 - 9
examples/lighting-app/telink/include/AppConfig.h

@@ -24,15 +24,7 @@
 #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"
+#define APP_USE_IDENTIFY_PWM 1
 
 // Lighting LED config
 #define USE_RGB_PWM 0
-
-#define LIGHTING_PWM_SPEC_RGB_BLUE PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0))
-#if USE_RGB_PWM
-#define LIGHTING_PWM_SPEC_RGB_GREEN PWM_DT_SPEC_GET(DT_ALIAS(pwm_led1))
-#define LIGHTING_PWM_SPEC_RGB_RED PWM_DT_SPEC_GET(DT_ALIAS(pwm_led2))
-#endif

+ 3 - 3
examples/lighting-app/telink/src/AppTask.cpp

@@ -26,10 +26,10 @@
 LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);
 
 namespace {
-const struct pwm_dt_spec sPwmRgbSpecBlueLed = LIGHTING_PWM_SPEC_RGB_BLUE;
+const struct pwm_dt_spec sPwmRgbSpecBlueLed = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0));
 #if USE_RGB_PWM
-const struct pwm_dt_spec sPwmRgbSpecGreenLed = LIGHTING_PWM_SPEC_RGB_GREEN;
-const struct pwm_dt_spec sPwmRgbSpecRedLed   = LIGHTING_PWM_SPEC_RGB_RED;
+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));
 
 uint8_t sBrightness;
 PWMDevice::Action_t sColorAction = PWMDevice::INVALID_ACTION;

+ 1 - 5
examples/lock-app/telink/include/AppConfig.h

@@ -24,8 +24,4 @@
 #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"
-
-#define LOCK_STATE_LED 6
+#define APP_USE_IDENTIFY_PWM 1

+ 1 - 1
examples/lock-app/telink/src/AppTask.cpp

@@ -41,7 +41,7 @@ CHIP_ERROR AppTask::Init(void)
     InitCommonParts();
 
 #if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED
-    sLockLED.Init(LOCK_STATE_LED);
+    sLockLED.Init(GPIO_DT_SPEC_GET(DT_ALIAS(led2), gpios));
     sLockLED.Set(BoltLockMgr().IsLocked());
 #endif
 

+ 1 - 3
examples/ota-requestor-app/telink/include/AppConfig.h

@@ -24,6 +24,4 @@
 #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"
+#define APP_USE_IDENTIFY_PWM 1

+ 0 - 39
examples/platform/telink/common/include/AppConfigCommon.h

@@ -1,39 +0,0 @@
-/*
- *
- *    Copyright (c) 2022-2023 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.
- */
-
-#pragma once
-
-// Buttons config
-#if CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE
-#define BUTTON_FACTORY_RESET GPIO_DT_SPEC_GET(DT_NODELABEL(key_1), gpios)
-#define BUTTON_BLE_START GPIO_DT_SPEC_GET(DT_NODELABEL(key_2), gpios)
-#define BUTTON_THREAD_START GPIO_DT_SPEC_GET(DT_NODELABEL(key_3), gpios)
-#define BUTTON_EXAMPLE_ACTION GPIO_DT_SPEC_GET(DT_NODELABEL(key_4), gpios)
-#else
-#define BUTTON_COL_1 GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_col1), gpios)
-#define BUTTON_COL_2 GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_col2), gpios)
-#define BUTTON_ROW_1 GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_row1), gpios)
-#define BUTTON_ROW_2 GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_row2), gpios)
-#endif
-
-// LEDs config
-#define LEDS_PORT DEVICE_DT_GET(DT_NODELABEL(gpiob))
-#define SYSTEM_STATE_LED 7
-#if APP_USE_IDENTIFY_PWM
-#define LIGHTING_PWM_SPEC_IDENTIFY_GREEN PWM_DT_SPEC_GET(DT_ALIAS(pwm_led3))
-#endif

+ 10 - 11
examples/platform/telink/common/src/AppTaskCommon.cpp

@@ -54,19 +54,19 @@ constexpr int kFactoryResetTriggerCntr = 3;
 constexpr int kAppEventQueueSize       = 10;
 
 #if CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE
-const struct gpio_dt_spec sFactoryResetButtonDt = BUTTON_FACTORY_RESET;
-const struct gpio_dt_spec sBleStartButtonDt     = BUTTON_BLE_START;
+const struct gpio_dt_spec sFactoryResetButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_1), gpios);
+const struct gpio_dt_spec sBleStartButtonDt     = GPIO_DT_SPEC_GET(DT_NODELABEL(key_2), gpios);
 #if APP_USE_THREAD_START_BUTTON
-const struct gpio_dt_spec sThreadStartButtonDt = BUTTON_THREAD_START;
+const struct gpio_dt_spec sThreadStartButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_3), gpios);
 #endif
 #if APP_USE_EXAMPLE_START_BUTTON
-const struct gpio_dt_spec sExampleActionButtonDt = BUTTON_EXAMPLE_ACTION;
+const struct gpio_dt_spec sExampleActionButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_4), gpios);
 #endif
 #else
-const struct gpio_dt_spec sButtonCol1Dt = BUTTON_COL_1;
-const struct gpio_dt_spec sButtonCol2Dt = BUTTON_COL_2;
-const struct gpio_dt_spec sButtonRow1Dt = BUTTON_ROW_1;
-const struct gpio_dt_spec sButtonRow2Dt = BUTTON_ROW_2;
+const struct gpio_dt_spec sButtonCol1Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_col1), gpios);
+const struct gpio_dt_spec sButtonCol2Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_col2), gpios);
+const struct gpio_dt_spec sButtonRow1Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_row1), gpios);
+const struct gpio_dt_spec sButtonRow2Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_row2), gpios);
 #endif
 
 #if APP_USE_IDENTIFY_PWM
@@ -78,7 +78,7 @@ constexpr uint32_t kIdentifyFinishOffRateMs     = 50;
 constexpr uint32_t kIdentifyChannelChangeRateMs = 1000;
 constexpr uint32_t kIdentifyBreatheRateMs       = 1000;
 
-const struct pwm_dt_spec sPwmIdentifySpecGreenLed = LIGHTING_PWM_SPEC_IDENTIFY_GREEN;
+const struct pwm_dt_spec sPwmIdentifySpecGreenLed = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led3));
 #endif
 
 #if APP_SET_NETWORK_COMM_ENDPOINT_SEC
@@ -247,9 +247,8 @@ CHIP_ERROR AppTaskCommon::InitCommonParts(void)
 
     // Initialize status LED
 #if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED
-    LEDWidget::InitGpio(LEDS_PORT);
     LEDWidget::SetStateUpdateCallback(LEDStateUpdateHandler);
-    sStatusLED.Init(SYSTEM_STATE_LED);
+    sStatusLED.Init(GPIO_DT_SPEC_GET(DT_ALIAS(system_state_led), gpios));
 
     UpdateStatusLED();
 #endif

+ 2 - 4
examples/platform/telink/util/include/LEDWidget.h

@@ -26,10 +26,8 @@ class LEDWidget
 public:
     typedef void (*LEDWidgetStateUpdateHandler)(LEDWidget * ledWidget);
 
-    static void InitGpio(const device * port);
     static void SetStateUpdateCallback(LEDWidgetStateUpdateHandler stateUpdateCb);
-    const static struct device * mPort;
-    void Init(gpio_pin_t gpioNum);
+    void Init(gpio_dt_spec gpio);
     void Set(bool state);
     void Invert(void);
     void Blink(uint32_t changeRateMS);
@@ -39,7 +37,7 @@ public:
 private:
     uint32_t mBlinkOnTimeMS;
     uint32_t mBlinkOffTimeMS;
-    gpio_pin_t mGPIONum;
+    gpio_dt_spec mGPIO;
     bool mState;
     k_timer mLedTimer;
 

+ 1 - 1
examples/platform/telink/util/src/ButtonManager.cpp

@@ -95,7 +95,7 @@ int Button::Deinit(void)
     int ret = 0;
 
     /* Reconfigure output key pin to input */
-    ret = gpio_pin_configure(mOutput_matrix_pin->port, mOutput_matrix_pin->pin, GPIO_INPUT | GPIO_PULL_DOWN);
+    ret = gpio_pin_configure_dt(mOutput_matrix_pin, GPIO_INPUT | GPIO_PULL_DOWN);
     if (ret < 0)
     {
         LOG_ERR("Reconfig out pin err: %d", ret);

+ 6 - 16
examples/platform/telink/util/src/LEDWidget.cpp

@@ -23,35 +23,25 @@
 
 LOG_MODULE_REGISTER(LEDWidget);
 
-const struct device * LEDWidget::mPort = NULL;
 static LEDWidget::LEDWidgetStateUpdateHandler sStateUpdateCallback;
 
-void LEDWidget::InitGpio(const device * port)
-{
-    mPort = port;
-    if (!device_is_ready(mPort))
-    {
-        LOG_ERR("%s is not ready\n", mPort->name);
-    }
-}
-
 void LEDWidget::SetStateUpdateCallback(LEDWidgetStateUpdateHandler stateUpdateCb)
 {
     if (stateUpdateCb)
         sStateUpdateCallback = stateUpdateCb;
 }
 
-void LEDWidget::Init(gpio_pin_t gpioNum)
+void LEDWidget::Init(gpio_dt_spec gpio)
 {
     mBlinkOnTimeMS  = 0;
     mBlinkOffTimeMS = 0;
-    mGPIONum        = gpioNum;
+    mGPIO           = gpio;
     mState          = false;
 
-    int ret = gpio_pin_configure(mPort, mGPIONum, GPIO_OUTPUT_ACTIVE);
+    int ret = gpio_pin_configure_dt(&mGPIO, GPIO_OUTPUT_ACTIVE);
     if (ret < 0)
     {
-        LOG_ERR("GPIO pin %d configure - fail. Status%d\n", mGPIONum, ret);
+        LOG_ERR("GPIO pin %d configure - fail. Status%d\n", mGPIO.pin, ret);
     }
 
     k_timer_init(&mLedTimer, &LEDWidget::LedStateTimerHandler, nullptr);
@@ -99,10 +89,10 @@ void LEDWidget::ScheduleStateChange()
 void LEDWidget::DoSet(bool state)
 {
     mState  = state;
-    int ret = gpio_pin_set(mPort, mGPIONum, state);
+    int ret = gpio_pin_set_dt(&mGPIO, state);
     if (ret < 0)
     {
-        LOG_ERR("GPIO pin %d set -fail. Status: %d\n", mGPIONum, ret);
+        LOG_ERR("GPIO pin %d set -fail. Status: %d\n", mGPIO.pin, ret);
     }
 }
 

+ 1 - 4
examples/pump-app/telink/include/AppConfig.h

@@ -24,10 +24,7 @@
 #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"
+#define APP_USE_IDENTIFY_PWM 1
 
-#include "AppConfigCommon.h"
-
-#define PUMP_STATE_LED 6
 // Time it takes in ms for the simulated pump to move from one state to another.
 #define PUMP_START_PERIOS_MS 2000

+ 1 - 1
examples/pump-app/telink/src/AppTask.cpp

@@ -42,7 +42,7 @@ CHIP_ERROR AppTask::Init(void)
     InitCommonParts();
 
 #if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED
-    sPumpStateLED.Init(PUMP_STATE_LED);
+    sPumpStateLED.Init(GPIO_DT_SPEC_GET(DT_ALIAS(led2), gpios));
     sPumpStateLED.Set(!PumpMgr().IsStopped());
 #endif
 

+ 1 - 4
examples/pump-controller-app/telink/include/AppConfig.h

@@ -24,10 +24,7 @@
 #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"
+#define APP_USE_IDENTIFY_PWM 1
 
-#include "AppConfigCommon.h"
-
-#define PUMP_STATE_LED 6
 // Time it takes in ms for the simulated pump to move from one state to another.
 #define PUMP_START_PERIOS_MS 2000

+ 1 - 1
examples/pump-controller-app/telink/src/AppTask.cpp

@@ -40,7 +40,7 @@ CHIP_ERROR AppTask::Init(void)
     InitCommonParts();
 
 #if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED
-    sPumpStateLED.Init(PUMP_STATE_LED);
+    sPumpStateLED.Init(GPIO_DT_SPEC_GET(DT_ALIAS(led2), gpios));
     sPumpStateLED.Set(!PumpMgr().IsStopped());
 #endif
 

+ 1 - 3
examples/temperature-measurement-app/telink/include/AppConfig.h

@@ -24,6 +24,4 @@
 #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 // APP_USE_IDENTIFY_PWM must be defined before including "AppConfigCommon.h"
-
-#include "AppConfigCommon.h"
+#define APP_USE_IDENTIFY_PWM 0

+ 1 - 3
examples/thermostat/telink/include/AppConfig.h

@@ -24,6 +24,4 @@
 #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"
+#define APP_USE_IDENTIFY_PWM 1

+ 1 - 7
examples/window-app/telink/include/AppConfig.h

@@ -24,10 +24,4 @@
 #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"
-#define LIGHTING_PWM_SPEC_RGB_BLUE PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0))
-
-// NOTE: pwm_led1 by default DTS is used by PE0, so get an external LED connected to that pin
-#define LIGHTING_PWM_SPEC_RGB_GREEN PWM_DT_SPEC_GET(DT_ALIAS(pwm_led1))
+#define APP_USE_IDENTIFY_PWM 1

+ 6 - 6
examples/window-app/telink/src/AppTask.cpp

@@ -28,16 +28,16 @@ constexpr int kToggleMoveTypeTriggerTimeout = 700;
 k_timer sToggleMoveTypeTimer;
 
 #if CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE
-#define OPEN_WINDOW_BUTTON BUTTON_EXAMPLE_ACTION
-#define CLOSE_WINDOW_BUTTON BUTTON_THREAD_START
+#define OPEN_WINDOW_BUTTON GPIO_DT_SPEC_GET(DT_NODELABEL(key_4), gpios)
+#define CLOSE_WINDOW_BUTTON GPIO_DT_SPEC_GET(DT_NODELABEL(key_3), gpios)
 
 const struct gpio_dt_spec sOpenWindowButtonDt  = OPEN_WINDOW_BUTTON;
 const struct gpio_dt_spec sCloseWindowButtonDt = CLOSE_WINDOW_BUTTON;
 #else
-const struct gpio_dt_spec sButtonCol1Dt = BUTTON_COL_1;
-const struct gpio_dt_spec sButtonCol2Dt = BUTTON_COL_2;
-const struct gpio_dt_spec sButtonRow1Dt = BUTTON_ROW_1;
-const struct gpio_dt_spec sButtonRow2Dt = BUTTON_ROW_2;
+const struct gpio_dt_spec sButtonCol1Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_col1), gpios);
+const struct gpio_dt_spec sButtonCol2Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_col2), gpios);
+const struct gpio_dt_spec sButtonRow1Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_row1), gpios);
+const struct gpio_dt_spec sButtonRow2Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_row2), gpios);
 #endif
 
 Button sOpenButton;

+ 2 - 2
examples/window-app/telink/src/WindowCovering.cpp

@@ -31,8 +31,8 @@ using namespace ::chip::Credentials;
 using namespace ::chip::DeviceLayer;
 using namespace chip::app::Clusters::WindowCovering;
 
-static const struct pwm_dt_spec sLiftPwmDevice = LIGHTING_PWM_SPEC_RGB_BLUE;
-static const struct pwm_dt_spec sTiltPwmDevice = LIGHTING_PWM_SPEC_RGB_GREEN;
+static const struct pwm_dt_spec sLiftPwmDevice = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0));
+static const struct pwm_dt_spec sTiltPwmDevice = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led1));
 
 static constexpr uint32_t sMoveTimeoutMs{ 200 };
 constexpr uint16_t sPercentDelta   = 500;

+ 1 - 0
src/platform/telink/tlsr9518adk80d.overlay

@@ -1,5 +1,6 @@
 / {
 	aliases {
+		system-state-led = &led_red;
 		pwm-led0 = &pwm_led0;
 		pwm-led1 = &pwm_led1;
 		pwm-led2 = &pwm_led2;