Public Member Functions | |
void | SetPWM (uint32_t channel, uint8_t value) |
uint8_t | GetPWM (uint32_t channel) |
void | SetPWMPeriodScale (uint32_t channel, uint32_t squelchMask) |
void | SetRelayForward (uint32_t channel, bool on) |
void | SetRelayReverse (uint32_t channel, bool on) |
bool | GetRelayForward (uint32_t channel) |
uint8_t | GetRelayForward () |
bool | GetRelayReverse (uint32_t channel) |
uint8_t | GetRelayReverse () |
bool | AllocateDIO (uint32_t channel, bool input) |
void | FreeDIO (uint32_t channel) |
void | SetDIO (uint32_t channel, short value) |
bool | GetDIO (uint32_t channel) |
uint16_t | GetDIO () |
bool | GetDIODirection (uint32_t channel) |
uint16_t | GetDIODirection () |
void | Pulse (uint32_t channel, float pulseLength) |
bool | IsPulsing (uint32_t channel) |
bool | IsPulsing () |
uint32_t | AllocateDO_PWM () |
void | FreeDO_PWM (uint32_t pwmGenerator) |
void | SetDO_PWMRate (float rate) |
void | SetDO_PWMDutyCycle (uint32_t pwmGenerator, float dutyCycle) |
void | SetDO_PWMOutputChannel (uint32_t pwmGenerator, uint32_t channel) |
uint16_t | GetLoopTiming () |
I2C * | GetI2C (uint32_t address) |
Public Member Functions inherited from Module | |
nLoadOut::tModuleType | GetType () |
uint8_t | GetNumber () |
Public Member Functions inherited from SensorBase | |
SensorBase () | |
virtual | ~SensorBase () |
Public Member Functions inherited from ErrorBase | |
virtual Error & | GetError () |
Retrieve the current error. Get the current error information associated with this sensor. | |
virtual const Error & | GetError () const |
virtual void | SetErrnoError (const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const |
Set error information associated with a C library call that set an error to the "errno" global variable. More... | |
virtual void | SetImaqError (int success, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const |
Set the current error information associated from the nivision Imaq API. More... | |
virtual void | SetError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const |
Set the current error information associated with this sensor. More... | |
virtual void | SetWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const |
Set the current error information associated with this sensor. More... | |
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. More... | |
Static Public Member Functions | |
static DigitalModule * | GetInstance (uint8_t moduleNumber) |
static uint8_t | RemapDigitalChannel (uint32_t channel) |
static uint8_t | UnmapDigitalChannel (uint32_t channel) |
Static Public Member Functions inherited from Module | |
static Module * | GetModule (nLoadOut::tModuleType type, uint8_t number) |
Static Public Member Functions inherited from SensorBase | |
static void | DeleteSingletons () |
static uint32_t | GetDefaultAnalogModule () |
static uint32_t | GetDefaultDigitalModule () |
static uint32_t | GetDefaultSolenoidModule () |
static bool | CheckAnalogModule (uint8_t moduleNumber) |
static bool | CheckDigitalModule (uint8_t moduleNumber) |
static bool | CheckPWMModule (uint8_t moduleNumber) |
static bool | CheckRelayModule (uint8_t moduleNumber) |
static bool | CheckSolenoidModule (uint8_t moduleNumber) |
static bool | CheckDigitalChannel (uint32_t channel) |
static bool | CheckRelayChannel (uint32_t channel) |
static bool | CheckPWMChannel (uint32_t channel) |
static bool | CheckAnalogChannel (uint32_t channel) |
static bool | CheckSolenoidChannel (uint32_t channel) |
Static Public Member Functions inherited from ErrorBase | |
static void | SetGlobalError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) |
static void | SetGlobalWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) |
static Error & | GetGlobalError () |
Protected Member Functions | |
DigitalModule (uint8_t moduleNumber) | |
Protected Member Functions inherited from Module | |
Module (nLoadOut::tModuleType type, uint8_t 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_t | kSystemClockTicksPerMicrosecond = 40 |
static const uint32_t | kDigitalChannels = 14 |
static const uint32_t | kAnalogChannels = 8 |
static const uint32_t | kAnalogModules = 2 |
static const uint32_t | kDigitalModules = 2 |
static const uint32_t | kSolenoidChannels = 8 |
static const uint32_t | kSolenoidModules = 2 |
static const uint32_t | kPwmChannels = 10 |
static const uint32_t | kRelayChannels = 8 |
static const uint32_t | kChassisSlots = 8 |
Protected Attributes inherited from Module | |
nLoadOut::tModuleType | m_moduleType |
The type of module represented. | |
uint8_t | m_moduleNumber |
The module index within the module type. | |
Protected Attributes inherited from ErrorBase | |
Error | m_error |
Static Protected Attributes inherited from ErrorBase | |
static SEM_ID | _globalErrorMutex = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE) |
static Error | _globalError |
Definition at line 17 of file DigitalModule.h.
|
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.
moduleNumber | The digital module to create (1 or 2). |
Definition at line 51 of file DigitalModule.cpp.
bool DigitalModule::AllocateDIO | ( | uint32_t | 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.
channel | The Digital I/O channel |
input | If true open as input; if false open as output |
Definition at line 252 of file DigitalModule.cpp.
uint32_t DigitalModule::AllocateDO_PWM | ( | ) |
Allocate a DO PWM Generator. Allocate PWM generators so that they are not accidently reused.
Definition at line 433 of file DigitalModule.cpp.
void DigitalModule::FreeDIO | ( | uint32_t | channel | ) |
Free the resource associated with a digital I/O channel.
channel | The Digital I/O channel to free |
Definition at line 282 of file DigitalModule.cpp.
void DigitalModule::FreeDO_PWM | ( | uint32_t | pwmGenerator | ) |
Free the resource associated with a DO PWM generator.
pwmGenerator | The pwmGen to free that was allocated with AllocateDO_PWM() |
Definition at line 445 of file DigitalModule.cpp.
bool DigitalModule::GetDIO | ( | uint32_t | channel | ) |
Read a digital I/O bit from the FPGA. Get a single value from a digital I/O channel.
channel | The digital I/O channel |
Definition at line 326 of file DigitalModule.cpp.
uint16_t 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 343 of file DigitalModule.cpp.
bool DigitalModule::GetDIODirection | ( | uint32_t | channel | ) |
Read the direction of a the Digital I/O lines A 1 bit means output and a 0 bit means input.
channel | The digital I/O channel |
Definition at line 358 of file DigitalModule.cpp.
uint16_t 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 376 of file DigitalModule.cpp.
I2C * DigitalModule::GetI2C | ( | uint32_t | address | ) |
Return a pointer to an I2C object for this digital module The caller is responsible for deleting the pointer.
address | The address of the device on the I2C bus |
Definition at line 544 of file DigitalModule.cpp.
|
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.
moduleNumber | The digital module to get (1 or 2). |
Definition at line 26 of file DigitalModule.cpp.
uint16_t DigitalModule::GetLoopTiming | ( | ) |
Get the loop timing of the Digital Module
Definition at line 528 of file DigitalModule.cpp.
uint8_t DigitalModule::GetPWM | ( | uint32_t | channel | ) |
Get a value from a PWM channel. The values range from 0 to 255.
channel | The PWM channel to read from. |
Definition at line 133 of file DigitalModule.cpp.
bool DigitalModule::GetRelayForward | ( | uint32_t | channel | ) |
Get the current state of the forward relay channel
Definition at line 200 of file DigitalModule.cpp.
uint8_t DigitalModule::GetRelayForward | ( | ) |
Get the current state of all of the forward relay channels on this module.
Definition at line 211 of file DigitalModule.cpp.
bool DigitalModule::GetRelayReverse | ( | uint32_t | channel | ) |
Get the current state of the reverse relay channel
Definition at line 222 of file DigitalModule.cpp.
uint8_t DigitalModule::GetRelayReverse | ( | ) |
Get the current state of all of the reverse relay channels on this module.
Definition at line 234 of file DigitalModule.cpp.
bool DigitalModule::IsPulsing | ( | uint32_t | channel | ) |
Check a DIO line to see if it is currently generating a pulse.
Definition at line 405 of file DigitalModule.cpp.
bool DigitalModule::IsPulsing | ( | ) |
Check if any DIO line is currently generating a pulse.
Definition at line 419 of file DigitalModule.cpp.
void DigitalModule::Pulse | ( | uint32_t | 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.
channel | The Digital Output channel that the pulse should be output on |
pulseLength | The active length of the pulse (in seconds) |
Definition at line 391 of file DigitalModule.cpp.
void DigitalModule::SetDIO | ( | uint32_t | channel, |
short | value | ||
) |
Write a digital I/O bit to the FPGA. Set a single value on a digital I/O channel.
channel | The Digital I/O channel |
value | The state to set the digital channel (if it is configured as an output) |
Definition at line 294 of file DigitalModule.cpp.
void DigitalModule::SetDO_PWMDutyCycle | ( | uint32_t | pwmGenerator, |
float | dutyCycle | ||
) |
Configure the duty-cycle of the PWM generator
pwmGenerator | The generator index reserved by AllocateDO_PWM() |
dutyCycle | The percent duty cycle to output [0..1]. |
Definition at line 502 of file DigitalModule.cpp.
void DigitalModule::SetDO_PWMOutputChannel | ( | uint32_t | pwmGenerator, |
uint32_t | channel | ||
) |
Configure which DO channel the PWM siganl is output on
pwmGenerator | The generator index reserved by AllocateDO_PWM() |
channel | The Digital Output channel to output on |
Definition at line 474 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.
rate | The frequency to output all digital output PWM signals on this module. |
Definition at line 458 of file DigitalModule.cpp.
void DigitalModule::SetPWM | ( | uint32_t | channel, |
uint8_t | value | ||
) |
void DigitalModule::SetPWMPeriodScale | ( | uint32_t | channel, |
uint32_t | squelchMask | ||
) |
Set how how often the PWM signal is squelched, thus scaling the period.
channel | The PWM channel to configure. |
squelchMask | The 2-bit mask of outputs to squelch. |
Definition at line 147 of file DigitalModule.cpp.
void DigitalModule::SetRelayForward | ( | uint32_t | 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 160 of file DigitalModule.cpp.
void DigitalModule::SetRelayReverse | ( | uint32_t | 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 181 of file DigitalModule.cpp.