Proyecto Final – Medición de Inclinación
0.0.1
Este proyecto utiliza la placa NUCLEO-STM32F446RE y permite detectar y visualizar en tiempo real la inclinación mediante el sensor MPU-6050.
Cargando...
Buscando...
Nada coincide
mpu6050.h
Ir a la documentación de este archivo.
1
7
8
#ifndef MPU6050_H
9
#define MPU6050_H
10
11
#include <stdint.h>
12
#include <stdbool.h>
13
#include "stm32f4xx_hal.h"
14
#include "
mpu6050_registers.h
"
15
16
#ifdef __cplusplus
17
extern
"C"
{
18
#endif
19
20
/* -------------------------------------------------------------------------- */
21
/* ENUMERACIONES Y ESTRUCTURAS */
22
/* -------------------------------------------------------------------------- */
23
typedef
enum
{
24
MPU6050_OK = 0,
// OK
25
MPU6050_ERROR = -1,
// Error genérico de HAL
26
MPU6050_TIMEOUT = -2,
// Timeout de comunicación I2C
27
MPU6050_NOT_READY = -3,
// El MPU6050 no respondió al address
28
MPU6050_INVALID_PARAM = -4,
// Parámetros inválidos
29
MPU6050_BUSY = -5,
// HAL Busy
30
} MPU6050_Status;
31
32
typedef
struct
{
33
float
accel_x;
34
float
accel_y;
35
float
accel_z;
36
float
gyro_x;
37
float
gyro_y;
38
float
gyro_z;
39
}
MPU6050_Data
;
40
41
typedef
struct
{
42
int16_t ax, ay, az;
43
int16_t gx, gy, gz;
44
}
MPU6050_DataRaw
;
45
46
typedef
struct
{
47
float
accel_sens
;
48
float
gyro_sens
;
49
MPU6050_Data
data
;
50
}
MPU6050_Handler
;
51
52
/* -------------------------------------------------------------------------- */
53
/* API PÚBLICA */
54
/* -------------------------------------------------------------------------- */
55
56
MPU6050_Status MPU6050_Init(
MPU6050_Handler
*device);
57
MPU6050_Status MPU6050_Read(
MPU6050_Handler
*device);
58
59
#ifdef __cplusplus
60
}
61
#endif
62
63
#endif
/* MPU6050_H */
mpu6050_registers.h
Definiciones de registros y mascaras para el MPU6050.
MPU6050_Data
Definition
mpu6050.h:32
MPU6050_DataRaw
Definition
mpu6050.h:41
MPU6050_Handler
Definition
mpu6050.h:46
MPU6050_Handler::data
MPU6050_Data data
Definition
mpu6050.h:49
MPU6050_Handler::gyro_sens
float gyro_sens
Definition
mpu6050.h:48
MPU6050_Handler::accel_sens
float accel_sens
Definition
mpu6050.h:47
Devices
MPU6050
Inc
mpu6050.h
Generado por
1.14.0