ADXL362DMA (community library)
Summary
Name | Value |
---|---|
Name | ADXL362DMA |
Version | 0.0.7 |
Installs | 4064 |
License | MIT |
Author | Rick Kaseguma rickkas7@rickk.com |
URL | https://github.com/rickkas7/ADXL362DMA |
Repository | https://github.com/rickkas7/ADXL362DMA.git |
Download | .tar.gz |
All Versions | 0.0.7, 0.0.6, 0.0.5, 0.0.4 |
ADXL362 accelerometer driver with SPI DMA support
Example Build Testing
Device OS Version:
This table is generated from an automated build. Success only indicates that the code compiled successfully.
Library Read Me
This content is provided by the library maintainer and has not been validated or approved.
ADXL362DMA
Library for ADXL362 accelerometer that uses SPI DMA for efficient transfers
The ADXL362 is an inexpensive 3-DOF ultra-low power accelerometer. It can do movement detection from rest continuously at 270 nA (yes, nano-amps!) and also has a large FIFO that makes it possible to buffer samples while the processor is busy or even sleeping.
The GY362 is a compatible version of the ADXL362 and also works with this library.
- Github repository
- License: MIT (free for use in open or closed source projects, including commercial products)
- Datasheet
- Full browsable API documentation
Usage
Hardware connections
This library uses the ADXL362 in SPI mode.
Breadboard (image removed)
Breakout | Particle Device | Color | Description |
---|---|---|---|
VIN | 3V3 | Red | 3.3V DC Power |
GND | GND | Black | Ground |
SCL / SCLK | Orange | SPI CLK | |
SDA / MOSI / SDI | Blue | SPI MOSI | |
SDO / MISO | Green | SPI MISO | |
CS | A2 | Yellow | SPI Chip Select |
INT2 | n/c | Interrupt 2 (not used) | |
INT1 | n/c | Interrupt 1 (not used) |
Software
Instantiate a global object for the accelerometer. The first parameter is the SPI bus amd the second is the CS line.
ADXL362DMA accel(SPI, A2);
Initialize the chip:
accel.softReset();
while(accel.readStatus() == 0) {
Log.info("no status yet, waiting for accelerometer");
delay(1000);
}
Enable measuring mode (it boots into standby mode):
accel.setMeasureMode(true);
}
Read data. There is also a function to read roll and pitch data instead of raw data, see example 4-rollpitch.
int16_t x, y, z;
accel.readXYZ(x, y, z);
Serial.printlnf("%5d %5d %5d", (int)x, (int)y, (int)z);
Version history
0.0.7 (2023-06-02)
- Fixed occasional SOS+1 hard fault at boot when using the class as a globally constructed object.
Browse Library Files