Files
MicrochipFor32/Doc/docbook/mpu6050_8h_source.xml

106 lines
28 KiB
XML
Raw Normal View History

<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="_mpu6050_8h_source" xml:lang="zh">
<title>mpu6050.h</title>
<indexterm><primary>D:/gitt/MicrochipFor32/bsp_MPU6050/mpu6050.h</primary></indexterm>
浏览该文件的文档.<programlisting linenumbering="unnumbered"><anchor xml:id="_mpu6050_8h_source_1l00001"/>00001
<anchor xml:id="_mpu6050_8h_source_1l00011"/>00011 <emphasis role="preprocessor">#pragma&#32;once</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00012"/>00012 <emphasis role="preprocessor">#ifdef&#32;__cplusplus</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00013"/>00013 <emphasis role="keyword">extern</emphasis>&#32;<emphasis role="stringliteral">&quot;C&quot;</emphasis>{
<anchor xml:id="_mpu6050_8h_source_1l00014"/>00014 <emphasis role="preprocessor">#endif</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00015"/>00015 <emphasis role="preprocessor">#include&#32;&quot;main.h&quot;</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00016"/>00016 <emphasis role="preprocessor">#include&#32;&quot;<link linkend="_varint_8h">varint.h</link>&quot;</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00017"/>00017
<anchor xml:id="_mpu6050_8h_source_1l00018"/>00018 <emphasis role="comment">//#define&#32;MPU_ACCEL_OFFS_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X06&#32;&#32;&#32;&#32;//accel_offs寄存器,可读取版本号,寄存器手册未提到</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00019"/>00019 <emphasis role="comment">//#define&#32;MPU_PROD_ID_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X0C&#32;&#32;&#32;&#32;//prod&#32;id寄存器,在寄存器手册未提到</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00020"/><link linkend="_mpu6050_8h_1af02b592f85ebbfcc6f5e13d8287832de">00020</link> <emphasis role="preprocessor">#define&#32;MPU_SELF_TESTX_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X0D&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//自检寄存器X</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00021"/><link linkend="_mpu6050_8h_1a029c571acc0e3a941d14d4af3e3ecd5f">00021</link> <emphasis role="preprocessor">#define&#32;MPU_SELF_TESTY_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X0E&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//自检寄存器Y</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00022"/><link linkend="_mpu6050_8h_1aa7f091c311c419133b4799a37919ce24">00022</link> <emphasis role="preprocessor">#define&#32;MPU_SELF_TESTZ_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X0F&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//自检寄存器Z</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00023"/><link linkend="_mpu6050_8h_1a9f2d6b09b992598daadf6a0afa9a8b9c">00023</link> <emphasis role="preprocessor">#define&#32;MPU_SELF_TESTA_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X10&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//自检寄存器A</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00024"/><link linkend="_mpu6050_8h_1a4b95cfafadb4b30146a17fac36819ca3">00024</link> <emphasis role="preprocessor">#define&#32;MPU_SAMPLE_RATE_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X19&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//采样频率分频器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00025"/><link linkend="_mpu6050_8h_1a5034e2fc680fc68faa369a48f6955837">00025</link> <emphasis role="preprocessor">#define&#32;MPU_CFG_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X1A&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//配置寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00026"/><link linkend="_mpu6050_8h_1ac8ce2e66126327cf30cfba19c4c38db5">00026</link> <emphasis role="preprocessor">#define&#32;MPU_GYRO_CFG_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X1B&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//陀螺仪配置寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00027"/><link linkend="_mpu6050_8h_1a7bc1a37b846a3869f13a29e00072bbc7">00027</link> <emphasis role="preprocessor">#define&#32;MPU_ACCEL_CFG_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X1C&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//加速度计配置寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00028"/><link linkend="_mpu6050_8h_1ad214879acffccefd843d291949a2abb6">00028</link> <emphasis role="preprocessor">#define&#32;MPU_MOTION_DET_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X1F&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//运动检测阀值设置寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00029"/><link linkend="_mpu6050_8h_1a6ac27367cd834a85810e99df72b97621">00029</link> <emphasis role="preprocessor">#define&#32;MPU_FIFO_EN_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X23&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//FIFO使能寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00030"/><link linkend="_mpu6050_8h_1a077d9362ddf1c52a0fca0740164533ca">00030</link> <emphasis role="preprocessor">#define&#32;MPU_I2CMST_CTRL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X24&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC主机控制寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00031"/><link linkend="_mpu6050_8h_1a0482943c31faa0c896d63ef5d66755e1">00031</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV0_ADDR_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X25&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机0器件地址寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00032"/><link linkend="_mpu6050_8h_1a53122cbda4565a4a060e5df3bb9a37a7">00032</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV0_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X26&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机0数据地址寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00033"/><link linkend="_mpu6050_8h_1a22b266f1daab1a09f9257cfeb96fbb68">00033</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV0_CTRL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X27&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机0控制寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00034"/><link linkend="_mpu6050_8h_1a9123fc86edcdc301cbb75f7ebe4b5875">00034</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV1_ADDR_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X28&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机1器件地址寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00035"/><link linkend="_mpu6050_8h_1a7a0758891de15a4b4bf0ef2c4e75efeb">00035</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV1_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X29&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机1数据地址寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00036"/><link linkend="_mpu6050_8h_1a237cf43cb562d63ea2f2d98eeac464bc">00036</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV1_CTRL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X2A&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机1控制寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00037"/><link linkend="_mpu6050_8h_1a5a7b90007c003c428c098d0073fa4f9c">00037</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV2_ADDR_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X2B&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机2器件地址寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00038"/><link linkend="_mpu6050_8h_1a1d01e992631966ee1af8795ec14710bc">00038</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV2_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X2C&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机2数据地址寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00039"/><link linkend="_mpu6050_8h_1a1c2971fc921e219f0060640349d4a58a">00039</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV2_CTRL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X2D&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机2控制寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00040"/><link linkend="_mpu6050_8h_1a0627354a9a7143a3967bbf1552952e11">00040</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV3_ADDR_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X2E&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机3器件地址寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00041"/><link linkend="_mpu6050_8h_1a82236d7861a3a175cff0058d5d5b4716">00041</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV3_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X2F&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机3数据地址寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00042"/><link linkend="_mpu6050_8h_1ac907afde99231069287fa0d78c305549">00042</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV3_CTRL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X30&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机3控制寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00043"/><link linkend="_mpu6050_8h_1a6fbb07805d44b04e97f4f7d30d7c65bf">00043</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV4_ADDR_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X31&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机4器件地址寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00044"/><link linkend="_mpu6050_8h_1a838f7301336bd077e84a3a4fbe6e16e7">00044</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV4_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X32&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机4数据地址寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00045"/><link linkend="_mpu6050_8h_1a5bf6ae395ef8815c28c23d5343116871">00045</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV4_DO_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X33&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机4写数据寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00046"/><link linkend="_mpu6050_8h_1a144d40f6321e971c85d9987ceaedf539">00046</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV4_CTRL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X34&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机4控制寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00047"/><link linkend="_mpu6050_8h_1ab62d9fd87688d16052273b6598d5572f">00047</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV4_DI_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X35&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机4读数据寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00048"/>00048
<anchor xml:id="_mpu6050_8h_source_1l00049"/><link linkend="_mpu6050_8h_1a818abd42a819632acfee736d8db636f5">00049</link> <emphasis role="preprocessor">#define&#32;MPU_I2CMST_STA_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X36&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC主机状态寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00050"/><link linkend="_mpu6050_8h_1a41676476ba5dbb1b213f8f8e252d17f9">00050</link> <emphasis role="preprocessor">#define&#32;MPU_INTBP_CFG_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X37&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//中断/旁路设置寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00051"/><link linkend="_mpu6050_8h_1afa56d3602a6044562c45cecf6403fb8b">00051</link> <emphasis role="preprocessor">#define&#32;MPU_INT_EN_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X38&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//中断使能寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00052"/><link linkend="_mpu6050_8h_1a186faa987a57c9d2a3ea6bfaba0bdd46">00052</link> <emphasis role="preprocessor">#define&#32;MPU_INT_STA_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X3A&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//中断状态寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00053"/>00053
<anchor xml:id="_mpu6050_8h_source_1l00054"/><link linkend="_mpu6050_8h_1a571a31cdf2a467b2b1df39fea686ea0d">00054</link> <emphasis role="preprocessor">#define&#32;MPU_ACCEL_XOUTH_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X3B&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//加速度值,X轴高8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00055"/><link linkend="_mpu6050_8h_1ad7193ffe844d2c844b0c419a50d40173">00055</link> <emphasis role="preprocessor">#define&#32;MPU_ACCEL_XOUTL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X3C&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//加速度值,X轴低8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00056"/><link linkend="_mpu6050_8h_1a42eb93ccf84e25005cd1eca7c43b7516">00056</link> <emphasis role="preprocessor">#define&#32;MPU_ACCEL_YOUTH_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X3D&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//加速度值,Y轴高8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00057"/><link linkend="_mpu6050_8h_1aa1b06e69bcbb83ced2e28a8891ee8558">00057</link> <emphasis role="preprocessor">#define&#32;MPU_ACCEL_YOUTL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X3E&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//加速度值,Y轴低8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00058"/><link linkend="_mpu6050_8h_1af3a12a4f04a41df24c977c491a4aad5f">00058</link> <emphasis role="preprocessor">#define&#32;MPU_ACCEL_ZOUTH_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X3F&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//加速度值,Z轴高8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00059"/><link linkend="_mpu6050_8h_1a82eb10a4b48c58f8bf7bc96a892533b6">00059</link> <emphasis role="preprocessor">#define&#32;MPU_ACCEL_ZOUTL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X40&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//加速度值,Z轴低8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00060"/>00060
<anchor xml:id="_mpu6050_8h_source_1l00061"/><link linkend="_mpu6050_8h_1af2665b26b7f1ce9b3982a9f6418748e9">00061</link> <emphasis role="preprocessor">#define&#32;MPU_TEMP_OUTH_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X41&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//温度值高八位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00062"/><link linkend="_mpu6050_8h_1a5f4a1c425564e1e56bfe51576ba3ea82">00062</link> <emphasis role="preprocessor">#define&#32;MPU_TEMP_OUTL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X42&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//温度值低8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00063"/>00063
<anchor xml:id="_mpu6050_8h_source_1l00064"/><link linkend="_mpu6050_8h_1a7e16f1a459d902b070ca67df67be862b">00064</link> <emphasis role="preprocessor">#define&#32;MPU_GYRO_XOUTH_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X43&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//陀螺仪值,X轴高8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00065"/><link linkend="_mpu6050_8h_1a0b2e09225774ed67f49666ec1bbea501">00065</link> <emphasis role="preprocessor">#define&#32;MPU_GYRO_XOUTL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X44&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//陀螺仪值,X轴低8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00066"/><link linkend="_mpu6050_8h_1af71ca06f446573faed7a73979237e51e">00066</link> <emphasis role="preprocessor">#define&#32;MPU_GYRO_YOUTH_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X45&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//陀螺仪值,Y轴高8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00067"/><link linkend="_mpu6050_8h_1a0007fe50b455737a3076e38f300bce14">00067</link> <emphasis role="preprocessor">#define&#32;MPU_GYRO_YOUTL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X46&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//陀螺仪值,Y轴低8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00068"/><link linkend="_mpu6050_8h_1ad5811a104c711b123b648b46bcc6f929">00068</link> <emphasis role="preprocessor">#define&#32;MPU_GYRO_ZOUTH_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X47&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//陀螺仪值,Z轴高8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00069"/><link linkend="_mpu6050_8h_1a289046a426f3c6ef18cb504c5e991652">00069</link> <emphasis role="preprocessor">#define&#32;MPU_GYRO_ZOUTL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X48&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//陀螺仪值,Z轴低8位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00070"/>00070
<anchor xml:id="_mpu6050_8h_source_1l00071"/><link linkend="_mpu6050_8h_1a93d37f52e6ac87e1ef103339b22770af">00071</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV0_DO_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X63&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机0数据寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00072"/><link linkend="_mpu6050_8h_1af03578391ec1c0c6b357207c83ce28bb">00072</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV1_DO_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X64&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机1数据寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00073"/><link linkend="_mpu6050_8h_1a14db443ae863599bc0f16fa3733d4056">00073</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV2_DO_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X65&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机2数据寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00074"/><link linkend="_mpu6050_8h_1a4343d92e344dd56343094d46798a5e0e">00074</link> <emphasis role="preprocessor">#define&#32;MPU_I2CSLV3_DO_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X66&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC从机3数据寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00075"/>00075
<anchor xml:id="_mpu6050_8h_source_1l00076"/><link linkend="_mpu6050_8h_1ad7209fcea0ea70f90f6cb43e862f8f5b">00076</link> <emphasis role="preprocessor">#define&#32;MPU_I2CMST_DELAY_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X67&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//IIC主机延时管理寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00077"/><link linkend="_mpu6050_8h_1a82c9cecb9ee30b37f8b054feca2bc1da">00077</link> <emphasis role="preprocessor">#define&#32;MPU_SIGPATH_RST_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X68&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//信号通道复位寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00078"/><link linkend="_mpu6050_8h_1a1e60421d39a0a24b0c513f309e1d6910">00078</link> <emphasis role="preprocessor">#define&#32;MPU_MDETECT_CTRL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X69&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//运动检测控制寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00079"/><link linkend="_mpu6050_8h_1a0146ef35d7ff0b037eafb0a5dac53b0f">00079</link> <emphasis role="preprocessor">#define&#32;MPU_USER_CTRL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X6A&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//用户控制寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00080"/><link linkend="_mpu6050_8h_1abbe7ea135ee03eb0f1296ecb22be7554">00080</link> <emphasis role="preprocessor">#define&#32;MPU_PWR_MGMT1_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X6B&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//电源管理寄存器1</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00081"/><link linkend="_mpu6050_8h_1a3fa9eb0485744e73d0274b198f0ad705">00081</link> <emphasis role="preprocessor">#define&#32;MPU_PWR_MGMT2_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X6C&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//电源管理寄存器2&#32;</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00082"/><link linkend="_mpu6050_8h_1a9c04be29f6f59066df910560a1eb9ddf">00082</link> <emphasis role="preprocessor">#define&#32;MPU_FIFO_CNTH_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X72&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//FIFO计数寄存器高八位</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00083"/><link linkend="_mpu6050_8h_1a66dc73eec1f79cfefe8ad3d4c2a81c0d">00083</link> <emphasis role="preprocessor">#define&#32;MPU_FIFO_CNTL_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X73&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//FIFO计数寄存器低八位</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00084"/><link linkend="_mpu6050_8h_1af3acc9068f9c3b6a54c3d65ca91dc52e">00084</link> <emphasis role="preprocessor">#define&#32;MPU_FIFO_RW_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X74&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//FIFO读写寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00085"/><link linkend="_mpu6050_8h_1a9668e5ccfcfb0aa64da044a381a56f9c">00085</link> <emphasis role="preprocessor">#define&#32;MPU_DEVICE_ID_REG&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X75&#32;&#32;&#32;&#32;</emphasis><emphasis role="comment">//器件ID寄存器</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00086"/>00086 &#32;
<anchor xml:id="_mpu6050_8h_source_1l00087"/>00087 <emphasis role="comment">//如果AD0脚(9脚)接地,IIC地址为0X68(不包含最低位).</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00088"/>00088 <emphasis role="comment">//如果接V3.3,则IIC地址为0X69(不包含最低位).</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00089"/><link linkend="_mpu6050_8h_1ac3281ee64415e63422da7d65db161891">00089</link> <emphasis role="preprocessor">#define&#32;MPU_ADDR&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;0X68</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00090"/>00090
<anchor xml:id="_mpu6050_8h_source_1l00091"/>00091 <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1ab1f8c6111d59b60a2edb4ee3e8aa3113">MPU_Init</link>(<emphasis role="keywordtype">void</emphasis>);&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;<emphasis role="comment">//初始化MPU6050</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00092"/>00092 <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1a59b1c26b234be88e97435a1b3c061330">MPU_Write_Len</link>(<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;addr,<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;reg,<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;len,<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;*buf);<emphasis role="comment">//IIC连续写</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00093"/>00093 <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1a63161fa966899e4e7c5791e40ebf2b0a">MPU_Read_Len</link>(<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;addr,<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;reg,<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;len,<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;*buf);&#32;<emphasis role="comment">//IIC连续读&#32;</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00094"/>00094 <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1a0be9b422bb8613f8444db4af5234e1a1">MPU_Write_Byte</link>(<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;reg,<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;data);&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;<emphasis role="comment">//IIC写一个字节</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00095"/>00095 <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1a17c11d19a2bb21d61610f08cb2cbe2f7">MPU_Read_Byte</link>(<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;reg);&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;<emphasis role="comment">//IIC读一个字节</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00096"/>00096
<anchor xml:id="_mpu6050_8h_source_1l00097"/>00097 <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1aa27cc30326ce4980b289a0e1c3f76b5e">MPU_Set_Gyro_Fsr</link>(<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;fsr);
<anchor xml:id="_mpu6050_8h_source_1l00098"/>00098 <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1a6c391137bc5880c3b5e15e84c5a3380f">MPU_Set_Accel_Fsr</link>(<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;fsr);
<anchor xml:id="_mpu6050_8h_source_1l00099"/>00099 <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1a2fb9973c9f5ea5327649d0eef5e96217">MPU_Set_LPF</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link>&#32;lpf);
<anchor xml:id="_mpu6050_8h_source_1l00100"/>00100 <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1a04e58232ce838e94d54aa2b53287cb41">MPU_Set_Rate</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link>&#32;rate);
<anchor xml:id="_mpu6050_8h_source_1l00101"/><link linkend="_mpu6050_8h_1a91e0ee4610726fcf9f45570245269a0e">00101</link> <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1a91e0ee4610726fcf9f45570245269a0e">MPU_Set_Fifo</link>(<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;sens);
<anchor xml:id="_mpu6050_8h_source_1l00102"/>00102
<anchor xml:id="_mpu6050_8h_source_1l00103"/>00103 <emphasis role="keywordtype">short</emphasis>&#32;<link linkend="_mpu6050_8h_1a41eaf87c26b1281d9d5fc6a06abcf2a8">MPU_Get_Temperature</link>(<emphasis role="keywordtype">void</emphasis>);
<anchor xml:id="_mpu6050_8h_source_1l00104"/>00104 <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1a8f28105f9dcccc709b78d7d0ce497633">MPU_Get_Gyroscope</link>(<emphasis role="keywordtype">short</emphasis>&#32;*gx,<emphasis role="keywordtype">short</emphasis>&#32;*gy,<emphasis role="keywordtype">short</emphasis>&#32;*gz);
<anchor xml:id="_mpu6050_8h_source_1l00105"/>00105 <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>&#32;<link linkend="_mpu6050_8h_1a2a0a02f6d7c597828a0cc282c76e99e3">MPU_Get_Accelerometer</link>(<emphasis role="keywordtype">short</emphasis>&#32;*ax,<emphasis role="keywordtype">short</emphasis>&#32;*ay,<emphasis role="keywordtype">short</emphasis>&#32;*az);
<anchor xml:id="_mpu6050_8h_source_1l00106"/>00106
<anchor xml:id="_mpu6050_8h_source_1l00107"/>00107 <emphasis role="preprocessor">#ifdef&#32;__cplusplus</emphasis>
<anchor xml:id="_mpu6050_8h_source_1l00108"/>00108 }
<anchor xml:id="_mpu6050_8h_source_1l00109"/>00109 <emphasis role="preprocessor">#endif</emphasis>
</programlisting></section>