semf
pwmout.h
Go to the documentation of this file.
1
10#ifndef SEMF_OUTPUT_PWMOUT_H_
11#define SEMF_OUTPUT_PWMOUT_H_
12
14#include <semf/output/pwm.h>
15
16namespace semf
17{
21class PwmOut : public app::PwmOut
22{
23public:
28 explicit PwmOut(Pwm& pwm);
29 explicit PwmOut(const PwmOut& other) = delete;
31 virtual ~PwmOut() = default;
33
34 void enable(bool enable = true) override;
35 void disable(bool disable = true) override;
36 bool isEnabled() const override;
37 void start() override;
38 void stop() override;
39 void setValue(uint32_t pwm) override;
40 uint32_t value() const override;
41 void setPermille(uint16_t pwm) override;
42 uint16_t permille() const override;
43 void setMaxValue(uint32_t pwm) override;
44 uint32_t maxValue() const override;
45 void setInverted(bool inverted) override;
46
47private:
49 Pwm& m_pwm;
51 bool m_inverted = false;
52};
53} /* namespace semf */
54#endif /* SEMF_OUTPUT_PWMOUT_H_ */
Class to interface pwm's hardware module of the microcontroller.
Definition: pwm.h:23
Class for using a PWM as an output with permille value handling.
Definition: pwmout.h:22
void enable(bool enable=true) override
Enables / disable the PWM output.
Definition: pwmout.cpp:20
bool isEnabled() const override
Current status of the PWM module.
Definition: pwmout.cpp:40
uint32_t value() const override
Returns the current PWM value.
Definition: pwmout.cpp:66
void stop() override
Disable the PWM.
Definition: pwmout.cpp:50
uint16_t permille() const override
Returns the current PWM value in permille. The PWM value is calculated based on the set maximum value...
Definition: pwmout.cpp:81
void disable(bool disable=true) override
Enables / disable the PWM output.
Definition: pwmout.cpp:35
void start() override
Enables the PWM.
Definition: pwmout.cpp:45
void setPermille(uint16_t pwm) override
Set the PWM value in permille. The pwm value is calculated based on the set maximum value.
Definition: pwmout.cpp:71
PwmOut(const PwmOut &other)=delete
void setMaxValue(uint32_t pwm) override
Set the maximum value for the PWM.
Definition: pwmout.cpp:86
PwmOut(Pwm &pwm)
Constructor.
Definition: pwmout.cpp:15
uint32_t maxValue() const override
Returns the maximum possible PWM value.
Definition: pwmout.cpp:101
void setInverted(bool inverted) override
To configure whether the PWM should be inverted. This configuration does not become active until the ...
Definition: pwmout.cpp:106
void setValue(uint32_t pwm) override
Change the PWM value.
Definition: pwmout.cpp:55
Class for using a PWM as an output with permille value handling.
Definition: pwmout.h:25
virtual ~PwmOut()=default