Skip to content

Commit

Permalink
save changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BorysNykytiuk committed Sep 10, 2024
1 parent 698bbbb commit abd391f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
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()
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)
Expand Down
1 change: 1 addition & 0 deletions examples/platform/telink/util/include/PWMManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 12 additions & 5 deletions examples/platform/telink/util/src/PWMManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit abd391f

Please sign in to comment.