Overview

Driver for an Analog Devices ADXL345 3-axis accelerometer.

Resources

All correct at time of writing, but as always, manufacturers love to move things around on their website.

Web page

http://www.analog.com/en/sensors/inertial-sensors/adxl345/products/product.html

Datasheet

http://www.analog.com/static/imported-files/data_sheets/ADXL345.pdf

Test hardware

This code has been tested using a SolderCore CoreTilt module:

http://soldercore.com/products/sensecore/coretilt/

This was wired to a CoreProto and plugged into a SenseCore:

http://soldercore.com/products/sensecore/

And finally installed on a SolderCore:

http://soldercore.com/products/soldercore/

Specification
Parameter Supported settings
Bandwidth (Hz) 0.05, 0.1, 0.2, 0.39, 0.78, 1.56, 3.13, 6.25, 12.5, 25, 50, 100, 200, 400, 800, 1600
Range (g) ±2, ±4, ±8, ±16
Communication up to 3.4 MHz (I2C) and 5 MHz (SPI)

API Summary

Constants
ADXL345_I2C_ADDR_ALTERNATE Alternate 8-bit I2C address
ADXL345_I2C_ADDR_DEFAULT Default 8-bit I2C address
Functions
adxl345_initialize_i2c Initialize sensor on I2C bus
adxl345_initialize_spi Initialize sensor on SPI bus