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 - Accel axes control
- Lsm303c
- LSM303C driver
- LsmConfig
- Configuration of Lsm303c
- Measurements
- Measurements scaled with respective scales and converted to appropriate units.
- Unscaled
Measurements - Unscaled measurements (LSB)
Enums§
- Accel
Block Data Update - Block data update for accel data.
- Accel
Data Rate - Accelerometer Output Data Rate
- Accel
Scale - Acceleration scale/sensitivity
- Error
- LSM Error
- MagBlock
Data Update - Block data update for accel data.
- MagData
Rate - Magnetometer Output Data Rate
- MagMode
- Magnetrometer mode
- MagScale
- Magnetometer full scale. LSM303C only supports 16 ga.
- MagXY
Operative Mode - Magnetrometer X and Y axes operative mode selection. Default: High performance.
- MagZ
Operative Mode - Magnetrometer Z axis operative mode selection Default value: HighPerformance.
- Temp
Control - Controls (disable or enable) temperature sensor.
Constants§
- G
- G constant