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 mut mpu =
Mpu9250::marg(spi,
ncs,
&mut delay,
MpuConfig::marg().mag_scale(conf::MagScale::_14BITS))?;
More examples (for stm32) in [Proving ground] repo.