WPILibC++ 2023.4.3
|
ADXL345 Accelerometer on I2C. More...
#include <frc/ADXL345_I2C.h>
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 | |
ADXL345_I2C (I2C::Port port, Range range=kRange_2G, int deviceAddress=kAddress) | |
Constructs the ADXL345 Accelerometer over I2C. More... | |
~ADXL345_I2C () override=default | |
ADXL345_I2C (ADXL345_I2C &&)=default | |
ADXL345_I2C & | operator= (ADXL345_I2C &&)=default |
I2C::Port | GetI2CPort () const |
int | GetI2CDeviceAddress () 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 | |
Accelerometer & | operator= (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< ADXL345_I2C > | |
SendableHelper (const SendableHelper &rhs)=default | |
SendableHelper (SendableHelper &&rhs) | |
SendableHelper & | operator= (const SendableHelper &rhs)=default |
SendableHelper & | operator= (SendableHelper &&rhs) |
Protected Types | |
enum | PowerCtlFields { kPowerCtl_Link = 0x20 , kPowerCtl_AutoSleep = 0x10 , kPowerCtl_Measure = 0x08 , kPowerCtl_Sleep = 0x04 } |
enum | DataFormatFields { kDataFormat_SelfTest = 0x80 , kDataFormat_SPI = 0x40 , kDataFormat_IntInvert = 0x20 , kDataFormat_FullRes = 0x08 , kDataFormat_Justify = 0x04 } |
Protected Attributes | |
I2C | m_i2c |
hal::SimDevice | m_simDevice |
hal::SimEnum | m_simRange |
hal::SimDouble | m_simX |
hal::SimDouble | m_simY |
hal::SimDouble | m_simZ |
Static Protected Attributes | |
static constexpr int | kAddress = 0x1D |
static constexpr int | kPowerCtlRegister = 0x2D |
static constexpr int | kDataFormatRegister = 0x31 |
static constexpr int | kDataRegister = 0x32 |
static constexpr double | kGsPerLSB = 0.00390625 |
Additional Inherited Members | |
Protected Member Functions inherited from wpi::SendableHelper< ADXL345_I2C > | |
SendableHelper ()=default | |
~SendableHelper () | |
ADXL345 Accelerometer on I2C.
This class allows access to a Analog Devices ADXL345 3-axis accelerometer on an I2C bus. This class assumes the default (not alternate) sensor address of 0x1D (7-bit address).
The Onboard I2C port is subject to system lockups. See WPILib Known Issues page for details.
|
protected |
|
protected |
|
explicit |
Constructs the ADXL345 Accelerometer over I2C.
|
overridedefault |
|
default |
|
virtual |
Get the acceleration of one axis in Gs.
axis | The axis to read from. |
|
virtual |
Get the acceleration of all axes in Gs.
int frc::ADXL345_I2C::GetI2CDeviceAddress | ( | ) | const |
I2C::Port frc::ADXL345_I2C::GetI2CPort | ( | ) | const |
|
overridevirtual |
Common interface for getting the x axis acceleration.
Implements frc::Accelerometer.
|
overridevirtual |
Common interface for getting the y axis acceleration.
Implements frc::Accelerometer.
|
overridevirtual |
Common interface for getting the z axis acceleration.
Implements frc::Accelerometer.
|
overridevirtual |
|
default |
|
finalvirtual |
Common interface for setting the measuring range of an accelerometer.
range | The maximum acceleration, positive or negative, that the accelerometer will measure. Not all accelerometers support all ranges. |
Implements frc::Accelerometer.
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |