16 releases

0.3.0 May 22, 2022
0.2.1 Mar 26, 2021
0.1.9 Oct 6, 2020
0.1.8 Jul 27, 2020
0.0.5 May 17, 2020

#830 in Hardware support

34 downloads per month

Apache-2.0

23KB
598 lines

MPU6000

DATASHEET | REGISTER MAP

Example

use embedded_hal::blocking::delay::DelayMs;
use mpu6000::{Bus, DelayMs, MPU6000};
use mpu6000::registers::{AccelerometerSensitive, GyroSensitive};
...
// create SPI that implemented embedded_hal::blocking::spi::Write + Transfer
// create OutputPin as Chip Select that impelmented embedded_hal::digital::v2::OutputPin
// create Delay that implemented embedded_hal::blocking::delay::DelayMs
...
let mut spi_bus: SpiBus<SPI, OutputPin> = SpiBus::new(spi, output_pin);
let mpu6000 = MPU6000::new(&mut spi_bus);
mpu6000.reset(&delay)?;
mpu6000.wake(&delay)?;
mpu6000.set_accelerometer_sensitive(accelerometer_sensitive!(+/-16g, 2048/LSB))?;
mpu6000.set_gyro_sensitive(gyro_sensitive!(+/-2000dps, 16.4LSB/dps))?;

Dependencies

~1.5MB
~38K SLoC