semf
|
The SoftPwm
class outputs a PWM signal on the given GPIO.
More...
#include <softpwm.h>
Public Member Functions | |
SoftPwm (Gpio &output, app::TimeBase &timebase, bool inverted=false) | |
Constructor. More... | |
SoftPwm (const SoftPwm &other)=delete | |
virtual | ~SoftPwm ()=default |
void | setMaxValue (unsigned int maxValue) override |
Set the maximum possible PWM value. More... | |
unsigned int | maxValue () const override |
Returns the maximum possible PWM value. More... | |
void | set (unsigned int value, bool inverted=false) override |
Set a PWM value. Duty cycle is value / maxValue. More... | |
unsigned int | value () const override |
Returns the current PWM value. More... | |
void | start () override |
void | stop () override |
bool | isEnabled () const override |
Returns the current status of PWM module. More... | |
Public Member Functions inherited from semf::Pwm | |
virtual | ~Pwm ()=default |
virtual void | setMaxValue (unsigned int maxValue)=0 |
Set the maximum possible PWM value. More... | |
virtual unsigned int | maxValue () const =0 |
Returns the maximum possible PWM value. More... | |
virtual void | set (unsigned int value, bool inverted=false)=0 |
Set a PWM value. Duty cycle is value / maxValue. More... | |
virtual unsigned int | value () const =0 |
Returns the current PWM value. More... | |
virtual void | start ()=0 |
virtual void | stop ()=0 |
virtual bool | isEnabled () const =0 |
Returns the current status of PWM module. More... | |
Additional Inherited Members | |
Public Attributes inherited from semf::Pwm | |
Signal< Error > | error |
The SoftPwm
class outputs a PWM signal on the given GPIO.
The timing of the PWM is controlled by an internal SoftwareTimer
. The cycle time of a PWM can can be set by setMaxValue()
function and lasts, maxValue x time base cycle time. The duty cycle can be set by set()
function.
semf::SoftPwm::SoftPwm | ( | Gpio & | output, |
app::TimeBase & | timebase, | ||
bool | inverted = false |
||
) |
Constructor.
output | GPIO to output the SoftPwm . |
timebase | TimeBase used for internal SoftwareTimer . |
inverted | true for inverted PWM signal on the output pin. |
Definition at line 15 of file softpwm.cpp.
|
explicitdelete |
|
virtualdefault |
|
overridevirtual |
Returns the current status of PWM module.
Implements semf::Pwm.
Definition at line 61 of file softpwm.cpp.
|
overridevirtual |
Returns the maximum possible PWM value.
Implements semf::Pwm.
Definition at line 27 of file softpwm.cpp.
|
overridevirtual |
Set a PWM value. Duty cycle is value / maxValue.
value | The new PWM value. |
inverted | Invert the PWM output. |
Implements semf::Pwm.
Definition at line 32 of file softpwm.cpp.
|
overridevirtual |
Set the maximum possible PWM value.
maxValue | The maximum possible PWM value. |
Implements semf::Pwm.
Definition at line 21 of file softpwm.cpp.
|
overridevirtual |
Start the PWM hardware.
Implements semf::Pwm.
Definition at line 48 of file softpwm.cpp.
|
overridevirtual |
Stop the PWM hardware.
Implements semf::Pwm.
Definition at line 54 of file softpwm.cpp.
|
overridevirtual |
Returns the current PWM value.
Implements semf::Pwm.
Definition at line 43 of file softpwm.cpp.