Macros | Enumerations | Functions | Variables
drv_mpu6050.c File Reference
#include <breezystm32.h>
#include <math.h>
Include dependency graph for drv_mpu6050.c:

Go to the source code of this file.

Macros

#define GYRO_INT_PIN   (Pin_13)
 
#define M_PI   3.14159
 
#define MPU6050_BIT_DMP_RST   0x08
 
#define MPU6050_BIT_FIFO_EN   0x40
 
#define MPU6050_BIT_FIFO_RST   0x04
 
#define MPU6050_INV_CLK_GYROZ   0x03
 
#define MPU_ADDRESS   (0x68)
 
#define MPU_RA_ACCEL_CONFIG   0x1C
 
#define MPU_RA_ACCEL_XOUT_H   (0x3B)
 
#define MPU_RA_CONFIG   0x1A
 
#define MPU_RA_FIFO_COUNT_H   0x72
 
#define MPU_RA_FIFO_EN   0x23
 
#define MPU_RA_FIFO_R_W   0x74
 
#define MPU_RA_GYRO_CONFIG   0x1B
 
#define MPU_RA_GYRO_XOUT_H   (0x43)
 
#define MPU_RA_I2C_MST_CTRL   0x24
 
#define MPU_RA_INT_ENABLE   0x38
 
#define MPU_RA_INT_PIN_CFG   0x37
 
#define MPU_RA_PRODUCT_ID   (0x0C)
 
#define MPU_RA_PWR_MGMT_1   0x6B
 
#define MPU_RA_PWR_MGMT_2   0x6C
 
#define MPU_RA_SIGNAL_PATH_RST   0x68
 
#define MPU_RA_SMPLRT_DIV   0x19
 
#define MPU_RA_TEMP_OUT_A   (0x41)
 
#define MPU_RA_USER_CTRL   0x6A
 
#define MPU_RA_WHO_AM_I   (0x75)
 
#define MPU_RA_XA_OFFS_H   (0x06)
 
#define MPUx0x0_WHO_AM_I_CONST   (0x68)
 

Enumerations

enum  accel_fsr_e {
  INV_FSR_2G = 0, INV_FSR_4G, INV_FSR_8G, INV_FSR_16G,
  NUM_ACCEL_FSR
}
 
enum  clock_sel_e { INV_CLK_INTERNAL = 0, INV_CLK_PLL, NUM_CLK }
 
enum  gyro_fsr_e {
  INV_FSR_250DPS = 0, INV_FSR_500DPS, INV_FSR_1000DPS, INV_FSR_2000DPS,
  NUM_GYRO_FSR
}
 
enum  lpf_e {
  INV_FILTER_256HZ_NOLPF2 = 0, INV_FILTER_188HZ, INV_FILTER_98HZ, INV_FILTER_42HZ,
  INV_FILTER_20HZ, INV_FILTER_10HZ, INV_FILTER_5HZ, INV_FILTER_2100HZ_NOLPF,
  NUM_FILTER
}
 

Functions

void EXTI15_10_IRQHandler (void)
 
void mpu6050_async_read_all (volatile int16_t *accData, volatile int16_t *tempData, volatile int16_t *gyroData, volatile uint64_t *timeData)
 
void mpu6050_exti_init (int boardVersion)
 
void mpu6050_init (bool enableInterrupt, uint16_t *acc1G, float *gyroScale, int boardVersion)
 
bool mpu6050_new_data ()
 
void mpu6050_read_accel (int16_t *accData)
 
void mpu6050_read_all (int16_t *accData, int16_t *gyroData, int16_t *tempData, uint64_t *time_us)
 
void mpu6050_read_gyro (int16_t *gyroData)
 
void mpu6050_read_temperature (int16_t *tempData)
 
void mpu6050_request_async_update_all ()
 
static bool mpuReadRegisterI2C (uint8_t reg, uint8_t *data, int length)
 
static bool mpuWriteRegisterI2C (uint8_t reg, uint8_t data)
 
void read_all_CB (uint8_t result)
 

Variables

static volatile int16_t accel [3]
 
uint8_t all_buffer [14]
 
static volatile int16_t gyro [3]
 
static uint64_t imu_time_us = 0
 
uint64_t measurement_time = 0
 
static uint8_t mpuLowPassFilter = INV_FILTER_20HZ
 
static volatile bool need_to_queue_new_i2c_job = false
 
static bool new_imu_data = false
 
static volatile int16_t temp
 

Macro Definition Documentation

#define GYRO_INT_PIN   (Pin_13)

Definition at line 42 of file drv_mpu6050.c.

#define M_PI   3.14159

Definition at line 28 of file drv_mpu6050.c.

#define MPU6050_BIT_DMP_RST   0x08

Definition at line 116 of file drv_mpu6050.c.

#define MPU6050_BIT_FIFO_EN   0x40

Definition at line 117 of file drv_mpu6050.c.

#define MPU6050_BIT_FIFO_RST   0x04

Definition at line 115 of file drv_mpu6050.c.

#define MPU6050_INV_CLK_GYROZ   0x03

Definition at line 114 of file drv_mpu6050.c.

#define MPU_ADDRESS   (0x68)

Definition at line 40 of file drv_mpu6050.c.

#define MPU_RA_ACCEL_CONFIG   0x1C

Definition at line 101 of file drv_mpu6050.c.

#define MPU_RA_ACCEL_XOUT_H   (0x3B)

Definition at line 46 of file drv_mpu6050.c.

#define MPU_RA_CONFIG   0x1A

Definition at line 99 of file drv_mpu6050.c.

#define MPU_RA_FIFO_COUNT_H   0x72

Definition at line 110 of file drv_mpu6050.c.

#define MPU_RA_FIFO_EN   0x23

Definition at line 102 of file drv_mpu6050.c.

#define MPU_RA_FIFO_R_W   0x74

Definition at line 111 of file drv_mpu6050.c.

#define MPU_RA_GYRO_CONFIG   0x1B

Definition at line 100 of file drv_mpu6050.c.

#define MPU_RA_GYRO_XOUT_H   (0x43)

Definition at line 45 of file drv_mpu6050.c.

#define MPU_RA_I2C_MST_CTRL   0x24

Definition at line 103 of file drv_mpu6050.c.

#define MPU_RA_INT_ENABLE   0x38

Definition at line 105 of file drv_mpu6050.c.

#define MPU_RA_INT_PIN_CFG   0x37

Definition at line 104 of file drv_mpu6050.c.

#define MPU_RA_PRODUCT_ID   (0x0C)

Definition at line 50 of file drv_mpu6050.c.

#define MPU_RA_PWR_MGMT_1   0x6B

Definition at line 108 of file drv_mpu6050.c.

#define MPU_RA_PWR_MGMT_2   0x6C

Definition at line 109 of file drv_mpu6050.c.

#define MPU_RA_SIGNAL_PATH_RST   0x68

Definition at line 106 of file drv_mpu6050.c.

#define MPU_RA_SMPLRT_DIV   0x19

Definition at line 98 of file drv_mpu6050.c.

#define MPU_RA_TEMP_OUT_A   (0x41)

Definition at line 47 of file drv_mpu6050.c.

#define MPU_RA_USER_CTRL   0x6A

Definition at line 107 of file drv_mpu6050.c.

#define MPU_RA_WHO_AM_I   (0x75)

Definition at line 44 of file drv_mpu6050.c.

#define MPU_RA_XA_OFFS_H   (0x06)

Definition at line 49 of file drv_mpu6050.c.

#define MPUx0x0_WHO_AM_I_CONST   (0x68)

Definition at line 53 of file drv_mpu6050.c.

Enumeration Type Documentation

Enumerator
INV_FSR_2G 
INV_FSR_4G 
INV_FSR_8G 
INV_FSR_16G 
NUM_ACCEL_FSR 

Definition at line 81 of file drv_mpu6050.c.

Enumerator
INV_CLK_INTERNAL 
INV_CLK_PLL 
NUM_CLK 

Definition at line 75 of file drv_mpu6050.c.

enum gyro_fsr_e
Enumerator
INV_FSR_250DPS 
INV_FSR_500DPS 
INV_FSR_1000DPS 
INV_FSR_2000DPS 
NUM_GYRO_FSR 

Definition at line 67 of file drv_mpu6050.c.

enum lpf_e
Enumerator
INV_FILTER_256HZ_NOLPF2 
INV_FILTER_188HZ 
INV_FILTER_98HZ 
INV_FILTER_42HZ 
INV_FILTER_20HZ 
INV_FILTER_10HZ 
INV_FILTER_5HZ 
INV_FILTER_2100HZ_NOLPF 
NUM_FILTER 

Definition at line 55 of file drv_mpu6050.c.

Function Documentation

void EXTI15_10_IRQHandler ( void  )

Definition at line 346 of file drv_mpu6050.c.

void mpu6050_async_read_all ( volatile int16_t *  accData,
volatile int16_t *  tempData,
volatile int16_t *  gyroData,
volatile uint64_t *  timeData 
)

Definition at line 316 of file drv_mpu6050.c.

void mpu6050_exti_init ( int  boardVersion)

Definition at line 129 of file drv_mpu6050.c.

void mpu6050_init ( bool  enableInterrupt,
uint16_t *  acc1G,
float *  gyroScale,
int  boardVersion 
)

Definition at line 175 of file drv_mpu6050.c.

bool mpu6050_new_data ( )

Definition at line 328 of file drv_mpu6050.c.

void mpu6050_read_accel ( int16_t *  accData)

Definition at line 236 of file drv_mpu6050.c.

void mpu6050_read_all ( int16_t *  accData,
int16_t *  gyroData,
int16_t *  tempData,
uint64_t *  time_us 
)

Definition at line 216 of file drv_mpu6050.c.

void mpu6050_read_gyro ( int16_t *  gyroData)

Definition at line 250 of file drv_mpu6050.c.

void mpu6050_read_temperature ( int16_t *  tempData)

Definition at line 261 of file drv_mpu6050.c.

void mpu6050_request_async_update_all ( )

Definition at line 300 of file drv_mpu6050.c.

static bool mpuReadRegisterI2C ( uint8_t  reg,
uint8_t *  data,
int  length 
)
static

Definition at line 119 of file drv_mpu6050.c.

static bool mpuWriteRegisterI2C ( uint8_t  reg,
uint8_t  data 
)
static

Definition at line 124 of file drv_mpu6050.c.

void read_all_CB ( uint8_t  result)

Definition at line 283 of file drv_mpu6050.c.

Variable Documentation

volatile int16_t accel[3]
static

Definition at line 276 of file drv_mpu6050.c.

uint8_t all_buffer[14]

Definition at line 280 of file drv_mpu6050.c.

volatile int16_t gyro[3]
static

Definition at line 277 of file drv_mpu6050.c.

uint64_t imu_time_us = 0
static

Definition at line 94 of file drv_mpu6050.c.

uint64_t measurement_time = 0

Definition at line 281 of file drv_mpu6050.c.

uint8_t mpuLowPassFilter = INV_FILTER_20HZ
static

Definition at line 91 of file drv_mpu6050.c.

volatile bool need_to_queue_new_i2c_job = false
static

Definition at line 279 of file drv_mpu6050.c.

bool new_imu_data = false
static

Definition at line 95 of file drv_mpu6050.c.

volatile int16_t temp
static

Definition at line 278 of file drv_mpu6050.c.



rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Oct 24 2019 03:17:20