Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Keil project example for 2 MPU6050 6-axes sensors
- *
- * Before you start, select your target, on the right of the "Load" button
- *
- * @author Tilen Majerle
- * @email tilen@majerle.eu
- * @website http://stm32f4-discovery.com
- * @ide Keil uVision 5
- * @packs STM32F4xx Keil packs version 2.2.0 or greater required
- * @stdperiph STM32F4xx Standard peripheral drivers version 1.4.0 or greater required
- */
- /* Include core modules */
- #include "stm32f4xx.h"
- #include "tm_stm32f4_mpu6050.h"
- #include "stm32f4xx_rcc.h"
- #include "stm32f4xx_gpio.h"
- int main(void) {
- GPIO_InitTypeDef GPIO_InitDef;
- RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
- GPIO_InitDef.GPIO_Pin = GPIO_Pin_13;
- GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT;
- GPIO_InitDef.GPIO_OType = GPIO_OType_PP;
- GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL;
- GPIO_InitDef.GPIO_Speed = GPIO_Speed_100MHz;
- //Initialize pins
- GPIO_Init(GPIOD, &GPIO_InitDef);
- //General configs
- SystemInit();
- //MPU6050 configs and start
- TM_MPU6050_t MPU6050_Data0;
- TM_MPU6050_Init(&MPU6050_Data0, TM_MPU6050_Device_0, TM_MPU6050_Accelerometer_2G, TM_MPU6050_Gyroscope_250s);
- while (1){
- GPIO_ToggleBits(GPIOD, GPIO_Pin_13);
- TM_MPU6050_ReadAll(&MPU6050_Data0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement