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
17extern "C" {
18#endif
19
20/* -------------------------------------------------------------------------- */
21/* ENUMERACIONES Y ESTRUCTURAS */
22/* -------------------------------------------------------------------------- */
23typedef 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
32typedef 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;
40
41typedef struct {
42 int16_t ax, ay, az;
43 int16_t gx, gy, gz;
45
46typedef struct {
47 float accel_sens;
48 float gyro_sens;
51
52/* -------------------------------------------------------------------------- */
53/* API PÚBLICA */
54/* -------------------------------------------------------------------------- */
55
56MPU6050_Status MPU6050_Init(MPU6050_Handler *device);
57MPU6050_Status MPU6050_Read(MPU6050_Handler*device);
58
59#ifdef __cplusplus
60}
61#endif
62
63#endif /* MPU6050_H */
Definiciones de registros y mascaras para el MPU6050.
Definition mpu6050.h:32
Definition mpu6050.h:41
Definition mpu6050.h:46
MPU6050_Data data
Definition mpu6050.h:49
float gyro_sens
Definition mpu6050.h:48
float accel_sens
Definition mpu6050.h:47