|
Fang-Robotics-MCB
Fang Robotics Team Codebase
|
#include <pwm.hpp>
Public Types | |
| enum | Pin { C1 , C2 , C3 , C4 , C5 , C6 , C7 , Buzzer , ImuHeater } |
| enum | Timer { TIMER1 , TIMER8 , TIMER4 , TIMER10 } |
Public Member Functions | |
| Pwm ()=default | |
| mockable | ~Pwm ()=default |
| mockable void | init () |
| mockable void | writeAllZeros () |
| mockable void | write (float duty, Pwm::Pin pin) |
| mockable void | setTimerFrequency (Timer timer, uint32_t frequency) |
| mockable void | pause (Timer timer) |
| mockable void | start (Timer timer) |
Static Public Attributes | |
| static constexpr uint32_t | DEFAULT_TIMER1_FREQUENCY = 2000 |
| static constexpr uint32_t | DEFAULT_TIMER8_FREQUENCY = 2000 |
| static constexpr uint32_t | DEFAULT_TIMER4_FREQUENCY = 2000 |
| static constexpr uint32_t | DEFAULT_TIMER10_FREQUENCY = 2000 |
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 write and 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 the writeAll function with only the duty.
| enum tap::gpio::Pwm::Pin |
|
default |
|
default |
| void tap::gpio::Pwm::init | ( | ) |
| void tap::gpio::Pwm::pause | ( | Timer | timer | ) |
| void tap::gpio::Pwm::setTimerFrequency | ( | Timer | timer, |
| uint32_t | frequency | ||
| ) |
Set the frequency of the timer, in Hz. Does nothing if frequency == 0
| void tap::gpio::Pwm::start | ( | Timer | timer | ) |
| void tap::gpio::Pwm::write | ( | float | duty, |
| Pwm::Pin | pin | ||
| ) |
Sets the PWM duty for a specified pin.
| [in] | duty | 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. |
| [in] | pin | the PWM pin to be set. |
| void tap::gpio::Pwm::writeAllZeros | ( | ) |
Sets all configured timer channels to 0% duty cycle.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |