WPILib 2012
WPILibRoboticsLibraryforFRC
Public Member Functions
DigitalOutput Class Reference

#include <DigitalOutput.h>

Inheritance diagram for DigitalOutput:
DigitalSource InterruptableSensorBase SensorBase ErrorBase

List of all members.

Public Member Functions

 DigitalOutput (UINT32 channel)
 DigitalOutput (UINT8 moduleNumber, UINT32 channel)
virtual ~DigitalOutput ()
void Set (UINT32 value)
UINT32 GetChannel ()
void Pulse (float length)
bool IsPulsing ()
void SetPWMRate (float rate)
void EnablePWM (float initialDutyCycle)
void DisablePWM ()
void UpdateDutyCycle (float dutyCycle)
virtual UINT32 GetChannelForRouting ()
virtual UINT32 GetModuleForRouting ()
virtual bool GetAnalogTriggerForRouting ()
virtual void RequestInterrupts (tInterruptHandler handler, void *param)
virtual void RequestInterrupts ()
void SetUpSourceEdge (bool risingEdge, bool fallingEdge)

Detailed Description

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.


Constructor & Destructor Documentation

DigitalOutput::DigitalOutput ( UINT32  channel) [explicit]

Create an instance of a digital output. Create a digital output given a channel. The default module is used.

Parameters:
channelThe digital channel (1..14).
DigitalOutput::DigitalOutput ( UINT8  moduleNumber,
UINT32  channel 
)

Create an instance of a digital output. Create an instance of a digital output given a module number and channel.

Parameters:
moduleNumberThe digital module (1 or 2).
channelThe digital channel (1..14).
DigitalOutput::~DigitalOutput ( ) [virtual]

Free the resources associated with a digital output.


Member Function Documentation

void DigitalOutput::DisablePWM ( )

Change this line from a PWM output back to a static Digital Output line.

Free up one of the 4 DO PWM generator resources that were in use.

void DigitalOutput::EnablePWM ( float  initialDutyCycle)

Enable a PWM Output on this line.

Allocate one of the 4 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:
initialDutyCycleThe duty-cycle to start generating. [0..1]
bool DigitalOutput::GetAnalogTriggerForRouting ( ) [virtual]
Returns:
The value to be written to the analog trigger field of a routing mux.

Implements DigitalSource.

UINT32 DigitalOutput::GetChannel ( )
Returns:
The GPIO channel number that this object represents.
UINT32 DigitalOutput::GetChannelForRouting ( ) [virtual]
Returns:
The value to be written to the channel field of a routing mux.

Implements DigitalSource.

UINT32 DigitalOutput::GetModuleForRouting ( ) [virtual]
Returns:
The value to be written to the module field of a routing mux.

Implements DigitalSource.

bool DigitalOutput::IsPulsing ( )

Determine if the pulse is still going. Determine if a previously started pulse is still going.

void DigitalOutput::Pulse ( float  length)

Output a single pulse on the digital output line. Send a single pulse on the digital output line where the pulse diration is specified in seconds. Maximum pulse length is 0.0016 seconds.

Parameters:
lengthThe pulselength in seconds
void DigitalOutput::RequestInterrupts ( ) [virtual]

Request interrupts synchronously on this digital output. Request interrupts in synchronus mode where the user program will have to explicitly wait for the interrupt to occur. The default is interrupt on rising edges only.

Implements DigitalSource.

void DigitalOutput::RequestInterrupts ( tInterruptHandler  handler,
void *  param 
) [virtual]

Request interrupts asynchronously on this digital output.

Parameters:
handlerThe address of the interrupt handler function of type tInterruptHandler that will be called whenever there is an interrupt on the digitial output port. Request interrupts in synchronus mode where the user program interrupt handler will be called when an interrupt occurs. The default is interrupt on rising edges only.

Implements DigitalSource.

void DigitalOutput::Set ( UINT32  value)

Set the value of a digital output. Set the value of a digital output to either one (true) or zero (false).

void DigitalOutput::SetPWMRate ( float  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 per digital module.

Parameters:
rateThe frequency to output all digital output PWM signals on this module.
void DigitalOutput::UpdateDutyCycle ( float  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:
dutyCycleThe duty-cycle to change to. [0..1]

The documentation for this class was generated from the following files:
 All Classes Functions Variables