Expand description
ADXL355 embedded-hal SPI driver crate
A platform agnostic driver to interface with the ADXL355 Accelerometer.
This driver uses SPI via embedded-hal and implements the Accelerometer trait
from the accelerometer crate.
§Usage
Use embedded-hal implementation to get SPI and a GPIO OutputPin for the chip select, then create the accelerometer handle
use adxl355::{Adxl355, Config as ADXLConfig, ODR_LPF, Range, Accelerometer};
// to create sensor with default configuration:
let mut accelerometer = Adxl355::default(spi, cs)?;
// start measurements
accelerometer.start();
// to get 3d accerlation data:
let accel = accelerometer.accel_norm()?;
println!("{:?}", accel);
// One can also use conf module to supply configuration:
let mut accelerometer =
Adxl355::new(spi, cs,
ADXLConfig::new()
.odr(ODR_LPF::ODR_31_25_Hz)
.range(Range::_2G))?;§References
Modules§
- error
- Accelerometer errors - generic over an inner “cause” type (intended to be an underlying I2C or SPI error type, if applicable).
Structs§
- Adxl355
- ADXL355 driver
- Config
- Error
- Accelerometer errors, generic around another error type
Erepresenting an (optional) cause of this error. - F32x3
- 3-dimensional XYZ vector of
f32values - I32x3
- 3-dimensional XYZ vector of
i32values
Enums§
- HPF_
CORNER - High pass corner frequency is proportional to the output data rate (ODR)
- ODR_LPF
- Output data rate (odr) and Low pass filter corner frequency (lpf)
- Range
Traits§
- Accelerometer
- Accelerometer trait which provides g-normalized readings.
- RawAccelerometer
- Read raw acceleration vectors of type
V: Vector.