mpu6050-dmp
Platform-independent i2c Driver for the InvenSense MPU-6050 motion-processor.
Fork of drogue-mpu-6050
Reasons/differences:
- Dependency on
drogue-embedded-timerandembedded-timeremoved- Timers are not required in regular operation, just for setup
- drogue-embedded-timer is out of sync with current versions of embedded-time as of time-of-fork
- Dependency on
logremoved - Slight difference in conversion of Quaternion to YPR (no
pitch -= PI) - Various fixes for e.g. clippy lints (also PR'd upstream)
Demo Project for STM32F1
Demo Project for STM32F4
On-Chip DMP 'Digital Motion Processor'
This driver can load the appropriate firmware for quaternion-based on-chip DMP processing.
Setup
i2c
Initialize your i2c bus:
let gpiob = dp.GPIOB.split;
let scl = gpiob
.pb8
.into_alternate
.internal_pull_up
.set_open_drain;
let sda = gpiob
.pb9
.into_alternate
.internal_pull_up
.set_open_drain;
let i2c = dp.I2C1.i2c;
MPU driver
let sensor = new.unwrap;
Setting up the DMP requires temporary exclusive access to a blocking delay implementation.
The initialize_dmp(&mut delay) method is provided to set up reasonable configurations and load the DMP firmware into the processor.
sensor.initialize_dmp.unwrap;
If using the advanced on-chip DMP logic, the FIFO will contain 28-byte packets of quaternion and other data.
The first 16 bytes are quaternions, which can be constructed using the Quaternion class.
let len = sensor.get_fifo_count.unwrap;
if len >= 28