\hypertarget{mpu6050_8cpp_source}{}\doxysection{mpu6050.\+cpp}
\label{mpu6050_8cpp_source}\index{D:/gitt/MicrochipFor32/bsp\_MPU6050/mpu6050.cpp@{D:/gitt/MicrochipFor32/bsp\_MPU6050/mpu6050.cpp}}
\mbox{\hyperlink{mpu6050_8cpp}{浏览该文件的文档.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00001}00001 }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00012}00012 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00013}00013 \textcolor{comment}{//  头文件}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00014}00014 \textcolor{preprocessor}{\#include "{}bscpp\_IIC\_STM32.h"{}}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00015}00015 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{mpu6050_8h}{mpu6050.h}}"{}}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00016}\mbox{\hyperlink{mpu6050_8cpp_ae7d7fd8356f1a04698bf36a2ff087f7b}{00016}} \textcolor{preprocessor}{\#define delay\_ms(var) HAL\_Delay(var)}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00017}\mbox{\hyperlink{mpu6050_8cpp_a0e5583807e7dcaae30835311a2195583}{00017}} bscpp\_IIC\_STM32 \mbox{\hyperlink{mpu6050_8cpp_a0e5583807e7dcaae30835311a2195583}{mpu6050IIC}}(IIC\_SCK\_GPIO\_Port,IIC\_SCK\_Pin,IIC\_SDA\_GPIO\_Port,IIC\_SDA\_Pin);}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00019}00019 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00020}00020 \textcolor{comment}{//  函数区}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00025}\mbox{\hyperlink{mpu6050_8cpp_ab1f8c6111d59b60a2edb4ee3e8aa3113}{00025}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{mpu6050_8cpp_ab1f8c6111d59b60a2edb4ee3e8aa3113}{MPU\_Init}}(\textcolor{keywordtype}{void})\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00026}00026     \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} res;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00027}00027     \textcolor{comment}{//MPU\_IIC\_Init();//初始化IIC总线}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00028}00028     \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_abbe7ea135ee03eb0f1296ecb22be7554}{MPU\_PWR\_MGMT1\_REG}},0X80);  \textcolor{comment}{//复位MPU6050}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00029}00029     \mbox{\hyperlink{mpu6050_8cpp_ae7d7fd8356f1a04698bf36a2ff087f7b}{delay\_ms}}(100);}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00030}00030     \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_abbe7ea135ee03eb0f1296ecb22be7554}{MPU\_PWR\_MGMT1\_REG}},0X00);  \textcolor{comment}{//唤醒MPU6050 }}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00031}00031     \mbox{\hyperlink{mpu6050_8cpp_aa27cc30326ce4980b289a0e1c3f76b5e}{MPU\_Set\_Gyro\_Fsr}}(3);                    \textcolor{comment}{//陀螺仪传感器,±2000dps}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00032}00032     \mbox{\hyperlink{mpu6050_8cpp_a6c391137bc5880c3b5e15e84c5a3380f}{MPU\_Set\_Accel\_Fsr}}(0);                  \textcolor{comment}{//加速度传感器,±2g}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00033}00033     \mbox{\hyperlink{mpu6050_8cpp_a04e58232ce838e94d54aa2b53287cb41}{MPU\_Set\_Rate}}(50);                       \textcolor{comment}{//设置采样率50Hz}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00034}00034     \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_afa56d3602a6044562c45cecf6403fb8b}{MPU\_INT\_EN\_REG}},0X00);    \textcolor{comment}{//关闭所有中断}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00035}00035     \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_a0146ef35d7ff0b037eafb0a5dac53b0f}{MPU\_USER\_CTRL\_REG}},0X00);  \textcolor{comment}{//I2C主模式关闭}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00036}00036     \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_a6ac27367cd834a85810e99df72b97621}{MPU\_FIFO\_EN\_REG}},0X00);  \textcolor{comment}{//关闭FIFO}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00037}00037     \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_a41676476ba5dbb1b213f8f8e252d17f9}{MPU\_INTBP\_CFG\_REG}},0X80);  \textcolor{comment}{//INT引脚低电平有效}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00038}00038     res=\mbox{\hyperlink{mpu6050_8cpp_a17c11d19a2bb21d61610f08cb2cbe2f7}{MPU\_Read\_Byte}}(\mbox{\hyperlink{mpu6050_8h_a9668e5ccfcfb0aa64da044a381a56f9c}{MPU\_DEVICE\_ID\_REG}});}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00039}00039     \textcolor{keywordflow}{if}(res==\mbox{\hyperlink{mpu6050_8h_ac3281ee64415e63422da7d65db161891}{MPU\_ADDR}})\textcolor{comment}{//器件ID正确}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00040}00040     \{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00041}00041         \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_abbe7ea135ee03eb0f1296ecb22be7554}{MPU\_PWR\_MGMT1\_REG}},0X01);  \textcolor{comment}{//设置CLKSEL,PLL X轴为参考}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00042}00042         \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_a3fa9eb0485744e73d0274b198f0ad705}{MPU\_PWR\_MGMT2\_REG}},0X00);  \textcolor{comment}{//加速度与陀螺仪都工作}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00043}00043         \mbox{\hyperlink{mpu6050_8cpp_a04e58232ce838e94d54aa2b53287cb41}{MPU\_Set\_Rate}}(50);                       \textcolor{comment}{//设置采样率为50Hz}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00044}00044     \}\textcolor{keywordflow}{else} \textcolor{keywordflow}{return} 1;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00045}00045     \textcolor{keywordflow}{return} 0;\}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00046}00046 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00055}\mbox{\hyperlink{mpu6050_8cpp_aa27cc30326ce4980b289a0e1c3f76b5e}{00055}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{mpu6050_8cpp_aa27cc30326ce4980b289a0e1c3f76b5e}{MPU\_Set\_Gyro\_Fsr}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} fsr)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00056}00056     \textcolor{keywordflow}{return} \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_ac8ce2e66126327cf30cfba19c4c38db5}{MPU\_GYRO\_CFG\_REG}},fsr<<3);\textcolor{comment}{//设置陀螺仪满量程范围  }}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00057}00057     \}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00058}00058 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00067}\mbox{\hyperlink{mpu6050_8cpp_a6c391137bc5880c3b5e15e84c5a3380f}{00067}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{mpu6050_8cpp_a6c391137bc5880c3b5e15e84c5a3380f}{MPU\_Set\_Accel\_Fsr}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} fsr)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00068}00068     \textcolor{keywordflow}{return} \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_a7bc1a37b846a3869f13a29e00072bbc7}{MPU\_ACCEL\_CFG\_REG}},fsr<<3);\textcolor{comment}{//设置加速度传感器满量程范围  }}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00069}00069     \}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00070}00070 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00076}\mbox{\hyperlink{mpu6050_8cpp_a2fb9973c9f5ea5327649d0eef5e96217}{00076}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{mpu6050_8cpp_a2fb9973c9f5ea5327649d0eef5e96217}{MPU\_Set\_LPF}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} lpf)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00077}00077     \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} data=0;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00078}00078     \textcolor{keywordflow}{if}(lpf>=188)data=1;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00079}00079     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(lpf>=98)data=2;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00080}00080     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(lpf>=42)data=3;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00081}00081     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(lpf>=20)data=4;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00082}00082     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(lpf>=10)data=5;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00083}00083     \textcolor{keywordflow}{else} data=6; }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00084}00084     \textcolor{keywordflow}{return} \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_a5034e2fc680fc68faa369a48f6955837}{MPU\_CFG\_REG}},data);\textcolor{comment}{//设置数字低通滤波器  }}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00085}00085     \}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00086}00086 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00092}\mbox{\hyperlink{mpu6050_8cpp_a04e58232ce838e94d54aa2b53287cb41}{00092}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{mpu6050_8cpp_a04e58232ce838e94d54aa2b53287cb41}{MPU\_Set\_Rate}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} rate)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00093}00093     \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} data;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00094}00094     \textcolor{keywordflow}{if}(rate>1000)rate=1000;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00095}00095     \textcolor{keywordflow}{if}(rate<4)rate=4;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00096}00096     data=1000/rate-\/1;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00097}00097     data=\mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{mpu6050_8h_a4b95cfafadb4b30146a17fac36819ca3}{MPU\_SAMPLE\_RATE\_REG}},data); \textcolor{comment}{//设置数字低通滤波器}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00098}00098     \textcolor{keywordflow}{return} \mbox{\hyperlink{mpu6050_8cpp_a2fb9973c9f5ea5327649d0eef5e96217}{MPU\_Set\_LPF}}(rate/2);  \textcolor{comment}{//自动设置LPF为采样率的一半}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00099}00099     \}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00100}00100 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00105}\mbox{\hyperlink{mpu6050_8cpp_a41eaf87c26b1281d9d5fc6a06abcf2a8}{00105}} \textcolor{comment}{}\textcolor{keywordtype}{short} \mbox{\hyperlink{mpu6050_8cpp_a41eaf87c26b1281d9d5fc6a06abcf2a8}{MPU\_Get\_Temperature}}(\textcolor{keywordtype}{void})\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00106}00106     \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} buf[2]; }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00107}00107     \textcolor{keywordtype}{short} raw;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00108}00108     \textcolor{keywordtype}{float} temp;}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00109}00109     \mbox{\hyperlink{mpu6050_8cpp_a63161fa966899e4e7c5791e40ebf2b0a}{MPU\_Read\_Len}}(\mbox{\hyperlink{mpu6050_8h_ac3281ee64415e63422da7d65db161891}{MPU\_ADDR}},\mbox{\hyperlink{mpu6050_8h_af2665b26b7f1ce9b3982a9f6418748e9}{MPU\_TEMP\_OUTH\_REG}},2,buf); }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00110}00110     raw=((\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}})buf[0]<<8)|buf[1];  }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00111}00111     temp=36.53+((double)raw)/340;  }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00112}00112     \textcolor{keywordflow}{return} temp*100;\}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00113}00113 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00121}\mbox{\hyperlink{mpu6050_8cpp_a8f28105f9dcccc709b78d7d0ce497633}{00121}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{mpu6050_8cpp_a8f28105f9dcccc709b78d7d0ce497633}{MPU\_Get\_Gyroscope}}(\textcolor{keywordtype}{short} *gx,\textcolor{keywordtype}{short} *gy,\textcolor{keywordtype}{short} *gz)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00122}00122     \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} buf[6],res;  }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00123}00123     res=\mbox{\hyperlink{mpu6050_8cpp_a63161fa966899e4e7c5791e40ebf2b0a}{MPU\_Read\_Len}}(\mbox{\hyperlink{mpu6050_8h_ac3281ee64415e63422da7d65db161891}{MPU\_ADDR}},\mbox{\hyperlink{mpu6050_8h_a7e16f1a459d902b070ca67df67be862b}{MPU\_GYRO\_XOUTH\_REG}},6,buf);}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00124}00124     \textcolor{keywordflow}{if}(res==0)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00125}00125         *gx=((\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}})buf[0]<<8)|buf[1];  }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00126}00126         *gy=((\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}})buf[2]<<8)|buf[3];  }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00127}00127         *gz=((\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}})buf[4]<<8)|buf[5];\}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00128}00128     \textcolor{keywordflow}{return} res;\}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00129}00129 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00137}\mbox{\hyperlink{mpu6050_8cpp_a2a0a02f6d7c597828a0cc282c76e99e3}{00137}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{mpu6050_8cpp_a2a0a02f6d7c597828a0cc282c76e99e3}{MPU\_Get\_Accelerometer}}(\textcolor{keywordtype}{short} *ax,\textcolor{keywordtype}{short} *ay,\textcolor{keywordtype}{short} *az)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00138}00138     \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} buf[6],res;  }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00139}00139     res=\mbox{\hyperlink{mpu6050_8cpp_a63161fa966899e4e7c5791e40ebf2b0a}{MPU\_Read\_Len}}(\mbox{\hyperlink{mpu6050_8h_ac3281ee64415e63422da7d65db161891}{MPU\_ADDR}},\mbox{\hyperlink{mpu6050_8h_a571a31cdf2a467b2b1df39fea686ea0d}{MPU\_ACCEL\_XOUTH\_REG}},6,buf);}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00140}00140     \textcolor{keywordflow}{if}(res==0)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00141}00141         *ax=((\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}})buf[0]<<8)|buf[1];  }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00142}00142         *ay=((\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}})buf[2]<<8)|buf[3];  }
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00143}00143         *az=((\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}})buf[4]<<8)|buf[5];\}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00144}00144     \textcolor{keywordflow}{return} res;\}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00146}00146 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00147}00147 \textcolor{comment}{//  适配区}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00156}\mbox{\hyperlink{mpu6050_8cpp_a59b1c26b234be88e97435a1b3c061330}{00156}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{mpu6050_8cpp_a59b1c26b234be88e97435a1b3c061330}{MPU\_Write\_Len}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} addr,\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} reg,\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} len,\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} *buf)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00157}00157     \mbox{\hyperlink{mpu6050_8cpp_a0e5583807e7dcaae30835311a2195583}{mpu6050IIC}}.IIC\_Write(addr,reg,(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)buf,len);}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00158}00158     \textcolor{keywordflow}{return} 0;\}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00159}00159 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00168}\mbox{\hyperlink{mpu6050_8cpp_a63161fa966899e4e7c5791e40ebf2b0a}{00168}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{mpu6050_8cpp_a63161fa966899e4e7c5791e40ebf2b0a}{MPU\_Read\_Len}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} addr,\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} reg,\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} len,\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} *buf)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00169}00169     \mbox{\hyperlink{mpu6050_8cpp_a0e5583807e7dcaae30835311a2195583}{mpu6050IIC}}.IIC\_Read(addr,reg,(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)buf,len);}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00170}00170     \textcolor{keywordflow}{return} 0;\}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00171}00171 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00178}\mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{00178}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{mpu6050_8cpp_a0be9b422bb8613f8444db4af5234e1a1}{MPU\_Write\_Byte}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} reg,\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} data)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00179}00179     \mbox{\hyperlink{mpu6050_8cpp_a0e5583807e7dcaae30835311a2195583}{mpu6050IIC}}.IIC\_WriteOneByte(\mbox{\hyperlink{mpu6050_8h_ac3281ee64415e63422da7d65db161891}{MPU\_ADDR}},reg,data);}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00180}00180     \textcolor{keywordflow}{return} 0;\}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00181}00181 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00187}\mbox{\hyperlink{mpu6050_8cpp_a17c11d19a2bb21d61610f08cb2cbe2f7}{00187}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{mpu6050_8cpp_a17c11d19a2bb21d61610f08cb2cbe2f7}{MPU\_Read\_Byte}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} reg)\{}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00188}00188     \textcolor{keywordflow}{return} \mbox{\hyperlink{mpu6050_8cpp_a0e5583807e7dcaae30835311a2195583}{mpu6050IIC}}.IIC\_ReadOneByte(\mbox{\hyperlink{mpu6050_8h_ac3281ee64415e63422da7d65db161891}{MPU\_ADDR}},reg);\}}
\DoxyCodeLine{\Hypertarget{mpu6050_8cpp_source_l00190}00190 }

\end{DoxyCode}
