adxl355 0.2.1

A platform agnostic driver to interface with the ADXL355 through SPI (accelerometer) failed to build adxl355-0.2.1
Please check the build logs and, if you believe this is' fault, open an issue.
Visit the last successful build: adxl355-0.2.3

ADXL355 embedded-hal driver crate


Include library as a dependency in your Cargo.toml

version = "<version>"

Use embedded-hal implementation to get SPI and a GPIO OutputPin for the chip select, then create the accelerometer handle

use adxl355::{Adxl355, Accelerometer};

// to create sensor with default configuration:
let mut accelerometer = Adxl355::default(spi, cs)?;

// start measurements

// to get 3d accerlation data:
let accel = accelerometer.acceleration()?;
println!("{:?}", accel);

// One can also use conf module to supply configuration:

use adxl355::{Adxl355, Config as ADXLConfig, ODR_LPF, Range, Accelerometer};

Adxl355::new(spi, cs,

Running the examples

Blackpill board (STM32F103)

Example based on the stm32f103 microcontroller [examples/]

To build an example

cargo build --example blackpill --features="stm32f103"

And run immediately. Flashing with black magic probe using script (only works for MacOS at the moment).

cargo run --example blackpill --features="stm32f103"


Example based on the stm32g070 microcontroller [examples/]

To build an example

cargo build --example stm32g070 --features=stm32g070 --target thumbv6m-none-eabi

The resulting ELF file can be found under target/thumbv6m-none-eabi/examples/.

To run immediately

cargo run --example stm32g070 --features=stm32g070 --target thumbv6m-none-eabi

This will make use of that assumes the st-link utilities are available in your PATH.

Example with normalized data

cargo run --example norm_stm32g070 --features=stm32g070 --target thumbv6m-none-eabi