16: m_out(output, inverted),
17 m_pwmCycleTimer(timebase, 1, false)
57 m_pwmCycleTimer.
stop();
66void SoftPwm::startOnTime()
68 if (checkForConstantSetting())
75 m_pwmCycleTimer.
start();
78void SoftPwm::startOffTime()
80 if (checkForConstantSetting())
85 m_pwmCycleTimer.
setInterval(m_maxValue - m_pwmValue);
87 m_pwmCycleTimer.
start();
90bool SoftPwm::checkForConstantSetting()
92 bool constant =
false;
96 m_pwmCycleTimer.
stop();
101 else if (m_pwmValue == m_maxValue)
103 m_pwmCycleTimer.
stop();
void set(State state=High) override
Sets the output level of a GPIO pin.
void setInverted(bool inverted) override
Configures the inversion of the output.
Interface class for using a GPIO pin of the microcontroller.
void clear()
Disconnect all functions or methods.
void connect(SlotBase< Arguments... > &slot)
Connect a method to the signal.
unsigned int value() const override
Returns the current PWM value.
unsigned int maxValue() const override
Returns the maximum possible PWM value.
void setMaxValue(unsigned int maxValue) override
Set the maximum possible PWM value.
void set(unsigned int value, bool inverted=false) override
Set a PWM value. Duty cycle is value / maxValue.
bool isEnabled() const override
Returns the current status of PWM module.
SoftPwm(Gpio &output, app::TimeBase &timebase, bool inverted=false)
Constructor.
bool isRunning() const
Check if the timer is running.
void setInterval(uint32_t interval)
Set the timer interval.
void start() override
Start time counting.
A TimeBase is the bridge between e.g. a hardware timer (interrupt service routine) and TickReceiver o...