2022-01-18 00:58:54 +08:00

82 lines
2.6 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*********************************************************************************************************************
* COPYRIGHT NOTICE
* Copyright (c) 2020,<2C><><EFBFBD>ɿƼ<C9BF>
* All rights reserved.
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QQȺ<51><C8BA><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA>824575535
*
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC><EFBFBD><EFBFBD>У<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>;<EFBFBD><CDBE>
* <20><>ӭ<EFBFBD><D3AD>λʹ<CEBB>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC>İ<EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @file MPU6050
* @company <09>ɶ<EFBFBD><C9B6><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC><EFBFBD><EFBFBD>޹<EFBFBD>˾
* @author <09><><EFBFBD>ɿƼ<C9BF>(QQ3184284598)
* @version <09>鿴doc<6F><63>version<6F>ļ<EFBFBD> <20>汾˵<E6B1BE><CBB5>
* @Software ADS v1.2.2
* @Target core TC264D
* @Taobao https://seekfree.taobao.com/
* @date 2020-3-23
* @note
<09><><EFBFBD>߶<EFBFBD><DFB6>
------------------------------------
<09><><EFBFBD><EFBFBD>IIC
SCL <20>鿴SEEKFREE_IIC<49>ļ<EFBFBD><C4BC>ڵ<EFBFBD>SEEKFREE_SCL<43><EFBFBD><EAB6A8>
SDA <20>鿴SEEKFREE_IIC<49>ļ<EFBFBD><C4BC>ڵ<EFBFBD>SEEKFREE_SDA<44><EFBFBD><EAB6A8>
Ӳ<><D3B2>IIC
SCL <20>鿴init_mpu6050_hardware<72><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IIC<49><43>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SDA <20>鿴init_mpu6050_hardware<72><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IIC<49><43>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
------------------------------------
********************************************************************************************************************/
#ifndef _SEEKFREE_MPU6050_h
#define _SEEKFREE_MPU6050_h
#include "common.h"
// <20><><EFBFBD><EFBFBD>MPU6050<35>ڲ<EFBFBD><DAB2><EFBFBD>ַ
#define MPU6050_DEV_ADDR 0xD0>>1 //IICд<43><D0B4>ʱ<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ݣ<EFBFBD>+1Ϊ<31><CEAA>ȡ
#define SMPLRT_DIV 0x19 //<2F><><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>0x07(125Hz)
#define MPU6050_CONFIG 0x1A //<2F><>ͨ<EFBFBD>˲<EFBFBD>Ƶ<EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>0x06(5Hz)
#define GYRO_CONFIG 0x1B //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ켰<D4BC><ECBCB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>0x18(<28><><EFBFBD>Լ죬2000deg/s)
#define ACCEL_CONFIG 0x1C //<2F><><EFBFBD>ټ<EFBFBD><D9BC>Լ졢<D4BC><ECA1A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD>ͨ<EFBFBD>˲<EFBFBD>Ƶ<EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>0x01(<28><><EFBFBD>Լ죬2G<32><47>5Hz)
#define INT_PIN_CFG 0x37 //<2F><><EFBFBD><EFBFBD>6050<35><30><EFBFBD><EFBFBD>I2CΪֱͨģʽ<C4A3>Ĵ<EFBFBD><C4B4><EFBFBD>
#define ACCEL_XOUT_H 0x3B
#define ACCEL_XOUT_L 0x3C
#define ACCEL_YOUT_H 0x3D
#define ACCEL_YOUT_L 0x3E
#define ACCEL_ZOUT_H 0x3F
#define ACCEL_ZOUT_L 0x40
#define GYRO_XOUT_H 0x43
#define GYRO_XOUT_L 0x44
#define GYRO_YOUT_H 0x45
#define GYRO_YOUT_L 0x46
#define GYRO_ZOUT_H 0x47
#define GYRO_ZOUT_L 0x48
#define User_Control 0x6A //<2F>ر<EFBFBD>6050<35>Ը<EFBFBD><D4B8><EFBFBD>I2C<32><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>
#define PWR_MGMT_1 0x6B //<2F><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>0x00(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
#define WHO_AM_I 0x75 //IIC<49><43>ַ<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><><C4AC><EFBFBD><EFBFBD>ֵ0x68<36><38>ֻ<EFBFBD><D6BB>)
extern int16 mpu_gyro_x,mpu_gyro_y,mpu_gyro_z;
extern int16 mpu_acc_x,mpu_acc_y,mpu_acc_z;
void mpu6050_init(void); //<2F><>ʼ<EFBFBD><CABC>MPU6050
void get_accdata(void);
void get_gyro(void);
void mpu6050_init_hardware(void);
void get_accdata_hardware(void);
void get_gyro_hardware(void);
#endif