semf
semf::PwmOut Class Reference

Class for using a PWM as an output with permille value handling. More...

#include <pwmout.h>

Inheritance diagram for semf::PwmOut:
Inheritance graph
Collaboration diagram for semf::PwmOut:
Collaboration graph

Public Member Functions

 PwmOut (Pwm &pwm)
 Constructor. More...
 
 PwmOut (const PwmOut &other)=delete
 
void enable (bool enable=true) override
 Enables / disable the PWM output. More...
 
void disable (bool disable=true) override
 Enables / disable the PWM output. More...
 
bool isEnabled () const override
 Current status of the PWM module. More...
 
void start () override
 Enables the PWM. More...
 
void stop () override
 Disable the PWM. More...
 
void setValue (uint32_t pwm) override
 Change the PWM value. More...
 
uint32_t value () const override
 Returns the current PWM value. More...
 
void setPermille (uint16_t pwm) override
 Set the PWM value in permille. The pwm value is calculated based on the set maximum value. More...
 
uint16_t permille () const override
 Returns the current PWM value in permille. The PWM value is calculated based on the set maximum value. More...
 
void setMaxValue (uint32_t pwm) override
 Set the maximum value for the PWM. More...
 
uint32_t maxValue () const override
 Returns the maximum possible PWM value. More...
 
void setInverted (bool inverted) override
 To configure whether the PWM should be inverted. This configuration does not become active until the methods setValue(), setEnabled(bool enable) or start() have been called. More...
 
- Public Member Functions inherited from semf::app::PwmOut
virtual ~PwmOut ()=default
 
virtual void enable (bool enable=true)=0
 Enables / disable the PWM output. More...
 
virtual void disable (bool disable=true)=0
 Enables / disable the PWM output. More...
 
virtual bool isEnabled () const =0
 Current status of the PWM module. More...
 
virtual void start ()=0
 Enables the PWM. More...
 
virtual void stop ()=0
 Disable the PWM. More...
 
virtual void setValue (uint32_t pwm)=0
 Change the PWM value. More...
 
virtual uint32_t value () const =0
 Returns the current PWM value. More...
 
virtual void setPermille (uint16_t pwm)=0
 Set the PWM value in permille. The pwm value is calculated based on the set maximum value. More...
 
virtual uint16_t permille () const =0
 Returns the current PWM value in permille. The PWM value is calculated based on the set maximum value. More...
 
virtual void setMaxValue (uint32_t pwm)=0
 Set the maximum value for the PWM. More...
 
virtual uint32_t maxValue () const =0
 Returns the maximum possible PWM value. More...
 
virtual void setInverted (bool inverted)=0
 To configure whether the PWM should be inverted. This configuration does not become active until the methods setValue(), setEnabled(bool enable) or start() have been called. More...
 

Detailed Description

Class for using a PWM as an output with permille value handling.

Definition at line 21 of file pwmout.h.

Constructor & Destructor Documentation

◆ PwmOut() [1/2]

semf::PwmOut::PwmOut ( Pwm pwm)
explicit

Constructor.

Parameters
pwmPWM hardware

Definition at line 15 of file pwmout.cpp.

◆ PwmOut() [2/2]

semf::PwmOut::PwmOut ( const PwmOut other)
explicitdelete

Member Function Documentation

◆ disable()

void semf::PwmOut::disable ( bool  disable = true)
overridevirtual

Enables / disable the PWM output.

Parameters
disable
  • true: PWM off,
  • false: PWM on.

Implements semf::app::PwmOut.

Definition at line 35 of file pwmout.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enable()

void semf::PwmOut::enable ( bool  enable = true)
overridevirtual

Enables / disable the PWM output.

Parameters
enable
  • true: PWM on,
  • false: PWM off.

Implements semf::app::PwmOut.

Definition at line 20 of file pwmout.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEnabled()

bool semf::PwmOut::isEnabled ( ) const
overridevirtual

Current status of the PWM module.

Returns
  • true: PWM on,
  • false: PWM off.

Implements semf::app::PwmOut.

Definition at line 40 of file pwmout.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ maxValue()

uint32_t semf::PwmOut::maxValue ( ) const
overridevirtual

Returns the maximum possible PWM value.

Returns
The maximum possible PWM value.
See also
setMaxValue()

Implements semf::app::PwmOut.

Definition at line 101 of file pwmout.cpp.

Here is the call graph for this function:

◆ permille()

uint16_t semf::PwmOut::permille ( ) const
overridevirtual

Returns the current PWM value in permille. The PWM value is calculated based on the set maximum value.

Returns
The PWM value in permille (0 - 1000).
See also
setMaxValue()

Implements semf::app::PwmOut.

Definition at line 81 of file pwmout.cpp.

Here is the call graph for this function:

◆ setInverted()

void semf::PwmOut::setInverted ( bool  inverted)
overridevirtual

To configure whether the PWM should be inverted. This configuration does not become active until the methods setValue(), setEnabled(bool enable) or start() have been called.

Parameters
inverted
  • true: inverted,
  • false: not inverted.
See also
setValue(), setEnabled() and start().

Implements semf::app::PwmOut.

Definition at line 106 of file pwmout.cpp.

◆ setMaxValue()

void semf::PwmOut::setMaxValue ( uint32_t  pwm)
overridevirtual

Set the maximum value for the PWM.

Parameters
pwmThe maximum possible PWM value. The minimum value is 1.

Implements semf::app::PwmOut.

Definition at line 86 of file pwmout.cpp.

Here is the call graph for this function:

◆ setPermille()

void semf::PwmOut::setPermille ( uint16_t  pwm)
overridevirtual

Set the PWM value in permille. The pwm value is calculated based on the set maximum value.

Parameters
pwmThe PWM value in permille. Valid range is 0 - 1000.
See also
setMaxValue()

Implements semf::app::PwmOut.

Definition at line 71 of file pwmout.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setValue()

void semf::PwmOut::setValue ( uint32_t  pwm)
overridevirtual

Change the PWM value.

Parameters
pwmthe new PWM value.

Implements semf::app::PwmOut.

Definition at line 55 of file pwmout.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void semf::PwmOut::start ( )
overridevirtual

Enables the PWM.

See also
setEnable()

Implements semf::app::PwmOut.

Definition at line 45 of file pwmout.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop()

void semf::PwmOut::stop ( )
overridevirtual

Disable the PWM.

See also
setEnable()

Implements semf::app::PwmOut.

Definition at line 50 of file pwmout.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ value()

uint32_t semf::PwmOut::value ( ) const
overridevirtual

Returns the current PWM value.

Returns
The PWM value.

Implements semf::app::PwmOut.

Definition at line 66 of file pwmout.cpp.

Here is the call graph for this function: