Expand description
A platform agnostic driver to interface with the LSM303C (accelerometer + compass)
This driver is built using [embedded-hal
] traits.
Usage
Use embedded-hal implementation to get I2C, then create lsm handle
// to create sensor with default configuration:
let mut lsm = Lsm303c::default(i2c)?;
// to get all supported measurements:
let all = lsm.all()?;
println!("{:?}", all);
// One can also use conf module to supply configuration:
let mut lsm =
LsmConfig::new(i2c,
LsmConfig::new().mag_scale(conf::MagScale::_16_Ga))?;
More examples (for stm32) in [Proving ground] repo.
References
Structs
Accel axes control
LSM303C driver
Configuration of Lsm303c
Measurements scaled with respective scales and converted
to appropriate units.
Unscaled measurements (LSB)
Enums
Block data update for accel data.
Accelerometer Output Data Rate
Acceleration scale/sensitivity
LSM Error
Block data update for accel data.
Magnetometer Output Data Rate
Magnetrometer mode
Magnetometer full scale.
LSM303C only supports 16 ga.
Magnetrometer X and Y axes operative mode selection.
Default: High performance.
Magnetrometer Z axis operative mode selection
Default value: HighPerformance.
Controls (disable or enable) temperature sensor.
Constants
G constant
Type Definitions
A stack-allocated, 3-dimensional column vector.