Class Pwm¶
Defined in File pwm.hpp
Class Documentation¶
-
class Pwm¶
PWM input pins are pins S, T, U, and V (board pins PAO, PA1, PA2, PA3) To write a PWM frequency to a pin call
writeand pass the function a value (W - Z) from the analog outPin enum and a PWM duty from 0.0-1.0 (where 1 is all HIGH and 0 is all LOW). To set the duty for all pins call thewriteAllfunction with only the duty.Public Types
Public Functions
-
Pwm() = default¶
-
mockable ~Pwm() = default¶
- mockable void init ()
- mockable void writeAllZeros ()
Sets all configured timer channels to 0% duty cycle.
- mockable void write (float duty, Pwm::Pin pin)
Sets the PWM duty for a specified pin.
- Parameters:
duty – [in] the duty cycle to be set. If the duty is outside of the range of [0, 1] the duty is limited to within the range.
pin – [in] the PWM pin to be set.
- mockable void setTimerFrequency (Timer timer, uint32_t frequency)
Set the frequency of the timer, in Hz. Does nothing if frequency == 0
- mockable void pause (Timer timer)
- mockable void start (Timer timer)
-
Pwm() = default¶