34#ifndef _FREERTOS_DRIVERS_COMMON_PWM_HXX_
35#define _FREERTOS_DRIVERS_COMMON_PWM_HXX_
86 constexpr PWM() =
default;
107 PWMGPO(
PWM *instance, uint32_t on_counts, uint32_t off_counts)
123 new_state ?
set() :
clr();
149 HASSERT(dir == Gpio::Direction::DOUTPUT);
156 return Gpio::Direction::DOUTPUT;
159 uint32_t get_on_counts()
const
164 uint32_t get_off_counts()
const
OS-independent abstraction for GPIO.
Value
Defines the options for GPIO level.
Direction
Defines the options for GPIO direction.
General Purpose Output specialization of a PWM Bit.
void set() const override
Sets the GPO pin to high.
uint32_t offCounts_
PWM counts for when the GPO is "off".
void set_direction(Gpio::Direction dir) const override
Sets the GPO direction (does nothing).
PWMGPO(PWM *instance, uint32_t on_counts, uint32_t off_counts)
Constructor.
void write(Value new_state) const override
Writes a GPO pin (set or clear to a specific state).
PWM * instance_
PWM instance.
Direction direction() const override
Gets the GPO direction.
void clr() const override
Clears the GPO pin to low.
uint32_t onCounts_
PWM counts for when the GPO is "on".
Value read() const override
Retrieves the current Value of a GPO output sate (requested).
Abstract interface for a PWM driver.
uint8_t get_duty_percent()
Gets the duty cycle.
virtual void set_period(uint32_t counts)=0
Set PWM period.
void set_duty_percent(uint8_t percent)
Sets the duty cycle.
virtual uint32_t get_period()=0
Get PWM period.
constexpr PWM()=default
Constructor.
virtual uint32_t get_period_max()=0
Get max period supported.
~PWM()=default
Destructor.
virtual uint32_t get_duty()=0
Gets the duty cycle.
virtual void set_duty(uint32_t counts)=0
Sets the duty cycle.
virtual uint32_t get_period_min()=0
Get min period supported.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.