Loading...
Searching...
No Matches
LSM303AGR 3D accelerometer/magnetometer

Device driver for the LSM303AGR 3D accelerometer/magnetometer.

Device driver for the LSM303AGR 3D accelerometer/magnetometer.

This driver is written in Rust, and based on the externally maintained lsm303agr crate.

This means that:

Usage

When configured on a board, the devices are initialized at a fixed data acquisition rate and the chip's default range of +-2g. Data values are obtained on demand whenever queried through [S]ensor [A]ctuator [U]ber [L]ayer.

For each device, two SAUL entries are registered labelled "LSM303AGR accelerometer" and "LSM303AGR magnetometer", which produces 3-axis values in units of g and Tesla, respectively. Accelerometer values are always scaled to milli-g (they come that way and don't exceed the i16 range of SAUL phydats); magnetometer readings are dynamically downscaled from their original i32 Nanotesla readings to fit in a phydat.

The driver is configured for a board by placing an lsm303agr-config.rs file in the board's include directory, which lists the I2C device(s) on which an accelerometer should be found:

const I2C_DEVICES: &[u8] = &[0];

Limitations