semf
semf::Pwm Class Referenceabstract

Class to interface pwm's hardware module of the microcontroller. More...

#include <pwm.h>

Inheritance diagram for semf::Pwm:
Inheritance graph
Collaboration diagram for semf::Pwm:
Collaboration graph

Public Member Functions

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...
 

Public Attributes

Signal< Errorerror
 

Detailed Description

Class to interface pwm's hardware module of the microcontroller.

Definition at line 22 of file pwm.h.

Constructor & Destructor Documentation

◆ ~Pwm()

virtual semf::Pwm::~Pwm ( )
virtualdefault

Member Function Documentation

◆ isEnabled()

virtual bool semf::Pwm::isEnabled ( ) const
pure virtual

Returns the current status of PWM module.

Returns
  • true: PWM is enabled and active,
  • false: PWM is disabled and not active.

Implemented in semf::Stm32Pwm, and semf::SoftPwm.

Here is the caller graph for this function:

◆ maxValue()

virtual unsigned int semf::Pwm::maxValue ( ) const
pure virtual

Returns the maximum possible PWM value.

Returns
The maximum possible PWM value.

Implemented in semf::Stm32Pwm, and semf::SoftPwm.

Here is the caller graph for this function:

◆ set()

virtual void semf::Pwm::set ( unsigned int  value,
bool  inverted = false 
)
pure virtual

Set a PWM value. Duty cycle is value / maxValue.

Parameters
valueThe new PWM value.
invertedInvert the PWM output.

Implemented in semf::Stm32Pwm, and semf::SoftPwm.

Here is the caller graph for this function:

◆ setMaxValue()

virtual void semf::Pwm::setMaxValue ( unsigned int  maxValue)
pure virtual

Set the maximum possible PWM value.

Parameters
maxValueThe maximum possible PWM value.

Implemented in semf::Stm32Pwm, and semf::SoftPwm.

Here is the caller graph for this function:

◆ start()

virtual void semf::Pwm::start ( )
pure virtual

Start the PWM hardware.

Implemented in semf::Stm32Pwm, and semf::SoftPwm.

Here is the caller graph for this function:

◆ stop()

virtual void semf::Pwm::stop ( )
pure virtual

Stop the PWM hardware.

Implemented in semf::Stm32Pwm, and semf::SoftPwm.

Here is the caller graph for this function:

◆ value()

virtual unsigned int semf::Pwm::value ( ) const
pure virtual

Returns the current PWM value.

Returns
The current PWM value.

Implemented in semf::Stm32Pwm, and semf::SoftPwm.

Here is the caller graph for this function:

Member Data Documentation

◆ error

Signal<Error> semf::Pwm::error

Signal is emitted after an error in the hardware occurred.

Definition at line 60 of file pwm.h.