WPILibC++  unspecified
frc::ADXL362 Class Reference

ADXL362 SPI Accelerometer. More...

#include <ADXL362.h>

Inheritance diagram for frc::ADXL362:
Collaboration diagram for frc::ADXL362:

Classes

struct  AllAxes
 

Public Types

enum  Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 }
 
- Public Types inherited from frc::Accelerometer
enum  Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 }
 

Public Member Functions

 ADXL362 (Range range=kRange_2G)
 Constructor. More...
 
 ADXL362 (SPI::Port port, Range range=kRange_2G)
 Constructor. More...
 
 ADXL362 (const ADXL362 &)=delete
 
ADXL362operator= (const ADXL362 &)=delete
 
void SetRange (Range range) override
 Common interface for setting the measuring range of an accelerometer. More...
 
double GetX () override
 Common interface for getting the x axis acceleration. More...
 
double GetY () override
 Common interface for getting the y axis acceleration. More...
 
double GetZ () override
 Common interface for getting the z axis acceleration. More...
 
virtual double GetAcceleration (Axes axis)
 Get the acceleration of one axis in Gs. More...
 
virtual AllAxes GetAccelerations ()
 Get the acceleration of all axes in Gs. More...
 
void InitSendable (SendableBuilder &builder) override
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from frc::SensorBase
 SensorBase (const SensorBase &)=delete
 
SensorBaseoperator= (const SensorBase &)=delete
 
- Public Member Functions inherited from frc::ErrorBase
 ErrorBase (const ErrorBase &)=delete
 
ErrorBaseoperator= (const ErrorBase &)=delete
 
virtual ErrorGetError ()
 Retrieve the current error. More...
 
virtual const ErrorGetError () const
 
virtual void SetErrnoError (const llvm::Twine &contextMessage, llvm::StringRef filename, llvm::StringRef function, int 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 llvm::Twine &contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
 Set the current error information associated from the nivision Imaq API. More...
 
virtual void SetError (Error::Code code, const llvm::Twine &contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetErrorRange (Error::Code code, int32_t minRange, int32_t maxRange, int32_t requestedValue, const llvm::Twine &contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetWPIError (const llvm::Twine &errorMessage, Error::Code code, const llvm::Twine &contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void CloneError (const 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...
 
- Public Member Functions inherited from frc::SendableBase
 SendableBase (bool addLiveWindow=true)
 Creates an instance of the sensor base. More...
 
 ~SendableBase () override
 Free the resources used by this object.
 
std::string GetName () const final
 Gets the name of this Sendable object. More...
 
void SetName (const llvm::Twine &name) final
 Sets the name of this Sendable object. More...
 
std::string GetSubsystem () const final
 Gets the subsystem name of this Sendable object. More...
 
void SetSubsystem (const llvm::Twine &subsystem) final
 Sets the subsystem name of this Sendable object. More...
 
- Public Member Functions inherited from frc::Sendable
void SetName (const llvm::Twine &subsystem, const llvm::Twine &name)
 Sets both the subsystem name and device name of this Sendable object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from frc::SensorBase
static int GetDefaultSolenoidModule ()
 
static bool CheckSolenoidModule (int moduleNumber)
 Check that the solenoid module number is valid. More...
 
static bool CheckDigitalChannel (int channel)
 Check that the digital channel number is valid. More...
 
static bool CheckRelayChannel (int channel)
 Check that the relay channel number is valid. More...
 
static bool CheckPWMChannel (int channel)
 Check that the digital channel number is valid. More...
 
static bool CheckAnalogInputChannel (int channel)
 Check that the analog input number is value. More...
 
static bool CheckAnalogOutputChannel (int channel)
 Check that the analog output number is valid. More...
 
static bool CheckSolenoidChannel (int channel)
 Verify that the solenoid channel number is within limits. More...
 
static bool CheckPDPChannel (int channel)
 Verify that the power distribution channel number is within limits. More...
 
- Static Public Member Functions inherited from frc::ErrorBase
static void SetGlobalError (Error::Code code, const llvm::Twine &contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber)
 
static void SetGlobalWPIError (const llvm::Twine &errorMessage, const llvm::Twine &contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber)
 
static ErrorGetGlobalError ()
 Retrieve the current global error.
 
- Static Public Attributes inherited from frc::SensorBase
static const int kDigitalChannels = HAL_GetNumDigitalChannels()
 
static const int kAnalogInputs = HAL_GetNumAnalogInputs()
 
static const int kAnalogOutputs
 
static const int kSolenoidChannels = HAL_GetNumSolenoidChannels()
 
static const int kSolenoidModules = HAL_GetNumPCMModules()
 
static const int kPwmChannels = HAL_GetNumPWMChannels()
 
static const int kRelayChannels = HAL_GetNumRelayHeaders()
 
static const int kPDPChannels = HAL_GetNumPDPChannels()
 
- Protected Member Functions inherited from frc::SendableBase
void AddChild (std::shared_ptr< Sendable > child)
 Add a child component. More...
 
void AddChild (void *child)
 Add a child component. More...
 
void SetName (const llvm::Twine &moduleType, int channel)
 Sets the name of the sensor with a channel number. More...
 
void SetName (const llvm::Twine &moduleType, int moduleNumber, int channel)
 Sets the name of the sensor with a module and channel number. More...
 
- Protected Attributes inherited from frc::ErrorBase
Error m_error
 
- Static Protected Attributes inherited from frc::ErrorBase
static wpi::mutex _globalErrorMutex
 
static Error _globalError
 

Detailed Description

ADXL362 SPI Accelerometer.

This class allows access to an Analog Devices ADXL362 3-axis accelerometer.

Constructor & Destructor Documentation

ADXL362::ADXL362 ( Range  range = kRange_2G)
explicit

Constructor.

Uses the onboard CS1.

Parameters
rangeThe range (+ or -) that the accelerometer will measure.
ADXL362::ADXL362 ( SPI::Port  port,
Range  range = kRange_2G 
)
explicit

Constructor.

Parameters
portThe SPI port the accelerometer is attached to
rangeThe range (+ or -) that the accelerometer will measure.

Member Function Documentation

double ADXL362::GetAcceleration ( ADXL362::Axes  axis)
virtual

Get the acceleration of one axis in Gs.

Parameters
axisThe axis to read from.
Returns
Acceleration of the ADXL362 in Gs.
ADXL362::AllAxes ADXL362::GetAccelerations ( )
virtual

Get the acceleration of all axes in Gs.

Returns
An object containing the acceleration measured on each axis of the ADXL362 in Gs.
double ADXL362::GetX ( )
overridevirtual

Common interface for getting the x axis acceleration.

Returns
The acceleration along the x axis in g-forces

Implements frc::Accelerometer.

double ADXL362::GetY ( )
overridevirtual

Common interface for getting the y axis acceleration.

Returns
The acceleration along the y axis in g-forces

Implements frc::Accelerometer.

double ADXL362::GetZ ( )
overridevirtual

Common interface for getting the z axis acceleration.

Returns
The acceleration along the z axis in g-forces

Implements frc::Accelerometer.

void ADXL362::InitSendable ( SendableBuilder builder)
overridevirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements frc::Sendable.

void ADXL362::SetRange ( Range  range)
overridevirtual

Common interface for setting the measuring range of an accelerometer.

Parameters
rangeThe maximum acceleration, positive or negative, that the accelerometer will measure. Not all accelerometers support all ranges.

Implements frc::Accelerometer.


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