Struct mpu6050::Mpu6050

source ·
pub struct Mpu6050<I> { /* private fields */ }
Expand description

Handles all operations on/with Mpu6050

Implementations

Side effect free constructor with default sensitivies, no calibration

custom sensitivity

Same as new, but the chip address can be specified (e.g. 0x69, if the A0 pin is pulled up)

Combination of new_with_sens and new_with_addr

From Register map: “An internal 8MHz oscillator, gyroscope based clock,or external sources can be selected as the MPU-60X0 clock source. When the internal 8 MHz oscillator or an external source is chosen as the clock source, the MPU-60X0 can operate in low power modes with the gyroscopes disabled. Upon power up, the MPU-60X0clock source defaults to the internal oscillator. However, it is highly recommended that the device beconfigured to use one of the gyroscopes (or an external clocksource) as the clock reference for improved stability. The clock source can be selected according to the following table….”

get current clock source

Init wakes MPU6050 and verifies register addr, e.g. in i2c

setup motion detection sources:

  • https://github.com/kriswiner/MPU6050/blob/a7e0c8ba61a56c5326b2bcd64bc81ab72ee4616b/MPU6050IMU.ino#L486
  • https://arduino.stackexchange.com/a/48430

get whether or not motion has been detected (INT_STATUS, MOT_INT)

set accel high pass filter mode

get accel high pass filter mode

Set gyro range, and update sensitivity accordingly

get current gyro range

set accel range, and update sensitivy accordingly

get current accel_range

reset device

enable, disable sleep of sensor

get sleep status

enable, disable temperature measurement of sensor TEMP_DIS actually saves “disabled status” 1 is disabled! -> enable=true : bit=!enable

get temperature sensor status TEMP_DIS actually saves “disabled status” 1 is disabled! -> 1 == 0 : false, 0 == 0 : true

set accel x self test

get accel x self test

set accel y self test

get accel y self test

set accel z self test

get accel z self test

Roll and pitch estimation from raw accelerometer readings NOTE: no yaw! no magnetometer present on MPU6050 https://www.nxp.com/docs/en/application-note/AN3461.pdf equation 28, 29

Accelerometer readings in g

Gyro readings in rad/s

Sensor Temp in degrees celcius

Writes byte to register

Enables bit n at register address reg

Write bits data at reg from start_bit to start_bit+length

Read bits at register reg, starting with bit start_bit, until start_bit+length

Reads byte from register

Reads series of bytes into buf from specified reg

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.