Crates.io | mpu6886 |
lib.rs | mpu6886 |
version | 0.1.0 |
source | src |
created_at | 2023-02-19 18:51:16.53757 |
updated_at | 2023-02-19 18:51:16.53757 |
description | Platform agnostic driver for mpu6886 6-axis IMU |
homepage | |
repository | https://github.com/oldsheep68/mpu6886 |
max_upload_size | |
id | 789211 |
size | 53,322 |
mpu6886
no_std driver for the mpu6886 6-axis IMU
thanks to "Julian Gaal gjulian@uos.de", for the major work in mpu6050 only small adaptions for mpu6886 were done:
device ID for mpu6886 changed
temperature reading adapted
CLKSEL is redefined
IRQ STATUS redefined removed:
MOT_DETECT_STATUS
MOT_DETECT_CONTROL
LP_WAKE_CTRL
ACCEL_HPF
Not, almost no tests have been done yet.
Reading the accelerometer, gyroscope, temperature sensor
Setting Accel/Gyro Ranges/Sensitivity
To use this driver you must provide a concrete embedded_hal
implementation. Here's a
linux_embedded_hal
example
use mpu6886::*;
use linux_embedded_hal::{I2cdev, Delay};
use i2cdev::linux::LinuxI2CError;
fn main() -> Result<(), mpu6886Error<LinuxI2CError>> {
let i2c = I2cdev::new("/dev/i2c-1")
.map_err(mpu6886Error::I2c)?;
let mut delay = Delay;
let mut mpu = mpu6886::new(i2c);
mpu.init(&mut delay)?;
loop {
// get roll and pitch estimate
let acc = mpu.get_acc_angles()?;
println!("r/p: {:?}", acc);
// get temp
let temp = mpu.get_temp()?;
println!("temp: {:?}c", temp);
// get gyro data, scaled with sensitivity
let gyro = mpu.get_gyro()?;
println!("gyro: {:?}", gyro);
// get accelerometer data, scaled with sensitivity
let acc = mpu.get_acc()?;
println!("acc: {:?}", acc);
}
}