Releases: wollewald/ADXL345_WE
Replaced #define by constexpr
Several changes:
- Replaced #define by constexpr
- Tidied the constructors
- Replaced private by protected
- Replaced C-cast by static_cast
Various changes
Various changes:
- got rid of several global variables
- corrected typos
- use of pointers for reading the measured values
- corrected some variable type issues (there was no bug, but not best practice)
Calculation for pitch angle changed
I have changed the calculation of the pitch angle. The new method is more widely used than what I had implemented before. You find more information here, e.g.:
https://wiki.dfrobot.com/How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing
SPI clock speed can now be set
I embedded the SPI transaction in SPI.beginTransaction(SPISetttings(clock, MSBFIRST, SPI_MODE3)) and SPI.endTransaction().
The clock can be set using the new setSPIClockSpeed(unsigned long) function.
Added setAngleOffsets and getAngleOffsets functions
With these function you can get and set the angleOffsets. The offset is an xyzFloat.
Fixed a bug in setInterruptPolarity
If forgot to finally write the pority into the register.
FIFO Settings more robust now
When using setFifoParameters after setFifoMode, the mode was overwritten to bypass. This is now changed and the order of the two functions are not relevant anymore.
SPI now implemented
I have added SPI functionality to the library. SPI is faster and needed in case you need high data rates.
Read performance increase
In the readRegister functions, I have added a "false" in Wire.endTransmission() ---> Wire.endTransmission(false) before Wire.requestFrom(). This saves some microseconds.
TwoWire object can now be passed to the constructor
There are now several ways to create your ADXL345 object:
- ADXL345_WE myAcc = ADXL345_WE() -> uses Wire / I2C Address = 0x53
- ADXL345_WE myAcc = ADXL345_WE(ADXL345_I2CADDR) -> uses Wire / ADXL345_I2CADDR
- ADXL345_WE myAcc = ADXL345_WE(&wire2) -> uses the TwoWire object wire2 / ADXL345_I2CADDR
- ADXL345_WE myAcc = ADXL345_WE(&wire2, ADXL345_I2CADDR) -> all together
So now you are able to use the two I2C busses of ESP32 boards.