TM STM32Fxxx HAL Libraries  v1.0.0
Libraries for STM32Fxxx (F0, F4 and F7 series) devices based on HAL drivers from ST from Tilen Majerle

MPU6050 library for STM32Fxxx - http://stm32f4-discovery.com/2015/10/hal-library-30-mpu6050-for-stm32fxxx. More...

Modules

 TM_MPU6050_Macros
 Library defines.
 
 TM_MPU6050_Typedefs
 Library Typedefs.
 
 TM_MPU6050_Functions
 Library Functions.
 

Detailed Description

MPU6050 library for STM32Fxxx - http://stm32f4-discovery.com/2015/10/hal-library-30-mpu6050-for-stm32fxxx.

Features

Library supports basic operation with MPU6050 device:

- Read accelerometer, gyroscope and temperature data,
- Set custom output data rate for measurements
- Enable/disable interrupts
- Up to 2 MPU devices at a time
MPU6050 interrupts

When you enable interrupts using TM_MPU6050_EnableInterrupts function, "DataReady" and "MotionDetected" interrupts are enabled.

MPU pin for interrupt detection on STM device is rising edge and triggers on any interrupt.

You can read interrupts status register to detect which interrupt happened using TM_MPU6050_ReadInterrupts function.

MPU6050 data rate

Device can output data at specific rate. It has 8-bit register with custom value to set data rate you need.

Equation for data rate is below:

\[ DataRate = \frac{8 MHz}{REGVAL + 1} \]

where:

Note
There are already some predefined constants in library for some "standard" data rates
Default pinout
MPU6050     STM32Fxxx     Descrption
 
SCL         PB6           Clock line for I2C
SDA         PB7           Data line for I2C
IRQ         -             User selectable pin if needed. Interrupts for STM must be manually enabled by user.
VCC         3.3V
GND         GND
AD0         -             If pin is low, I2C address is 0xD0, if pin is high, the address is 0xD2

To change default pinout for I2C, you need to open defines.h file and copy/edit some defines:

//Set I2C used
//Set I2C pins used
Changelog
 Version 1.0
  - First release
Dependencies
 - STM32Fxxx HAL
 - defines.h
 - TM I2C