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

#include <SensorBase.h>

Inheritance diagram for SensorBase:
Collaboration diagram for SensorBase:

Public Member Functions

 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_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 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 ErrorGetGlobalError ()
 

Static Public Attributes

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 Member Functions

void AddToSingletonList ()
 
- Protected Member Functions inherited from ErrorBase
 ErrorBase ()
 Initialize the instance status to 0 for now.
 

Additional Inherited Members

- 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
 

Detailed Description

Base class for all sensors. Stores most recent status information as well as containing utility functions for checking channels and error processing.

Definition at line 20 of file SensorBase.h.

Constructor & Destructor Documentation

SensorBase::SensorBase ( )

Creates an instance of the sensor base and gets an FPGA handle

Definition at line 27 of file SensorBase.cpp.

SensorBase::~SensorBase ( )
virtual

Frees the resources for a SensorBase.

Definition at line 34 of file SensorBase.cpp.

Member Function Documentation

void SensorBase::AddToSingletonList ( )
protected

Add sensor to the singleton list. Add this sensor to the list of singletons that need to be deleted when the robot program exits. Each of the sensors on this list are singletons, that is they aren't allocated directly with new, but instead are allocated by the static GetInstance method. As a result, they are never deleted when the program exits. Consequently these sensors may still be holding onto resources and need to have their destructors called at the end of the program.

Definition at line 47 of file SensorBase.cpp.

bool SensorBase::CheckAnalogChannel ( uint32_t  channel)
static

Check that the analog channel number is value. Verify that the analog channel number is one of the legal channel numbers. Channel numbers are 1-based.

Returns
Analog channel is valid

Definition at line 174 of file SensorBase.cpp.

bool SensorBase::CheckAnalogModule ( uint8_t  moduleNumber)
static

Check that the analog module number is valid.

Returns
Analog module is valid and present

Definition at line 74 of file SensorBase.cpp.

bool SensorBase::CheckDigitalChannel ( uint32_t  channel)
static

Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 1-based.

Returns
Digital channel is valid

Definition at line 132 of file SensorBase.cpp.

bool SensorBase::CheckDigitalModule ( uint8_t  moduleNumber)
static

Check that the digital module number is valid.

Returns
Digital module is valid and present

Definition at line 86 of file SensorBase.cpp.

bool SensorBase::CheckPWMChannel ( uint32_t  channel)
static

Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 1-based.

Returns
PWM channel is valid

Definition at line 160 of file SensorBase.cpp.

bool SensorBase::CheckPWMModule ( uint8_t  moduleNumber)
static

Check that the digital module number is valid.

Returns
Digital module is valid and present

Definition at line 98 of file SensorBase.cpp.

bool SensorBase::CheckRelayChannel ( uint32_t  channel)
static

Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 1-based.

Returns
Relay channel is valid

Definition at line 146 of file SensorBase.cpp.

bool SensorBase::CheckRelayModule ( uint8_t  moduleNumber)
static

Check that the digital module number is valid.

Returns
Digital module is valid and present

Definition at line 108 of file SensorBase.cpp.

bool SensorBase::CheckSolenoidChannel ( uint32_t  channel)
static

Verify that the solenoid channel number is within limits.

Returns
Solenoid channel is valid

Definition at line 186 of file SensorBase.cpp.

bool SensorBase::CheckSolenoidModule ( uint8_t  moduleNumber)
static

Check that the solenoid module number is valid.

Returns
Solenoid module is valid and present

Definition at line 118 of file SensorBase.cpp.

void SensorBase::DeleteSingletons ( )
static

Delete all the singleton classes on the list. All the classes that were allocated as singletons need to be deleted so their resources can be freed.

Definition at line 58 of file SensorBase.cpp.


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

Generated on Sat Apr 26 2014 12:26:47 for WPILibC++ by doxygen 1.8.6