diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index 728d194e876b37..b3714413f08b97 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -416,7 +416,9 @@ void AppTaskCommon::InitPwms() pwmManager.linkBackend(Ws2812Strip::getInstance()); #elif CONFIG_PWM pwmManager.linkBackend(PwmPool::getInstance()); -#endif // CONFIG_WS2812_STRIP +#else + pwmManager.linkBackend(PwmDummy::getInstance()); +#endif } void AppTaskCommon::LinkPwms(PwmManager & pwmManager) diff --git a/examples/platform/telink/util/include/PWMManager.h b/examples/platform/telink/util/include/PWMManager.h index 14e3e0a0d50439..f650d301fb01ad 100644 --- a/examples/platform/telink/util/include/PWMManager.h +++ b/examples/platform/telink/util/include/PWMManager.h @@ -155,6 +155,7 @@ class PwmPool : public PwmBackend class PwmDummy : public PwmBackend { public: + static PwmDummy & getInstance(); bool linkHW(); void setPwmHW(size_t pwm, bool state); diff --git a/examples/platform/telink/util/src/PWMManager.cpp b/examples/platform/telink/util/src/PWMManager.cpp index 4959181f1d9e43..aa747974c93b31 100644 --- a/examples/platform/telink/util/src/PWMManager.cpp +++ b/examples/platform/telink/util/src/PWMManager.cpp @@ -263,31 +263,38 @@ void PwmPool::setPwmHWBreath(size_t pwm, size_t breathMs) #else // Dummy implementation +PwmDummy & PwmDummy::getInstance() +{ + static PwmDummy instance; + + return instance; +} + bool PwmDummy::linkHW() { LOG_INF("PWM Dummy inited"); - return true; + return true; } void PwmDummy::setPwmHW(size_t pwm, bool state) { - LOG_INF("PWM Dummy %u turn %s", pwm, state ? "on" : "off"); + LOG_INF("PWM Dummy %u turn %s", pwm, state ? "on" : "off"); } void PwmDummy::setPwmHW(size_t pwm, uint32_t permille) { - LOG_INF("PWM Dummy %u set %u", pwm, permille); + LOG_INF("PWM Dummy %u set %u", pwm, permille); } void PwmDummy::setPwmHWBlink(size_t pwm, size_t onMs, size_t offMs) { - LOG_WRN("PWM Dummy setPwmHWBlink not supported"); + LOG_WRN("PWM Dummy setPwmHWBlink not supported"); } void PwmDummy::setPwmHWBreath(size_t pwm, size_t breathMs) { - LOG_WRN("PWM Dummy setPwmHWBreath not supported"); + LOG_WRN("PWM Dummy setPwmHWBreath not supported"); } #endif // CONFIG_WS2812_STRIP