Now you can download a copy of these docs so you can use them offline! Download now
DigitalInput Class Reference

#include <DigitalInput.h>

Inheritance diagram for DigitalInput:
Collaboration diagram for DigitalInput:

Public Member Functions

 DigitalInput (UINT32 channel)
 DigitalInput (UINT8 moduleNumber, UINT32 channel)
virtual ~DigitalInput ()
UINT32 Get ()
UINT32 GetChannel ()
virtual UINT32 GetChannelForRouting ()
virtual UINT32 GetModuleForRouting ()
virtual bool GetAnalogTriggerForRouting ()
virtual void RequestInterrupts (tInterruptHandler handler, void *param=NULL)
 Asynchronus handler version.
virtual void RequestInterrupts ()
 Synchronus Wait version.
void SetUpSourceEdge (bool risingEdge, bool fallingEdge)
void UpdateTable ()
void StartLiveWindowMode ()
void StopLiveWindowMode ()
std::string GetSmartDashboardType ()
void InitTable (ITable *subTable)
ITableGetTable ()
- Public Member Functions inherited from DigitalSource
virtual ~DigitalSource ()
- Public Member Functions inherited from InterruptableSensorBase
virtual void CancelInterrupts ()
 Free up the underlying chipobject functions.
virtual void WaitForInterrupt (float timeout)
 Synchronus version.
virtual void EnableInterrupts ()
 Enable interrupts - after finishing setup.
virtual void DisableInterrupts ()
 Disable, but don't deallocate.
virtual double ReadInterruptTimestamp ()
 Return the timestamp for the interrupt that occurred.
- Public Member Functions inherited from SensorBase
 SensorBase ()
virtual ~SensorBase ()
- Public Member Functions inherited from ErrorBase
virtual ErrorGetError ()
 Retrieve the current error. Get the current error information associated with this sensor.
virtual const ErrorGetError () const
virtual void SetErrnoError (const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set error information associated with a C library call that set an error to the "errno" global variable.
virtual void SetImaqError (int success, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set the current error information associated from the nivision Imaq API.
virtual void SetError (Error::Code code, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set the current error information associated with this sensor.
virtual void SetWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set the current error information associated with this sensor.
virtual void CloneError (ErrorBase *rhs) const
virtual void ClearError () const
 Clear the current error information associated with this sensor.
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error.

Additional Inherited Members

- Static Public Member Functions inherited from SensorBase
static void DeleteSingletons ()
static UINT32 GetDefaultAnalogModule ()
static UINT32 GetDefaultDigitalModule ()
static UINT32 GetDefaultSolenoidModule ()
static bool CheckAnalogModule (UINT8 moduleNumber)
static bool CheckDigitalModule (UINT8 moduleNumber)
static bool CheckPWMModule (UINT8 moduleNumber)
static bool CheckRelayModule (UINT8 moduleNumber)
static bool CheckSolenoidModule (UINT8 moduleNumber)
static bool CheckDigitalChannel (UINT32 channel)
static bool CheckRelayChannel (UINT32 channel)
static bool CheckPWMChannel (UINT32 channel)
static bool CheckAnalogChannel (UINT32 channel)
static bool CheckSolenoidChannel (UINT32 channel)
- Static Public Attributes inherited from SensorBase
static const UINT32 kSystemClockTicksPerMicrosecond = 40
static const UINT32 kDigitalChannels = 14
static const UINT32 kAnalogChannels = 8
static const UINT32 kAnalogModules = 2
static const UINT32 kDigitalModules = 2
static const UINT32 kSolenoidChannels = 8
static const UINT32 kSolenoidModules = 2
static const UINT32 kPwmChannels = 10
static const UINT32 kRelayChannels = 8
static const UINT32 kChassisSlots = 8
- Protected Member Functions inherited from InterruptableSensorBase
void AllocateInterrupts (bool watcher)
- Protected Attributes inherited from InterruptableSensorBase
tInterrupt * m_interrupt
tInterruptManager * m_manager
UINT32 m_interruptIndex
- Static Protected Attributes inherited from ErrorBase
static SEM_ID _globalErrorMutex = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE)
static Error _globalError

Detailed Description

Class to read a digital input. This class will read digital inputs and return the current value on the channel. Other devices such as encoders, gear tooth sensors, etc. that are implemented elsewhere will automatically allocate digital inputs and outputs as required. This class is only for devices like switches etc. that aren't implemented anywhere else.

Definition at line 22 of file DigitalInput.h.

Constructor & Destructor Documentation

DigitalInput::DigitalInput ( UINT32  channel)
explicit

Create an instance of a Digital Input class. Creates a digital input given a channel and uses the default module.

Parameters
channelThe digital channel (1..14).

Definition at line 50 of file DigitalInput.cpp.

DigitalInput::DigitalInput ( UINT8  moduleNumber,
UINT32  channel 
)

Create an instance of a Digital Input class. Creates a digital input given an channel and module.

Parameters
moduleNumberThe digital module (1 or 2).
channelThe digital channel (1..14).

Definition at line 62 of file DigitalInput.cpp.

DigitalInput::~DigitalInput ( )
virtual

Free resources associated with the Digital Input class.

Definition at line 70 of file DigitalInput.cpp.

Member Function Documentation

bool DigitalInput::GetAnalogTriggerForRouting ( )
virtual
Returns
The value to be written to the analog trigger field of a routing mux.

Implements DigitalSource.

Definition at line 120 of file DigitalInput.cpp.

UINT32 DigitalInput::GetChannel ( )
Returns
The GPIO channel number that this object represents.

Definition at line 95 of file DigitalInput.cpp.

UINT32 DigitalInput::GetChannelForRouting ( )
virtual
Returns
The value to be written to the channel field of a routing mux.

Implements DigitalSource.

Definition at line 103 of file DigitalInput.cpp.

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

Implements DigitalSource.

Definition at line 111 of file DigitalInput.cpp.

std::string DigitalInput::GetSmartDashboardType ( )
virtual
Returns
the string representation of the named data type that will be used by the smart dashboard for this sendable

Implements Sendable.

Definition at line 216 of file DigitalInput.cpp.

ITable * DigitalInput::GetTable ( )
virtual
Returns
the table that is currently associated with the sendable

Implements Sendable.

Definition at line 225 of file DigitalInput.cpp.

void DigitalInput::InitTable ( ITable subtable)
virtual

Initializes a table for this sendable object.

Parameters
subtableThe table to put the values in.

Implements Sendable.

Definition at line 220 of file DigitalInput.cpp.

void DigitalInput::RequestInterrupts ( tInterruptHandler  handler,
void *  param = NULL 
)
virtual

Asynchronus handler version.

Request interrupts asynchronously on this digital input.

Parameters
handlerThe address of the interrupt handler function of type tInterruptHandler that will be called whenever there is an interrupt on the digitial input 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.

Definition at line 133 of file DigitalInput.cpp.

void DigitalInput::RequestInterrupts ( )
virtual

Synchronus Wait version.

Request interrupts synchronously on this digital input. 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.

Definition at line 164 of file DigitalInput.cpp.

void DigitalInput::StartLiveWindowMode ( )
virtual

Start having this sendable object automatically respond to value changes reflect the value on the table.

Implements LiveWindowSendable.

Definition at line 208 of file DigitalInput.cpp.

void DigitalInput::StopLiveWindowMode ( )
virtual

Stop having this sendable object automatically respond to value changes.

Implements LiveWindowSendable.

Definition at line 212 of file DigitalInput.cpp.

void DigitalInput::UpdateTable ( )
virtual

Update the table for this sendable object with the latest values.

Implements LiveWindowSendable.

Definition at line 202 of file DigitalInput.cpp.


The documentation for this class was generated from the following files:

Generated on Tue Feb 5 2013 00:55:10 for WPILibC++ by doxygen 1.8.1.2