Struct rustduino::sensors::MPU6050 [−][src]
#[repr(C, packed)]pub struct MPU6050<'a> { pub address: u8, pub accel_output: FixedSliceVec<'a, f32>, pub gyro_output: FixedSliceVec<'a, f32>, }
Expand description
Controls the MPU6050 Gyroscopic Sensor.
Elements
address
- a u8, used to store the address to control the functioning AHT10 sensor.accel_output
- a vector with u8 objects, It would be used to store the two byte accelerometer data read through the sensors.gyro_output
- a vector with u8 objects, It would be used to store the two byte gyroscopic data read through the sensors.
Fields
address: u8
accel_output: FixedSliceVec<'a, f32>
gyro_output: FixedSliceVec<'a, f32>
Implementations
Creates a mutable refernce to the struct to be used in the implementations.
Returns
a MPU6050 object
- To control the sensor through I2C data protocol.
Set the DLPF mode according to the instruction from user.
Set the DHPF mode according to the instruction from user.
Set the DPS scale for MPU6050 according to the instruction from user.
Set the clock source for MPU6050 according to user input.
Get the clock source for MPU6050 currently set.
Set the acceleration power of MPU6050 on appropriate delay given by the user.
Get the acceleration power of MPU6050 currently set.
Reads the three, two-byte accelerometer values from the sensor.
Returns the two-byte raw accelerometer values as a 32-bit float.
The vec accel_output stores the raw values of the accelerometer where accel_output[0]
is the x-axis, accel_output[1]
is the y-axis and accel_output[2]
is the z-axis output respectively. These raw values are then converted to g’s per second according to the scale given as input in begin()
function.
Reads the three, two-byte gyroscope values from the sensor.
Returns the two-byte raw gyroscope values as a 32-bit float.
The vec gyro_output stores the raw values of the gyroscope where gyro_output[0]
is the x-axis, gyro_output[1]
is the y-axis and gyro_output[2]
is the z-axis output respectively. These raw values are then converted to degrees per second according to the scale given as input in begin()
function.