WPILibC++ 2023.4.3
frc::ADXL362 Class Reference

ADXL362 SPI Accelerometer. More...

#include <frc/ADXL362.h>

Inheritance diagram for frc::ADXL362:
frc::Accelerometer nt::NTSendable wpi::SendableHelper< ADXL362 > wpi::Sendable

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 () override=default
 
 ADXL362 (ADXL362 &&)=default
 
ADXL362operator= (ADXL362 &&)=default
 
SPI::Port GetSpiPort () const
 
void SetRange (Range range) final
 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 (nt::NTSendableBuilder &builder) override
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from frc::Accelerometer
 Accelerometer ()=default
 
virtual ~Accelerometer ()=default
 
 Accelerometer (Accelerometer &&)=default
 
Accelerometeroperator= (Accelerometer &&)=default
 
virtual void SetRange (Range range)=0
 Common interface for setting the measuring range of an accelerometer. More...
 
virtual double GetX ()=0
 Common interface for getting the x axis acceleration. More...
 
virtual double GetY ()=0
 Common interface for getting the y axis acceleration. More...
 
virtual double GetZ ()=0
 Common interface for getting the z axis acceleration. More...
 
- Public Member Functions inherited from nt::NTSendable
virtual void InitSendable (NTSendableBuilder &builder)=0
 Initializes this Sendable object. More...
 
void InitSendable (wpi::SendableBuilder &builder) override
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from wpi::Sendable
virtual ~Sendable ()=default
 
virtual void InitSendable (SendableBuilder &builder)=0
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from wpi::SendableHelper< ADXL362 >
 SendableHelper (const SendableHelper &rhs)=default
 
 SendableHelper (SendableHelper &&rhs)
 
SendableHelperoperator= (const SendableHelper &rhs)=default
 
SendableHelperoperator= (SendableHelper &&rhs)
 

Additional Inherited Members

- Protected Member Functions inherited from wpi::SendableHelper< ADXL362 >
 SendableHelper ()=default
 
 ~SendableHelper ()
 

Detailed Description

ADXL362 SPI Accelerometer.

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

Member Enumeration Documentation

◆ Axes

Enumerator
kAxis_X 
kAxis_Y 
kAxis_Z 

Constructor & Destructor Documentation

◆ ADXL362() [1/3]

frc::ADXL362::ADXL362 ( Range  range = kRange_2G)
explicit

Constructor.

Uses the onboard CS1.

Parameters
rangeThe range (+ or -) that the accelerometer will measure.

◆ ADXL362() [2/3]

frc::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.

◆ ~ADXL362()

frc::ADXL362::~ADXL362 ( )
overridedefault

◆ ADXL362() [3/3]

frc::ADXL362::ADXL362 ( ADXL362 &&  )
default

Member Function Documentation

◆ GetAcceleration()

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

Get the acceleration of one axis in Gs.

Parameters
axisThe axis to read from.
Returns
Acceleration of the ADXL362 in Gs.

◆ GetAccelerations()

virtual AllAxes frc::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.

◆ GetSpiPort()

SPI::Port frc::ADXL362::GetSpiPort ( ) const

◆ GetX()

double frc::ADXL362::GetX ( )
overridevirtual

Common interface for getting the x axis acceleration.

Returns
The acceleration along the x axis in g-forces

Implements frc::Accelerometer.

◆ GetY()

double frc::ADXL362::GetY ( )
overridevirtual

Common interface for getting the y axis acceleration.

Returns
The acceleration along the y axis in g-forces

Implements frc::Accelerometer.

◆ GetZ()

double frc::ADXL362::GetZ ( )
overridevirtual

Common interface for getting the z axis acceleration.

Returns
The acceleration along the z axis in g-forces

Implements frc::Accelerometer.

◆ InitSendable()

void frc::ADXL362::InitSendable ( nt::NTSendableBuilder builder)
overridevirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements nt::NTSendable.

◆ operator=()

ADXL362 & frc::ADXL362::operator= ( ADXL362 &&  )
default

◆ SetRange()

void frc::ADXL362::SetRange ( Range  range)
finalvirtual

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 file: