Class for sending pulse-width modulation (PWM) signals.
More...
#include <wpi/hardware/discrete/PWM.hpp>
Class for sending pulse-width modulation (PWM) signals.
◆ PWM() [1/2]
| wpi::PWM::PWM |
( |
int | channel, |
|
|
bool | registerSendable = true ) |
|
explicit |
Allocate a PWM given a channel number.
Checks channel value range and allocates the appropriate channel. The allocation is only done to help users ensure that they don't double assign channels.
- Parameters
-
| channel | The SmartIO channel number. |
| registerSendable | If true, adds this instance to SendableRegistry |
◆ PWM() [2/2]
◆ ~PWM()
Free the PWM channel.
Free the resource associated with the PWM channel and set the value to 0.
◆ GetChannel()
| int wpi::PWM::GetChannel |
( |
| ) |
const |
◆ GetPulseTime()
| wpi::units::microsecond_t wpi::PWM::GetPulseTime |
( |
| ) |
const |
Get the PWM pulse time directly from the hardware.
Read a microsecond value from a PWM channel.
- Returns
- Microsecond PWM control value. Range 0 - 4096.
◆ InitSendable()
◆ operator=()
| PWM & wpi::PWM::operator= |
( |
PWM && | | ) |
|
|
default |
◆ SetDisabled()
| void wpi::PWM::SetDisabled |
( |
| ) |
|
Temporarily disables the PWM output.
The next set call will re-enable the output.
◆ SetOutputPeriod()
| void wpi::PWM::SetOutputPeriod |
( |
wpi::units::millisecond_t | period | ) |
|
Sets the PWM output period.
- Parameters
-
| period | The output period to apply to this channel, in milliseconds. Valid values are 5ms, 10ms, and 20ms. Default is 20 ms. |
◆ SetPulseTime()
| void wpi::PWM::SetPulseTime |
( |
wpi::units::microsecond_t | time | ) |
|
Set the PWM pulse time directly to the hardware.
Write a microsecond value to a PWM channel.
- Parameters
-
| time | Microsecond PWM value. Range 0 - 4096. |
◆ SetSimDevice()
Indicates this input is used by a simulated device.
- Parameters
-
| device | simulated device handle |
◆ AddressableLED
| friend class AddressableLED |
|
friend |
The documentation for this class was generated from the following file: