FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
Construct a new handler for a PWM output pin. More...
#include <fastarduino/pwm.h>
Public Types | |
using | TIMER = timer::Timer< TRAIT::TIMER > |
The actual timer::Timer type associated to this PWMOutput . More... | |
using | TYPE = typename TIMER_TRAIT::TYPE |
The type (either uint8_t or uint16_t ) of values acceptable for duty in set_duty() . More... | |
Public Member Functions | |
PWMOutput (const PWMOutput &)=delete | |
PWMOutput & | operator= (const PWMOutput &)=delete |
PWMOutput (TIMER &timer, TimerOutputMode output_mode=TimerOutputMode::NON_INVERTING) | |
Construct a new PWM output pin, connected to timer , using output_mode . More... | |
void | set_output_mode (TimerOutputMode output_mode) |
Change the connection output mode of this PWM pin to its timer. More... | |
void | set_duty (TYPE duty) |
Set the duty cycle for this PWM pin, from 0 (0% duty cycle) to MAX (100%), any value above MAX will be used as 100%. More... | |
Static Public Attributes | |
static constexpr const board::PWMPin | PWMPIN = PWMPIN_ |
The PWM pin for this PWMOutput. More... | |
static constexpr const bool | PULSED = PULSED_ |
Whether this PWMOutput uses a timer::PulseTimer instead of a timer::Timer . More... | |
static constexpr const board::DigitalPin | PIN = TRAIT::ACTUAL_PIN |
The digital pin for this PWMOutput. More... | |
static constexpr const TYPE | MAX = TIMER_TRAIT::MAX_PWM |
The maximum acceptable value for duty in set_duty() . More... | |
Construct a new handler for a PWM output pin.
PWMPIN_ | the board::PWMPin to use as PWM output |
PULSED_ | whether to use a timer::PulseTimer instead of a timer::Timer ; this is useful when e.g. you want to use a PWM pin to manage a servo motor, where pulses shall be limited to a few ms but triggered every few dozen ms. |
using analog::PWMOutput< PWMPIN_, PULSED_ >::TIMER = timer::Timer<TRAIT::TIMER> |
The actual timer::Timer
type associated to this PWMOutput
.
using analog::PWMOutput< PWMPIN_, PULSED_ >::TYPE = typename TIMER_TRAIT::TYPE |
The type (either uint8_t
or uint16_t
) of values acceptable for duty
in set_duty()
.
|
inline |
Construct a new PWM output pin, connected to timer
, using output_mode
.
This will not compile if PIN
is not a PWM pin or its is not connectable to timer
.
timer | the timer to which this PWM pin must be connected |
output_mode | the connection output mode to use; note this is not used in pulsed mode, i.e. when PULSED template argument is true . |
|
inline |
|
inline |
|
staticconstexpr |
|
staticconstexpr |
Whether this PWMOutput uses a timer::PulseTimer
instead of a timer::Timer
.
|
staticconstexpr |
|
staticconstexpr |
The maximum acceptable value for duty
in set_duty()
.