Class to write to digital outputs.
More...
#include <wpi/hardware/discrete/DigitalOutput.hpp>
Class to write to digital outputs.
Write values to the digital output channels. Other devices implemented elsewhere will allocate channels automatically so for those devices it shouldn't be done here.
◆ DigitalOutput() [1/2]
| wpi::DigitalOutput::DigitalOutput |
( |
int | channel | ) |
|
|
explicit |
Create an instance of a digital output.
Create a digital output given a channel.
- Parameters
-
| channel | The digital channel 0-9 are on-board, 10-25 are on the MXP port |
◆ DigitalOutput() [2/2]
| wpi::DigitalOutput::DigitalOutput |
( |
DigitalOutput && | | ) |
|
|
default |
◆ ~DigitalOutput()
| wpi::DigitalOutput::~DigitalOutput |
( |
| ) |
|
|
override |
◆ DisablePWM()
| void wpi::DigitalOutput::DisablePWM |
( |
| ) |
|
Change this line from a PWM output back to a static Digital Output line.
Free up one of the 6 DO PWM generator resources that were in use.
◆ EnablePPS()
| void wpi::DigitalOutput::EnablePPS |
( |
double | dutyCycle | ) |
|
Enable a PWM PPS (Pulse Per Second) Output on this line.
Allocate one of the 6 DO PWM generator resources from this module.
Supply the duty-cycle to output.
The resolution of the duty cycle is 8-bit.
- Parameters
-
| dutyCycle | The duty-cycle to start generating. [0..1] |
◆ EnablePWM()
| void wpi::DigitalOutput::EnablePWM |
( |
double | initialDutyCycle | ) |
|
Enable a PWM Output on this line.
Allocate one of the 6 DO PWM generator resources from this module.
Supply the initial duty-cycle to output so as to avoid a glitch when first starting.
The resolution of the duty cycle is 8-bit for low frequencies (1kHz or less) but is reduced the higher the frequency of the PWM signal is.
- Parameters
-
| initialDutyCycle | The duty-cycle to start generating. [0..1] |
◆ Get()
| bool wpi::DigitalOutput::Get |
( |
| ) |
const |
Gets the value being output from the Digital Output.
- Returns
- the state of the digital output.
◆ GetChannel()
| int wpi::DigitalOutput::GetChannel |
( |
| ) |
const |
- Returns
- The GPIO channel number that this object represents.
◆ InitSendable()
◆ IsPulsing()
| bool wpi::DigitalOutput::IsPulsing |
( |
| ) |
const |
Determine if the pulse is still going.
Determine if a previously started pulse is still going.
◆ operator=()
◆ Pulse()
| void wpi::DigitalOutput::Pulse |
( |
wpi::units::second_t | pulseLength | ) |
|
Output a single pulse on the digital output line.
Send a single pulse on the digital output line where the pulse duration is specified in seconds. Maximum of 65535 microseconds.
- Parameters
-
| pulseLength | The pulse length in seconds |
◆ Set()
| void wpi::DigitalOutput::Set |
( |
bool | value | ) |
|
Set the value of a digital output.
Set the value of a digital output to either one (true) or zero (false).
- Parameters
-
| value | 1 (true) for high, 0 (false) for disabled |
◆ SetPWMRate()
| void wpi::DigitalOutput::SetPWMRate |
( |
double | rate | ) |
|
Change the PWM frequency of the PWM output on a Digital Output line.
The valid range is from 0.6 Hz to 19 kHz. The frequency resolution is logarithmic.
There is only one PWM frequency for all digital channels.
- Parameters
-
| rate | The frequency to output all digital output PWM signals. |
◆ SetSimDevice()
Indicates this output is used by a simulated device.
- Parameters
-
| device | simulated device handle |
◆ UpdateDutyCycle()
| void wpi::DigitalOutput::UpdateDutyCycle |
( |
double | dutyCycle | ) |
|
Change the duty-cycle that is being generated on the line.
The resolution of the duty cycle is 8-bit for low frequencies (1kHz or less) but is reduced the higher the frequency of the PWM signal is.
- Parameters
-
| dutyCycle | The duty-cycle to change to. [0..1] |
The documentation for this class was generated from the following file: