Files
MicrochipFor32/Doc/xml/bsp___i_i_c_8cpp.xml
XerolySkinner 08f9f63eb3 内容大更新
更加规范化
加入modbus类
优化帮助文档
2022-11-22 03:43:24 +08:00

181 lines
34 KiB
XML

<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.5" xml:lang="zh">
<compounddef id="bsp___i_i_c_8cpp" kind="file" language="C++">
<compoundname>bsp_IIC.cpp</compoundname>
<includes refid="bsp___i_i_c_8h" local="yes">bsp_IIC.h</includes>
<incdepgraph>
<node id="1">
<label>D:/gitt/MicrochipFor32/bsp_Device/bsp_IIC.cpp</label>
<link refid="bsp___i_i_c_8cpp"/>
<childnode refid="2" relation="include">
</childnode>
</node>
<node id="2">
<label>bsp_IIC.h</label>
<link refid="bsp___i_i_c_8h"/>
<childnode refid="3" relation="include">
</childnode>
</node>
<node id="3">
<label>varint.h</label>
<link refid="varint_8h"/>
<childnode refid="4" relation="include">
</childnode>
</node>
<node id="4">
<label>stdint.h</label>
</node>
</incdepgraph>
<briefdescription>
<para>本类实现软件IIC功能 依此类派生出其他软件IIC功能 </para>
</briefdescription>
<detaileddescription>
</detaileddescription>
<programlisting>
<codeline lineno="1"><highlight class="comment">/*----------------------------------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="2"><highlight class="comment"><sp/>#</highlight></codeline>
<codeline lineno="3"><highlight class="comment"><sp/>#<sp/><sp/>Copyright<sp/>(c)<sp/>2022<sp/>Yuankang<sp/>Liang(XerolySkinner)</highlight></codeline>
<codeline lineno="4"><highlight class="comment"><sp/>#</highlight></codeline>
<codeline lineno="5"><highlight class="comment"><sp/>#<sp/><sp/>本软件按原样提供,无任何明示或暗示</highlight></codeline>
<codeline lineno="6"><highlight class="comment"><sp/>#<sp/><sp/>在任何情况下,作者都不承担任何损害赔偿责任</highlight></codeline>
<codeline lineno="7"><highlight class="comment"><sp/>#</highlight></codeline>
<codeline lineno="8"><highlight class="comment"><sp/>#<sp/><sp/>使用的许可声明:</highlight></codeline>
<codeline lineno="9"><highlight class="comment"><sp/>#<sp/><sp/>1.<sp/><sp/>不得歪曲本软件的来源,你不能声称你编写了原始软件.</highlight></codeline>
<codeline lineno="10"><highlight class="comment"><sp/>#<sp/><sp/>2.<sp/><sp/>免费授予以任何目的,前提是版权声明出现在所有副本中.</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>#<sp/><sp/><sp/><sp/><sp/><sp/>并且版权声明和许可声明同时出现.</highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>#<sp/><sp/>3.<sp/><sp/>你有使用,复制,修改,分发,和销售本软件的许可.</highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>#<sp/><sp/>4.<sp/><sp/>如果你在产品中使用,产品文档中的声明是赞赏的但不是必须的.</highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>#<sp/><sp/>5.<sp/><sp/>本通知不得从任何来源删除或更改.</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>#</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>#<sp/><sp/>Yuankang<sp/>Liang(XerolySkinner)</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>#<sp/><sp/><sp/><sp/><sp/><sp/>E-mail:zabbcccbbaz@163.com</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>#<sp/><sp/><sp/><sp/><sp/><sp/>QQ:2715099320</highlight></codeline>
<codeline lineno="19"><highlight class="comment"><sp/>#<sp/><sp/><sp/><sp/><sp/><sp/>Mobile<sp/>Phone:13005636215</highlight></codeline>
<codeline lineno="20"><highlight class="comment"><sp/>#</highlight></codeline>
<codeline lineno="21"><highlight class="comment"><sp/>#<sp/><sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="22"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"><sp/></highlight></codeline>
<codeline lineno="37"><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="38"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>头文件</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="39"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="bsp___i_i_c_8h" kindref="compound">bsp_IIC.h</ref>&quot;</highlight></codeline>
<codeline lineno="41"><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="42"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>底层程序</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/></highlight></codeline>
<codeline lineno="47" refid="classbsp___i_i_c_1a97ad38a37ad0140987ba79d878f0d9e9" refkind="member"><highlight class="comment"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___i_i_c_1a97ad38a37ad0140987ba79d878f0d9e9" kindref="member">bsp_IIC::IIC_Start</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1adf1ba1196ef163ab1958747744dd8a14" kindref="member">IIC_SDA</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a9e128b73c7beb33be6b4e953a7fddc66" kindref="member">IIC_SET</ref>);</highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1adf1ba1196ef163ab1958747744dd8a14" kindref="member">IIC_SDA</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a9e128b73c7beb33be6b4e953a7fddc66" kindref="member">IIC_SET</ref>);</highlight></codeline>
<codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a9e128b73c7beb33be6b4e953a7fddc66" kindref="member">IIC_SET</ref>);</highlight></codeline>
<codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();</highlight></codeline>
<codeline lineno="52"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1adf1ba1196ef163ab1958747744dd8a14" kindref="member">IIC_SDA</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a048bbf954430bbc34fa11280165ed534" kindref="member">IIC_RESET</ref>);</highlight></codeline>
<codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();</highlight></codeline>
<codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a048bbf954430bbc34fa11280165ed534" kindref="member">IIC_RESET</ref>);}</highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="59" refid="classbsp___i_i_c_1ae513e1a05cbbae2a6f37e6cbb3bb63e2" refkind="member"><highlight class="comment"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___i_i_c_1ae513e1a05cbbae2a6f37e6cbb3bb63e2" kindref="member">bsp_IIC::IIC_Stop</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1adf1ba1196ef163ab1958747744dd8a14" kindref="member">IIC_SDA</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a048bbf954430bbc34fa11280165ed534" kindref="member">IIC_RESET</ref>);</highlight></codeline>
<codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a9e128b73c7beb33be6b4e953a7fddc66" kindref="member">IIC_SET</ref>);</highlight></codeline>
<codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();</highlight></codeline>
<codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1adf1ba1196ef163ab1958747744dd8a14" kindref="member">IIC_SDA</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a9e128b73c7beb33be6b4e953a7fddc66" kindref="member">IIC_SET</ref>);</highlight></codeline>
<codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();}</highlight></codeline>
<codeline lineno="65"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="66"><highlight class="normal"></highlight><highlight class="comment">//发送应答或非应答信号</highlight></codeline>
<codeline lineno="71" refid="classbsp___i_i_c_1a684793afa5c26e6d123ff6ad083342c8" refkind="member"><highlight class="comment"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___i_i_c_1a684793afa5c26e6d123ff6ad083342c8" kindref="member">bsp_IIC::IIC_SendAck</ref>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>ackbit)<sp/>{</highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a048bbf954430bbc34fa11280165ed534" kindref="member">IIC_RESET</ref>);</highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1adf1ba1196ef163ab1958747744dd8a14" kindref="member">IIC_SDA</ref>(ackbit);</highlight></codeline>
<codeline lineno="74"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();</highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a9e128b73c7beb33be6b4e953a7fddc66" kindref="member">IIC_SET</ref>);</highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();</highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a048bbf954430bbc34fa11280165ed534" kindref="member">IIC_RESET</ref>);</highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1adf1ba1196ef163ab1958747744dd8a14" kindref="member">IIC_SDA</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a9e128b73c7beb33be6b4e953a7fddc66" kindref="member">IIC_SET</ref>);</highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();}</highlight></codeline>
<codeline lineno="80"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="85" refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" refkind="member"><highlight class="comment"></highlight><highlight class="normal"><ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">bsp_IIC::IIC_WaitAck</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>ackbit;</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a9e128b73c7beb33be6b4e953a7fddc66" kindref="member">IIC_SET</ref>);</highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();</highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/>ackbit<sp/>=<sp/><ref refid="classbsp___i_i_c_1adf1ba1196ef163ab1958747744dd8a14" kindref="member">IIC_SDA</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7ae4ead84d2c3bbc3f2403d9a5157a3f94" kindref="member">IIC_READ</ref>);</highlight></codeline>
<codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a048bbf954430bbc34fa11280165ed534" kindref="member">IIC_RESET</ref>);</highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ackbit;}</highlight></codeline>
<codeline lineno="93"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="98" refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" refkind="member"><highlight class="comment"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">bsp_IIC::IIC_SendByte</ref>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>byt)<sp/>{</highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>i;</highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>8;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a048bbf954430bbc34fa11280165ed534" kindref="member">IIC_RESET</ref>);</highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();</highlight></codeline>
<codeline lineno="103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1adf1ba1196ef163ab1958747744dd8a14" kindref="member">IIC_SDA</ref>((byt<sp/>&amp;<sp/>0x80)<sp/>!=<sp/>0);</highlight></codeline>
<codeline lineno="104"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();</highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a9e128b73c7beb33be6b4e953a7fddc66" kindref="member">IIC_SET</ref>);</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>byt<sp/>&lt;&lt;=<sp/>1;</highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();}</highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a048bbf954430bbc34fa11280165ed534" kindref="member">IIC_RESET</ref>);}</highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="114" refid="classbsp___i_i_c_1a15201c6a6bd1affde8da0fc642f62272" refkind="member"><highlight class="comment"></highlight><highlight class="normal"><ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/><ref refid="classbsp___i_i_c_1a15201c6a6bd1affde8da0fc642f62272" kindref="member">bsp_IIC::IIC_RecByte</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>i=0,<sp/>da=0;</highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>8;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a9e128b73c7beb33be6b4e953a7fddc66" kindref="member">IIC_SET</ref>);</highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();</highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>da<sp/>&lt;&lt;=<sp/>1;</highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="classbsp___i_i_c_1adf1ba1196ef163ab1958747744dd8a14" kindref="member">IIC_SDA</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7ae4ead84d2c3bbc3f2403d9a5157a3f94" kindref="member">IIC_READ</ref>))da<sp/>|=<sp/>1;</highlight></codeline>
<codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9c71db14d666983ab15621f119bdc171" kindref="member">IIC_SCK</ref>(<ref refid="bsp___i_i_c_8h_1adf764cbdea00d65edcd07bb9953ad2b7a048bbf954430bbc34fa11280165ed534" kindref="member">IIC_RESET</ref>);</highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ad3d17035a8d19842ccabbf743a4405f4" kindref="member">IIC_Delay</ref>();}</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>da;}</highlight></codeline>
<codeline lineno="125"><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="126"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>封装程序</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="127"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/></highlight></codeline>
<codeline lineno="136" refid="classbsp___i_i_c_1a9f4cdf777e69f407b155ffdba5b9e7c8" refkind="member"><highlight class="comment"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___i_i_c_1a9f4cdf777e69f407b155ffdba5b9e7c8" kindref="member">bsp_IIC::IIC_WriteOneByte</ref>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/></highlight><highlight class="keywordtype">id</highlight><highlight class="normal">,<sp/><ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>addr,<sp/><ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>dat)<sp/>{</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a97ad38a37ad0140987ba79d878f0d9e9" kindref="member">IIC_Start</ref>();</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(</highlight><highlight class="keywordtype">id</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>1);</highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();</highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(addr);</highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();</highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(dat);</highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();</highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae513e1a05cbbae2a6f37e6cbb3bb63e2" kindref="member">IIC_Stop</ref>();}</highlight></codeline>
<codeline lineno="145"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="153" refid="classbsp___i_i_c_1a9effd40b26cbf6f321d0f0db3e2f09c3" refkind="member"><highlight class="comment"></highlight><highlight class="normal"><ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/><ref refid="classbsp___i_i_c_1a9effd40b26cbf6f321d0f0db3e2f09c3" kindref="member">bsp_IIC::IIC_ReadOneByte</ref>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/></highlight><highlight class="keywordtype">id</highlight><highlight class="normal">,<sp/><ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>addr)<sp/>{</highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>temp<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="155"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a97ad38a37ad0140987ba79d878f0d9e9" kindref="member">IIC_Start</ref>();</highlight></codeline>
<codeline lineno="156"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(</highlight><highlight class="keywordtype">id</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>1);</highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(addr);</highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a684793afa5c26e6d123ff6ad083342c8" kindref="member">IIC_SendAck</ref>(0);</highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a97ad38a37ad0140987ba79d878f0d9e9" kindref="member">IIC_Start</ref>();</highlight></codeline>
<codeline lineno="161"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>((</highlight><highlight class="keywordtype">id</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>1)<sp/>|<sp/>0x01);</highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a684793afa5c26e6d123ff6ad083342c8" kindref="member">IIC_SendAck</ref>(0);</highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/><sp/><sp/>temp<sp/>=<sp/><ref refid="classbsp___i_i_c_1a15201c6a6bd1affde8da0fc642f62272" kindref="member">IIC_RecByte</ref>();</highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a684793afa5c26e6d123ff6ad083342c8" kindref="member">IIC_SendAck</ref>(1);</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae513e1a05cbbae2a6f37e6cbb3bb63e2" kindref="member">IIC_Stop</ref>();</highlight></codeline>
<codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>temp;}</highlight></codeline>
<codeline lineno="167"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="177" refid="classbsp___i_i_c_1a9d5d55340f9c43998763ecd0fb67b88c" refkind="member"><highlight class="comment"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___i_i_c_1a9d5d55340f9c43998763ecd0fb67b88c" kindref="member">bsp_IIC::IIC_Write</ref>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/></highlight><highlight class="keywordtype">id</highlight><highlight class="normal">,<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>addr,<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref>*<sp/>dat,<ref refid="varint_8h_1afaa62991928fb9fb18ff0db62a040aba" kindref="member">u32</ref><sp/>len){</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a97ad38a37ad0140987ba79d878f0d9e9" kindref="member">IIC_Start</ref>();</highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(</highlight><highlight class="keywordtype">id</highlight><highlight class="normal">&lt;&lt;1);</highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(addr);</highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();</highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=0;i&lt;len;i++){</highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(dat[i]);</highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();}</highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae513e1a05cbbae2a6f37e6cbb3bb63e2" kindref="member">IIC_Stop</ref>();</highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;}</highlight></codeline>
<codeline lineno="188"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="198" refid="classbsp___i_i_c_1aae8c08f59f3fce9dce27f9f04beda683" refkind="member"><highlight class="comment"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___i_i_c_1aae8c08f59f3fce9dce27f9f04beda683" kindref="member">bsp_IIC::IIC_Read</ref>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/></highlight><highlight class="keywordtype">id</highlight><highlight class="normal">,<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>addr,<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref>*<sp/>dat,<ref refid="varint_8h_1afaa62991928fb9fb18ff0db62a040aba" kindref="member">u32</ref><sp/>len){</highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a97ad38a37ad0140987ba79d878f0d9e9" kindref="member">IIC_Start</ref>();</highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(</highlight><highlight class="keywordtype">id</highlight><highlight class="normal">&lt;&lt;1);</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(addr);</highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a684793afa5c26e6d123ff6ad083342c8" kindref="member">IIC_SendAck</ref>(0);</highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a97ad38a37ad0140987ba79d878f0d9e9" kindref="member">IIC_Start</ref>();</highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>((</highlight><highlight class="keywordtype">id</highlight><highlight class="normal">&lt;&lt;1)|0x01);</highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a684793afa5c26e6d123ff6ad083342c8" kindref="member">IIC_SendAck</ref>(0);</highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=0;i&lt;len;i++){</highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dat[i]=<ref refid="classbsp___i_i_c_1a15201c6a6bd1affde8da0fc642f62272" kindref="member">IIC_RecByte</ref>();</highlight></codeline>
<codeline lineno="209"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a684793afa5c26e6d123ff6ad083342c8" kindref="member">IIC_SendAck</ref>(i==(len-1));}</highlight></codeline>
<codeline lineno="210"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae513e1a05cbbae2a6f37e6cbb3bb63e2" kindref="member">IIC_Stop</ref>();</highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;}</highlight></codeline>
<codeline lineno="213"><highlight class="normal"></highlight></codeline>
</programlisting>
<location file="D:/gitt/MicrochipFor32/bsp_Device/bsp_IIC.cpp"/>
</compounddef>
</doxygen>