Skip to content

Commit

Permalink
[Telink] fixed status-led for Lighting app
Browse files Browse the repository at this point in the history
related to PWM
pull: [Telink] Lighting app build with disabled CONFIG_PWM project-chip#35621
  • Loading branch information
interfer committed Sep 25, 2024
1 parent 3015ffe commit c400248
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
10 changes: 7 additions & 3 deletions examples/lighting-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ void AppTask::PowerOnFactoryResetTimerEvent(struct k_timer * timer)

void AppTask::LinkLeds(LedManager & ledManager)
{
#if (!CONFIG_PWM)
ledManager.linkLed(LedManager::EAppLed_App0, 0);
#endif // !CONFIG_PWM
#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED
ledManager.linkLed(LedManager::EAppLed_Status, 0);
#endif

#if !CONFIG_PWM
ledManager.linkLed(LedManager::EAppLed_App0, 1);
#endif /* !CONFIG_PWM */
}
11 changes: 4 additions & 7 deletions examples/platform/telink/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
# limitations under the License.

string(REPLACE "_retention" "" BASE_BOARD ${BOARD})
string(REGEX REPLACE "_v[0-9]+" "" BASE_BOARD ${BASE_BOARD})

if(NOT FLASH_SIZE)
if(${BASE_BOARD} MATCHES "tlsr9118bdk40d" OR ${BASE_BOARD} MATCHES "tlsr9118bdk40d_v1"
OR ${BASE_BOARD} MATCHES "tlsr9118bdk40d_v2")
if(${BASE_BOARD} MATCHES "tlsr9118bdk40d")
set(FLASH_SIZE "3m")
else()
set(FLASH_SIZE "2m")
Expand Down Expand Up @@ -99,11 +99,8 @@ endif()

set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}_${FLASH_SIZE}_flash.overlay")
if(NOT EXISTS "${FLASH_DTC_OVERLAY_FILE}")
if(${BASE_BOARD} MATCHES "tlsr9118bdk40d_v1" OR ${BASE_BOARD} MATCHES "tlsr9118bdk40d_v2")
set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/tlsr9118bdk40d_${FLASH_SIZE}_flash.overlay")
else()
message(FATAL_ERROR "${FLASH_DTC_OVERLAY_FILE} doesn't exist")
endif()
message(STATUS "${FLASH_DTC_OVERLAY_FILE} doesn't exist")
unset(FLASH_DTC_OVERLAY_FILE)
endif()

if(DTC_OVERLAY_FILE)
Expand Down
4 changes: 3 additions & 1 deletion examples/platform/telink/common/src/AppTaskCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,9 @@ void AppTaskCommon::InitPwms()

void AppTaskCommon::LinkPwms(PwmManager & pwmManager)
{
#if CONFIG_WS2812_STRIP
#if CONFIG_BOARD_TLSR9118BDK40D_V1 && CONFIG_PWM // TLSR9118BDK40D_V1 EVK supports single LED PWM channel
pwmManager.linkPwm(PwmManager::EAppPwm_Red, 0);
#elif CONFIG_WS2812_STRIP
pwmManager.linkPwm(PwmManager::EAppPwm_Red, 0);
pwmManager.linkPwm(PwmManager::EAppPwm_Green, 1);
pwmManager.linkPwm(PwmManager::EAppPwm_Blue, 2);
Expand Down

0 comments on commit c400248

Please sign in to comment.