mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
82 lines
2.6 KiB
C
82 lines
2.6 KiB
C
|
/*********************************************************************************************************************
|
|||
|
* COPYRIGHT NOTICE
|
|||
|
* Copyright (c) 2020,<EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD>
|
|||
|
* All rights reserved.
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QQȺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><EFBFBD>824575535
|
|||
|
*
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>;<EFBFBD><EFBFBD>
|
|||
|
* <EFBFBD><EFBFBD>ӭ<EFBFBD><EFBFBD>λʹ<EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>뱣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD>İ<EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
* @file MPU6050
|
|||
|
* @company <EFBFBD>ɶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾
|
|||
|
* @author <EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD>(QQ3184284598)
|
|||
|
* @version <EFBFBD>鿴doc<EFBFBD><EFBFBD>version<EFBFBD>ļ<EFBFBD> <EFBFBD>汾˵<EFBFBD><EFBFBD>
|
|||
|
* @Software ADS v1.2.2
|
|||
|
* @Target core TC264D
|
|||
|
* @Taobao https://seekfree.taobao.com/
|
|||
|
* @date 2020-3-23
|
|||
|
* @note
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><EFBFBD>壺
|
|||
|
------------------------------------
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IIC
|
|||
|
SCL <EFBFBD>鿴SEEKFREE_IIC<EFBFBD>ļ<EFBFBD><EFBFBD>ڵ<EFBFBD>SEEKFREE_SCL<EFBFBD>궨<EFBFBD><EFBFBD>
|
|||
|
SDA <EFBFBD>鿴SEEKFREE_IIC<EFBFBD>ļ<EFBFBD><EFBFBD>ڵ<EFBFBD>SEEKFREE_SDA<EFBFBD>궨<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
Ӳ<EFBFBD><EFBFBD>IIC
|
|||
|
SCL <EFBFBD>鿴init_mpu6050_hardware<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IIC<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
SDA <EFBFBD>鿴init_mpu6050_hardware<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IIC<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><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
|