Crate lsm303c[−][src]
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
AccelAxesControl |
Accel axes control |
Lsm303c |
LSM303C driver |
LsmConfig |
Configuration of Lsm303c |
Measurements |
Measurements scaled with respective scales and converted to appropriate units. |
UnscaledMeasurements |
Unscaled measurements (LSB) |
Enums
AccelBlockDataUpdate |
Block data update for accel data. |
AccelDataRate |
Accelerometer Output Data Rate |
AccelScale |
Acceleration scale/sensitivity |
MagBlockDataUpdate |
Block data update for accel data. |
MagDataRate |
Magnetometer Output Data Rate |
MagMode |
Magnetrometer mode |
MagScale |
Magnetometer full scale. LSM303C only supports 16 ga. |
MagXYOperativeMode |
Magnetrometer X and Y axes operative mode selection. Default: High performance. |
MagZOperativeMode |
Magnetrometer Z axis operative mode selection Default value: HighPerformance. |
TempControl |
Controls (disable or enable) temperature sensor. |
Constants
G |
G constant |
Type Definitions
Vector3 |
A stack-allocated, 3-dimensional column vector. |