Crate mpu9250[−][src]
no_std driver for the MPU9250 & onboard AK8963 (accelerometer + gyroscope + magnetometer IMU)
Connections
- NCS
- SCL = SCK
- SDA = SDI = MOSI
- AD0 = SDO = MISO
Usage
Use embedded-hal implementation to get SPI, NCS, and delay, then create mpu handle
// to create sensor with mag support and default configuration: let mut mpu = Mpu9250::marg_default(spi, ncs, &mut delay)?; // to create sensor without mag support and default configuration: let mut mpu = Mpu9250::imu_default(spi, ncs, &mut delay)?; // to get all supported measurements: let all = mpu.all()?; println!("{:?}", all); // One can also use conf module to supply configuration: let cfg = mpu9250::conf::Config::marg().mag_scale(conf::MagScale::_14BITS); let mut mpu = Mpu9250::marg(spi, ncs, &mut delay, cfg)?;
More examples (for stm32) in [Proving ground] repo.
References
Structs
ImuMeasurements |
Scaled IMU measurements converted to units |
MargMeasurements |
MARG measurements scaled with respective scales and converted to appropriate units. |
Mpu9250 |
MPU9250 driver |
MpuConfig |
Configuration of MPU9250 |
UnscaledImuMeasurements |
Unscaled IMU measurements (LSB) |
UnscaledMargMeasurements |
Unscaled MARG measurements (LSB) |
Enums
AccelDataRate |
Controls the accelerometer data rate and bandwidth.
Can be either set to FChoice, or to one of the 8
digital low pass filter modes. If the DLPF mode is used rate and bandwith
can be further tweaked by Sample Rate Divisor.
See page 13 of [ |
AccelScale |
Accelerometer reading full scale configuration, default: +2g. |
Dlpf |
Digital low pass filter configuration; default: _0; |
Error |
MPU Error |
GyroScale |
Gyroscope reading full scale configuration; default: +250 dps. |
GyroTempDataRate |
Controls the gyroscope and temperature sensor data rates and bandwidth.
Can be either set to one of two FChoices, or to one of the 8
digital low pass filter modes. If the DLPF mode is used rate and bandwith
can be further tweaked by Sample Rate Divisor.
See page 13 of [ |
MagScale |
Gyroscope reading full scale configuration; default: 0.6 mG per LSB |
MpuXDevice |
Suported MPUx devices |
Constants
G |
G constant |
MODE |
SPI mode |
Type Definitions
Vector3 |
A stack-allocated, 3-dimensional column vector. |