WPILib  2014.0
WPIRoboticsLibraryforFRC
 All Classes Functions Variables Pages
Public Member Functions | Static Public Attributes | List of all members
GearTooth Class Reference

#include <GearTooth.h>

Inheritance diagram for GearTooth:
Counter SensorBase CounterBase ErrorBase

Public Member Functions

 GearTooth (uint32_t channel, bool directionSensitive=false)
 
 GearTooth (uint8_t moduleNumber, uint32_t channel, bool directionSensitive=false)
 
 GearTooth (DigitalSource *source, bool directionSensitive=false)
 
 GearTooth (DigitalSource &source, bool directionSensitive=false)
 
virtual ~GearTooth ()
 
void EnableDirectionSensing (bool directionSensitive)
 
virtual std::string GetSmartDashboardType ()
 
- Public Member Functions inherited from Counter
 Counter ()
 
 Counter (uint32_t channel)
 
 Counter (uint8_t moduleNumber, uint32_t channel)
 
 Counter (DigitalSource *source)
 
 Counter (DigitalSource &source)
 
 Counter (AnalogTrigger *trigger)
 
 Counter (AnalogTrigger &trigger)
 
 Counter (EncodingType encodingType, DigitalSource *upSource, DigitalSource *downSource, bool inverted)
 
virtual ~Counter ()
 
void SetUpSource (uint32_t channel)
 
void SetUpSource (uint8_t moduleNumber, uint32_t channel)
 
void SetUpSource (AnalogTrigger *analogTrigger, AnalogTriggerOutput::Type triggerType)
 
void SetUpSource (AnalogTrigger &analogTrigger, AnalogTriggerOutput::Type triggerType)
 
void SetUpSource (DigitalSource *source)
 
void SetUpSource (DigitalSource &source)
 
void SetUpSourceEdge (bool risingEdge, bool fallingEdge)
 
void ClearUpSource ()
 
void SetDownSource (uint32_t channel)
 
void SetDownSource (uint8_t moduleNumber, uint32_t channel)
 
void SetDownSource (AnalogTrigger *analogTrigger, AnalogTriggerOutput::Type triggerType)
 
void SetDownSource (AnalogTrigger &analogTrigger, AnalogTriggerOutput::Type triggerType)
 
void SetDownSource (DigitalSource *source)
 
void SetDownSource (DigitalSource &source)
 
void SetDownSourceEdge (bool risingEdge, bool fallingEdge)
 
void ClearDownSource ()
 
void SetUpDownCounterMode ()
 
void SetExternalDirectionMode ()
 
void SetSemiPeriodMode (bool highSemiPeriod)
 
void SetPulseLengthMode (float threshold)
 
void SetReverseDirection (bool reverseDirection)
 
void Start ()
 
int32_t Get ()
 
void Reset ()
 
void Stop ()
 
double GetPeriod ()
 
void SetMaxPeriod (double maxPeriod)
 
void SetUpdateWhenEmpty (bool enabled)
 
bool GetStopped ()
 
bool GetDirection ()
 
void SetSamplesToAverage (int samplesToAverage)
 
int GetSamplesToAverage ()
 
uint32_t GetIndex ()
 
void UpdateTable ()
 
void StartLiveWindowMode ()
 
void StopLiveWindowMode ()
 
void InitTable (ITable *subTable)
 
ITable * GetTable ()
 
- 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_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 Attributes

static constexpr double kGearToothThreshold = 55e-6
 55 uSec for threshold
 
- 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
 

Additional Inherited Members

- Public Types inherited from Counter
enum  Mode { kTwoPulse =0, kSemiperiod =1, kPulseLength =2, kExternalDirection =3 }
 
- Public Types inherited from CounterBase
enum  EncodingType { k1X, k2X, k4X }
 
- 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 ErrorGetGlobalError ()
 
- Protected Member Functions inherited from SensorBase
void AddToSingletonList ()
 
- Protected Member Functions inherited from ErrorBase
 ErrorBase ()
 Initialize the instance status to 0 for now.
 
- Protected Attributes inherited from Counter
DigitalSourcem_upSource
 What makes the counter count up.
 
DigitalSourcem_downSource
 What makes the counter count down.
 
tCounter * m_counter
 The FPGA counter object.
 
- 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

Alias for counter class. Implement the gear tooth sensor supplied by FIRST. Currently there is no reverse sensing on the gear tooth sensor, but in future versions we might implement the necessary timing in the FPGA to sense direction.

Constructor & Destructor Documentation

GearTooth::GearTooth ( uint32_t  channel,
bool  directionSensitive = false 
)

Construct a GearTooth sensor given a channel.

The default module is assumed.

Parameters
channelThe GPIO channel on the digital module that the sensor is connected to.
directionSensitiveEnable the pulse length decoding in hardware to specify count direction.
GearTooth::GearTooth ( uint8_t  moduleNumber,
uint32_t  channel,
bool  directionSensitive = false 
)

Construct a GearTooth sensor given a channel and module.

Parameters
moduleNumberThe digital module (1 or 2).
channelThe GPIO channel on the digital module that the sensor is connected to.
directionSensitiveEnable the pulse length decoding in hardware to specify count direction.
GearTooth::GearTooth ( DigitalSource source,
bool  directionSensitive = false 
)

Construct a GearTooth sensor given a digital input. This should be used when sharing digial inputs.

Parameters
sourceAn object that fully descibes the input that the sensor is connected to.
directionSensitiveEnable the pulse length decoding in hardware to specify count direction.
GearTooth::~GearTooth ( )
virtual

Free the resources associated with a gear tooth sensor.

Member Function Documentation

void GearTooth::EnableDirectionSensing ( bool  directionSensitive)

Common code called by the constructors.


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