Crates.io | mpu9250 |
lib.rs | mpu9250 |
version | 0.25.0 |
source | src |
created_at | 2018-08-14 22:23:57.365452 |
updated_at | 2023-07-29 17:34:56.96719 |
description | no_std driver for the MPU9250 & onboard AK8963 (accelerometer + gyroscope + magnetometer IMU) |
homepage | |
repository | https://github.com/copterust/mpu9250 |
max_upload_size | |
id | 79479 |
size | 166,202 |
mpu9250
no_std driver for the MPU9250 (and some MPU* devices) & onboard AK8963 (accelerometer + gyroscope + magnetometer IMU).
MPU9250
-- Imu
and Marg
;MPU9255
-- Imu
and Marg
;MPU6500
-- Imu
only.MPU9255 has some extra capability in the ASIC that allows some additional gesture control but otherwise this chip is identical to the MPU9250.
Include library as a dependency in your Cargo.toml :
[dependencies.mpu9250]
version = "<version>"
Use embedded-hal implementation to get SPI, NCS, and delay, then create mpu handle:
extern crate mpu9250; // or just use mpu9250; if 2018 edition is used.
// to create sensor with mag support and default configuration:
let mut _imu = Mpu9250::marg_default(spi, ncs, &mut delay)?;
// to create sensor without mag support and default configuration:
let mut marg = Mpu9250::imu_default(spi, ncs, &mut delay)?;
// to get all supported measurements:
let all = marg.all()?;
println!("{:?}", all);
Number of examples can be found in proving-ground repo. Examples include: reading temperature, calibrating magnetrometer, reading all sensors.
Expiremntal I2C support is enabled via i2c
feature flag. When enabled, SPI support will be deactivated
and type of mpu9250 driver will change from Mpu9250<SpiDevice<SPI, NCS>, MODE>
will change to
Mpu9250<I2cDevice<I2C>, Imu>
.
The MPU9250 currently supports an IMU-only configuration. See the BeagleBone Blue example for a demonstration. Support for the AK8963 is a WPI.
API Docs available on docs.rs.
Licensed under either of
at your option.
Started off as a fork of japaric's mpu9250 repo.