Now you can download a copy of these docs so you can use them offline! Download now
Inheritance diagram for DigitalModule:
Collaboration diagram for DigitalModule:

Public Member Functions

void SetPWM (UINT32 channel, UINT8 value)
UINT8 GetPWM (UINT32 channel)
void SetPWMPeriodScale (UINT32 channel, UINT32 squelchMask)
void SetRelayForward (UINT32 channel, bool on)
void SetRelayReverse (UINT32 channel, bool on)
bool GetRelayForward (UINT32 channel)
UINT8 GetRelayForward ()
bool GetRelayReverse (UINT32 channel)
UINT8 GetRelayReverse ()
bool AllocateDIO (UINT32 channel, bool input)
void FreeDIO (UINT32 channel)
void SetDIO (UINT32 channel, short value)
bool GetDIO (UINT32 channel)
UINT16 GetDIO ()
bool GetDIODirection (UINT32 channel)
UINT16 GetDIODirection ()
void Pulse (UINT32 channel, float pulseLength)
bool IsPulsing (UINT32 channel)
bool IsPulsing ()
UINT32 AllocateDO_PWM ()
void FreeDO_PWM (UINT32 pwmGenerator)
void SetDO_PWMRate (float rate)
void SetDO_PWMDutyCycle (UINT32 pwmGenerator, float dutyCycle)
void SetDO_PWMOutputChannel (UINT32 pwmGenerator, UINT32 channel)
I2CGetI2C (UINT32 address)
- Public Member Functions inherited from Module
nLoadOut::tModuleType GetType ()
UINT8 GetNumber ()
- 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.

Static Public Member Functions

static DigitalModuleGetInstance (UINT8 moduleNumber)
static UINT8 RemapDigitalChannel (UINT32 channel)
static UINT8 UnmapDigitalChannel (UINT32 channel)
- Static Public Member Functions inherited from Module
static ModuleGetModule (nLoadOut::tModuleType type, UINT8 number)
- 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 Member Functions inherited from ErrorBase
static void SetGlobalError (Error::Code code, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber)
static void SetGlobalWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber)
static ErrorGetGlobalError ()

Protected Member Functions

 DigitalModule (UINT8 moduleNumber)
- Protected Member Functions inherited from Module
 Module (nLoadOut::tModuleType type, UINT8 number)
virtual ~Module ()
- Protected Member Functions inherited from SensorBase
void AddToSingletonList ()
- Protected Member Functions inherited from ErrorBase
 ErrorBase ()
 Initialize the instance status to 0 for now.

Friends

class I2C
class Module

Additional Inherited Members

- 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 Attributes inherited from Module
nLoadOut::tModuleType m_moduleType
 The type of module represented.
UINT8 m_moduleNumber
 The module index within the module type.
- 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

Definition at line 17 of file DigitalModule.h.

Constructor & Destructor Documentation

DigitalModule::DigitalModule ( UINT8  moduleNumber)
explicitprotected

Create a new instance of an digital module. Create an instance of the digital module object. Initialize all the parameters to reasonable values on start. Setting a global value on an digital module can be done only once unless subsequent values are set the previously set value. Digital modules are a singleton, so the constructor is never called outside of this class.

Parameters
moduleNumberThe digital module to create (1 or 2).

Definition at line 51 of file DigitalModule.cpp.

Member Function Documentation

bool DigitalModule::AllocateDIO ( UINT32  channel,
bool  input 
)

Allocate Digital I/O channels. Allocate channels so that they are not accidently reused. Also the direction is set at the time of the allocation.

Parameters
channelThe Digital I/O channel
inputIf true open as input; if false open as output
Returns
Was successfully allocated

Definition at line 247 of file DigitalModule.cpp.

UINT32 DigitalModule::AllocateDO_PWM ( )

Allocate a DO PWM Generator. Allocate PWM generators so that they are not accidently reused.

Returns
PWM Generator refnum

Definition at line 428 of file DigitalModule.cpp.

void DigitalModule::FreeDIO ( UINT32  channel)

Free the resource associated with a digital I/O channel.

Parameters
channelThe Digital I/O channel to free

Definition at line 277 of file DigitalModule.cpp.

void DigitalModule::FreeDO_PWM ( UINT32  pwmGenerator)

Free the resource associated with a DO PWM generator.

Parameters
pwmGeneratorThe pwmGen to free that was allocated with AllocateDO_PWM()

Definition at line 440 of file DigitalModule.cpp.

bool DigitalModule::GetDIO ( UINT32  channel)

Read a digital I/O bit from the FPGA. Get a single value from a digital I/O channel.

Parameters
channelThe digital I/O channel
Returns
The state of the specified channel

Definition at line 321 of file DigitalModule.cpp.

UINT16 DigitalModule::GetDIO ( )

Read the state of all the Digital I/O lines from the FPGA These are not remapped to logical order. They are still in hardware order.

Definition at line 338 of file DigitalModule.cpp.

bool DigitalModule::GetDIODirection ( UINT32  channel)

Read the direction of a the Digital I/O lines A 1 bit means output and a 0 bit means input.

Parameters
channelThe digital I/O channel
Returns
The direction of the specified channel

Definition at line 353 of file DigitalModule.cpp.

UINT16 DigitalModule::GetDIODirection ( )

Read the direction of all the Digital I/O lines from the FPGA A 1 bit means output and a 0 bit means input. These are not remapped to logical order. They are still in hardware order.

Definition at line 371 of file DigitalModule.cpp.

I2C * DigitalModule::GetI2C ( UINT32  address)

Return a pointer to an I2C object for this digital module The caller is responsible for deleting the pointer.

Parameters
addressThe address of the device on the I2C bus
Returns
A pointer to an I2C object to talk to the device at address

Definition at line 525 of file DigitalModule.cpp.

DigitalModule * DigitalModule::GetInstance ( UINT8  moduleNumber)
static

Get an instance of an Digital Module. Singleton digital module creation where a module is allocated on the first use and the same module is returned on subsequent uses.

Parameters
moduleNumberThe digital module to get (1 or 2).

Definition at line 26 of file DigitalModule.cpp.

UINT8 DigitalModule::GetPWM ( UINT32  channel)

Get a value from a PWM channel. The values range from 0 to 255.

Parameters
channelThe PWM channel to read from.
Returns
The raw PWM value.

Definition at line 128 of file DigitalModule.cpp.

bool DigitalModule::GetRelayForward ( UINT32  channel)

Get the current state of the forward relay channel

Definition at line 195 of file DigitalModule.cpp.

UINT8 DigitalModule::GetRelayForward ( )

Get the current state of all of the forward relay channels on this module.

Definition at line 206 of file DigitalModule.cpp.

bool DigitalModule::GetRelayReverse ( UINT32  channel)

Get the current state of the reverse relay channel

Definition at line 217 of file DigitalModule.cpp.

UINT8 DigitalModule::GetRelayReverse ( )

Get the current state of all of the reverse relay channels on this module.

Definition at line 229 of file DigitalModule.cpp.

bool DigitalModule::IsPulsing ( UINT32  channel)

Check a DIO line to see if it is currently generating a pulse.

Returns
A pulse is in progress

Definition at line 400 of file DigitalModule.cpp.

bool DigitalModule::IsPulsing ( )

Check if any DIO line is currently generating a pulse.

Returns
A pulse on some line is in progress

Definition at line 414 of file DigitalModule.cpp.

void DigitalModule::Pulse ( UINT32  channel,
float  pulseLength 
)

Generate a single pulse. Write a pulse to the specified digital output channel. There can only be a single pulse going at any time.

Parameters
channelThe Digital Output channel that the pulse should be output on
pulseLengthThe active length of the pulse (in seconds)

Definition at line 386 of file DigitalModule.cpp.

void DigitalModule::SetDIO ( UINT32  channel,
short  value 
)

Write a digital I/O bit to the FPGA. Set a single value on a digital I/O channel.

Parameters
channelThe Digital I/O channel
valueThe state to set the digital channel (if it is configured as an output)

Definition at line 289 of file DigitalModule.cpp.

void DigitalModule::SetDO_PWMDutyCycle ( UINT32  pwmGenerator,
float  dutyCycle 
)

Configure the duty-cycle of the PWM generator

Parameters
pwmGeneratorThe generator index reserved by AllocateDO_PWM()
dutyCycleThe percent duty cycle to output [0..1].

Definition at line 497 of file DigitalModule.cpp.

void DigitalModule::SetDO_PWMOutputChannel ( UINT32  pwmGenerator,
UINT32  channel 
)

Configure which DO channel the PWM siganl is output on

Parameters
pwmGeneratorThe generator index reserved by AllocateDO_PWM()
channelThe Digital Output channel to output on

Definition at line 469 of file DigitalModule.cpp.

void DigitalModule::SetDO_PWMRate ( float  rate)

Change the frequency of the DO PWM generator.

The valid range is from 0.6 Hz to 19 kHz. The frequency resolution is logarithmic.

Parameters
rateThe frequency to output all digital output PWM signals on this module.

Definition at line 453 of file DigitalModule.cpp.

void DigitalModule::SetPWM ( UINT32  channel,
UINT8  value 
)

Set a PWM channel to the desired value. The values range from 0 to 255 and the period is controlled by the PWM Period and MinHigh registers.

Parameters
channelThe PWM channel to set.
valueThe PWM value to set.

Definition at line 114 of file DigitalModule.cpp.

void DigitalModule::SetPWMPeriodScale ( UINT32  channel,
UINT32  squelchMask 
)

Set how how often the PWM signal is squelched, thus scaling the period.

Parameters
channelThe PWM channel to configure.
squelchMaskThe 2-bit mask of outputs to squelch.

Definition at line 142 of file DigitalModule.cpp.

void DigitalModule::SetRelayForward ( UINT32  channel,
bool  on 
)

Set the state of a relay. Set the state of a relay output to be forward. Relays have two outputs and each is independently set to 0v or 12v.

Definition at line 155 of file DigitalModule.cpp.

void DigitalModule::SetRelayReverse ( UINT32  channel,
bool  on 
)

Set the state of a relay. Set the state of a relay output to be reverse. Relays have two outputs and each is independently set to 0v or 12v.

Definition at line 176 of file DigitalModule.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