7 #ifndef __ADXL345_SPI_h__
8 #define __ADXL345_SPI_h__
10 #include "SensorBase.h"
25 static const uint8_t kPowerCtlRegister = 0x2D;
26 static const uint8_t kDataFormatRegister = 0x31;
27 static const uint8_t kDataRegister = 0x32;
28 static constexpr
double kGsPerLSB = 0.00390625;
29 enum SPIAddressFields {kAddress_Read=0x80, kAddress_MultiByte=0x40};
30 enum PowerCtlFields {kPowerCtl_Link=0x20, kPowerCtl_AutoSleep=0x10, kPowerCtl_Measure=0x08, kPowerCtl_Sleep=0x04};
31 enum DataFormatFields {kDataFormat_SelfTest=0x80, kDataFormat_SPI=0x40, kDataFormat_IntInvert=0x20,
32 kDataFormat_FullRes=0x08, kDataFormat_Justify=0x04};
35 enum DataFormat_Range {kRange_2G=0x00, kRange_4G=0x01, kRange_8G=0x02, kRange_16G=0x03};
36 enum Axes {kAxis_X=0x00, kAxis_Y=0x02, kAxis_Z=0x04};
49 ADXL345_SPI(uint8_t moduleNumber, uint32_t clk, uint32_t mosi, uint32_t miso, uint32_t cs,
50 DataFormat_Range range=kRange_2G);
virtual double GetAcceleration(Axes axis)
Definition: ADXL345_SPI.cpp:140
virtual AllAxes GetAccelerations()
Definition: ADXL345_SPI.cpp:159
Definition: DigitalOutput.h:21
ADXL345_SPI(DigitalOutput &clk, DigitalOutput &mosi, DigitalInput &miso, DigitalOutput &cs, DataFormat_Range range=kRange_2G)
Definition: ADXL345_SPI.cpp:28
Definition: ADXL345_SPI.h:22
Definition: SensorBase.h:20
Definition: ADXL345_SPI.h:37
void Init(DigitalOutput *clk, DigitalOutput *mosi, DigitalInput *miso, DigitalOutput *cs, DataFormat_Range range)
Definition: ADXL345_SPI.cpp:87
virtual ~ADXL345_SPI()
Definition: ADXL345_SPI.cpp:120