NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
accgyro_spi_mpu6000.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <platform.h>
#include "common/axis.h"
#include "common/maths.h"
#include "system.h"
#include "gpio.h"
#include "exti.h"
#include "bus_spi.h"
#include "gyro_sync.h"
#include "sensor.h"
#include "accgyro.h"
#include "accgyro_mpu.h"
#include "accgyro_spi_mpu6000.h"
Include dependency graph for accgyro_spi_mpu6000.c:

Macros

#define BIT_SLEEP   0x40
 
#define BIT_H_RESET   0x80
 
#define BITS_CLKSEL   0x07
 
#define MPU_CLK_SEL_PLLGYROX   0x01
 
#define MPU_CLK_SEL_PLLGYROZ   0x03
 
#define MPU_EXT_SYNC_GYROX   0x02
 
#define BITS_FS_250DPS   0x00
 
#define BITS_FS_500DPS   0x08
 
#define BITS_FS_1000DPS   0x10
 
#define BITS_FS_2000DPS   0x18
 
#define BITS_FS_2G   0x00
 
#define BITS_FS_4G   0x08
 
#define BITS_FS_8G   0x10
 
#define BITS_FS_16G   0x18
 
#define BITS_FS_MASK   0x18
 
#define BITS_DLPF_CFG_256HZ   0x00
 
#define BITS_DLPF_CFG_188HZ   0x01
 
#define BITS_DLPF_CFG_98HZ   0x02
 
#define BITS_DLPF_CFG_42HZ   0x03
 
#define BITS_DLPF_CFG_20HZ   0x04
 
#define BITS_DLPF_CFG_10HZ   0x05
 
#define BITS_DLPF_CFG_5HZ   0x06
 
#define BITS_DLPF_CFG_2100HZ_NOLPF   0x07
 
#define BITS_DLPF_CFG_MASK   0x07
 
#define BIT_INT_ANYRD_2CLEAR   0x10
 
#define BIT_RAW_RDY_EN   0x01
 
#define BIT_I2C_IF_DIS   0x10
 
#define BIT_INT_STATUS_DATA   0x01
 
#define BIT_GYRO   3
 
#define BIT_ACC   2
 
#define BIT_TEMP   1
 
#define MPU6000ES_REV_C4   0x14
 
#define MPU6000ES_REV_C5   0x15
 
#define MPU6000ES_REV_D6   0x16
 
#define MPU6000ES_REV_D7   0x17
 
#define MPU6000ES_REV_D8   0x18
 
#define MPU6000_REV_C4   0x54
 
#define MPU6000_REV_C5   0x55
 
#define MPU6000_REV_D6   0x56
 
#define MPU6000_REV_D7   0x57
 
#define MPU6000_REV_D8   0x58
 
#define MPU6000_REV_D9   0x59
 
#define MPU6000_REV_D10   0x5A
 
#define DISABLE_MPU6000   GPIO_SetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN)
 
#define ENABLE_MPU6000   GPIO_ResetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN)
 

Functions

bool mpu6000WriteRegister (uint8_t reg, uint8_t data)
 
bool mpu6000ReadRegister (uint8_t reg, uint8_t length, uint8_t *data)
 
bool mpu6000SpiDetect (void)
 
bool mpu6000SpiAccDetect (acc_t *accel)
 
bool mpu6000SpiGyroDetect (gyro_t *gyr)
 

Variables

uint8_t mpuLowPassFilter
 

Macro Definition Documentation

#define BIT_ACC   2
#define BIT_GYRO   3
#define BIT_H_RESET   0x80
#define BIT_I2C_IF_DIS   0x10
#define BIT_INT_ANYRD_2CLEAR   0x10
#define BIT_INT_STATUS_DATA   0x01
#define BIT_RAW_RDY_EN   0x01
#define BIT_SLEEP   0x40
#define BIT_TEMP   1
#define BITS_CLKSEL   0x07
#define BITS_DLPF_CFG_10HZ   0x05
#define BITS_DLPF_CFG_188HZ   0x01
#define BITS_DLPF_CFG_20HZ   0x04
#define BITS_DLPF_CFG_2100HZ_NOLPF   0x07
#define BITS_DLPF_CFG_256HZ   0x00
#define BITS_DLPF_CFG_42HZ   0x03
#define BITS_DLPF_CFG_5HZ   0x06
#define BITS_DLPF_CFG_98HZ   0x02
#define BITS_DLPF_CFG_MASK   0x07
#define BITS_FS_1000DPS   0x10
#define BITS_FS_16G   0x18
#define BITS_FS_2000DPS   0x18
#define BITS_FS_250DPS   0x00
#define BITS_FS_2G   0x00
#define BITS_FS_4G   0x08
#define BITS_FS_500DPS   0x08
#define BITS_FS_8G   0x10
#define BITS_FS_MASK   0x18
#define DISABLE_MPU6000   GPIO_SetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN)
#define ENABLE_MPU6000   GPIO_ResetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN)
#define MPU6000_REV_C4   0x54
#define MPU6000_REV_C5   0x55
#define MPU6000_REV_D10   0x5A
#define MPU6000_REV_D6   0x56
#define MPU6000_REV_D7   0x57
#define MPU6000_REV_D8   0x58
#define MPU6000_REV_D9   0x59
#define MPU6000ES_REV_C4   0x14
#define MPU6000ES_REV_C5   0x15
#define MPU6000ES_REV_D6   0x16
#define MPU6000ES_REV_D7   0x17
#define MPU6000ES_REV_D8   0x18
#define MPU_CLK_SEL_PLLGYROX   0x01
#define MPU_CLK_SEL_PLLGYROZ   0x03
#define MPU_EXT_SYNC_GYROX   0x02

Function Documentation

bool mpu6000ReadRegister ( uint8_t  reg,
uint8_t  length,
uint8_t *  data 
)

Here is the call graph for this function:

bool mpu6000SpiAccDetect ( acc_t accel)

Here is the call graph for this function:

bool mpu6000SpiDetect ( void  )

Here is the call graph for this function:

bool mpu6000SpiGyroDetect ( gyro_t gyr)

Here is the call graph for this function:

bool mpu6000WriteRegister ( uint8_t  reg,
uint8_t  data 
)

Here is the call graph for this function:

Variable Documentation

uint8_t mpuLowPassFilter