135 lines
16 KiB
XML
135 lines
16 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___a_t24_c00_8cpp" kind="file" language="C++">
|
||
|
|
<compoundname>bsp_AT24C00.cpp</compoundname>
|
||
|
|
<includes refid="varint_8h" local="yes">varint.h</includes>
|
||
|
|
<includes local="yes">main.h</includes>
|
||
|
|
<includes refid="bsp___a_t24_c00_8h" local="yes">bsp_AT24C00.h</includes>
|
||
|
|
<incdepgraph>
|
||
|
|
<node id="1">
|
||
|
|
<label>D:/gitt/MicrochipFor32/bsp_Device/bsp_AT24C00.cpp</label>
|
||
|
|
<link refid="bsp___a_t24_c00_8cpp"/>
|
||
|
|
<childnode refid="2" relation="include">
|
||
|
|
</childnode>
|
||
|
|
<childnode refid="4" relation="include">
|
||
|
|
</childnode>
|
||
|
|
<childnode refid="5" relation="include">
|
||
|
|
</childnode>
|
||
|
|
</node>
|
||
|
|
<node id="5">
|
||
|
|
<label>bsp_AT24C00.h</label>
|
||
|
|
<link refid="bsp___a_t24_c00_8h"/>
|
||
|
|
<childnode refid="2" relation="include">
|
||
|
|
</childnode>
|
||
|
|
<childnode refid="6" relation="include">
|
||
|
|
</childnode>
|
||
|
|
</node>
|
||
|
|
<node id="8">
|
||
|
|
<label>bsp_IIC.h</label>
|
||
|
|
<link refid="bsp___i_i_c_8h"/>
|
||
|
|
<childnode refid="2" relation="include">
|
||
|
|
</childnode>
|
||
|
|
</node>
|
||
|
|
<node id="6">
|
||
|
|
<label>bsp_IIC_STM32.h</label>
|
||
|
|
<link refid="bsp___i_i_c___s_t_m32_8h"/>
|
||
|
|
<childnode refid="7" relation="include">
|
||
|
|
</childnode>
|
||
|
|
<childnode refid="2" relation="include">
|
||
|
|
</childnode>
|
||
|
|
<childnode refid="8" relation="include">
|
||
|
|
</childnode>
|
||
|
|
</node>
|
||
|
|
<node id="2">
|
||
|
|
<label>varint.h</label>
|
||
|
|
<link refid="varint_8h"/>
|
||
|
|
<childnode refid="3" relation="include">
|
||
|
|
</childnode>
|
||
|
|
</node>
|
||
|
|
<node id="7">
|
||
|
|
<label>gpio.h</label>
|
||
|
|
</node>
|
||
|
|
<node id="4">
|
||
|
|
<label>main.h</label>
|
||
|
|
</node>
|
||
|
|
<node id="3">
|
||
|
|
<label>stdint.h</label>
|
||
|
|
</node>
|
||
|
|
</incdepgraph>
|
||
|
|
<briefdescription>
|
||
|
|
<para>本类实现AT24C00的通讯 </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"></highlight></codeline>
|
||
|
|
<codeline lineno="35"><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
|
||
|
|
<codeline lineno="36"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>头文件</highlight><highlight class="normal"></highlight></codeline>
|
||
|
|
<codeline lineno="37"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="varint_8h" kindref="compound">varint.h</ref>"</highlight><highlight class="normal"></highlight></codeline>
|
||
|
|
<codeline lineno="38"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"main.h"</highlight><highlight class="normal"></highlight></codeline>
|
||
|
|
<codeline lineno="39"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="bsp___a_t24_c00_8h" kindref="compound">bsp_AT24C00.h</ref>"</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___s_t_m32___a_t24_c00_1a7ba3cbef5e2eea37f514948f12f2119d" refkind="member"><highlight class="comment"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___s_t_m32___a_t24_c00_1a7ba3cbef5e2eea37f514948f12f2119d" kindref="member">bsp_STM32_AT24C00::IIC_Delay</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">){</highlight></codeline>
|
||
|
|
<codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/>HAL_Delay(5);}</highlight></codeline>
|
||
|
|
<codeline lineno="49"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight></codeline>
|
||
|
|
<codeline lineno="55" refid="classbsp___s_t_m32___a_t24_c00_1a43f5fb06621d92865d9289d996b3211a" refkind="member"><highlight class="comment"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___s_t_m32___a_t24_c00_1a43f5fb06621d92865d9289d996b3211a" kindref="member">bsp_STM32_AT24C00::WriteOneByte</ref>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>addr,<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>dat){</highlight></codeline>
|
||
|
|
<codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a9f4cdf777e69f407b155ffdba5b9e7c8" kindref="member">IIC_WriteOneByte</ref>(<ref refid="classbsp___s_t_m32___a_t24_c00_1a7b81cd0d8fea1bb0ce4e4b0143612bde" kindref="member">Address</ref>,addr,dat);}</highlight></codeline>
|
||
|
|
<codeline lineno="57"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight></codeline>
|
||
|
|
<codeline lineno="63" refid="classbsp___s_t_m32___a_t24_c00_1a950e3a80ff49c538294bfedf8e893ff7" refkind="member"><highlight class="comment"></highlight><highlight class="normal"><ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/><ref refid="classbsp___s_t_m32___a_t24_c00_1a950e3a80ff49c538294bfedf8e893ff7" kindref="member">bsp_STM32_AT24C00::ReadOneByte</ref>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>addr){</highlight></codeline>
|
||
|
|
<codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classbsp___i_i_c_1a9effd40b26cbf6f321d0f0db3e2f09c3" kindref="member">IIC_ReadOneByte</ref>(<ref refid="classbsp___s_t_m32___a_t24_c00_1a7b81cd0d8fea1bb0ce4e4b0143612bde" kindref="member">Address</ref>,addr);}</highlight></codeline>
|
||
|
|
<codeline lineno="65"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight></codeline>
|
||
|
|
<codeline lineno="72" refid="classbsp___s_t_m32___a_t24_c00_1a2c0bcf4f2ffd4ef242c8d4423dca1ad0" refkind="member"><highlight class="comment"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___s_t_m32___a_t24_c00_1a2c0bcf4f2ffd4ef242c8d4423dca1ad0" kindref="member">bsp_STM32_AT24C00::WriteByte</ref>(<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_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>len){</highlight></codeline>
|
||
|
|
<codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>member=0;</highlight></codeline>
|
||
|
|
<codeline lineno="74"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a97ad38a37ad0140987ba79d878f0d9e9" kindref="member">IIC_Start</ref>();</highlight></codeline>
|
||
|
|
<codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(<ref refid="classbsp___s_t_m32___a_t24_c00_1a7b81cd0d8fea1bb0ce4e4b0143612bde" kindref="member">Address</ref><<1);</highlight></codeline>
|
||
|
|
<codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();</highlight></codeline>
|
||
|
|
<codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(addr);</highlight></codeline>
|
||
|
|
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();</highlight></codeline>
|
||
|
|
<codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">do</highlight><highlight class="normal">{</highlight></codeline>
|
||
|
|
<codeline lineno="80"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(dat[member]);</highlight></codeline>
|
||
|
|
<codeline lineno="81"><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="82"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>member++;</highlight></codeline>
|
||
|
|
<codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(((member+addr)%<ref refid="classbsp___s_t_m32___a_t24_c00_1a5c1a52c22b16f15bf07358a4b181e2ff" kindref="member">Page</ref>)==0){</highlight></codeline>
|
||
|
|
<codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae513e1a05cbbae2a6f37e6cbb3bb63e2" kindref="member">IIC_Stop</ref>();</highlight></codeline>
|
||
|
|
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___s_t_m32___a_t24_c00_1a7ba3cbef5e2eea37f514948f12f2119d" kindref="member">IIC_Delay</ref>();</highlight></codeline>
|
||
|
|
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a97ad38a37ad0140987ba79d878f0d9e9" kindref="member">IIC_Start</ref>();</highlight></codeline>
|
||
|
|
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(<ref refid="classbsp___s_t_m32___a_t24_c00_1a7b81cd0d8fea1bb0ce4e4b0143612bde" kindref="member">Address</ref><<1);</highlight></codeline>
|
||
|
|
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();</highlight></codeline>
|
||
|
|
<codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae2e78aae0c89a4d6063d8ba60752acd5" kindref="member">IIC_SendByte</ref>(addr+member);</highlight></codeline>
|
||
|
|
<codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1a3f14f230b5876c529380d4f51a9c9c12" kindref="member">IIC_WaitAck</ref>();}</highlight></codeline>
|
||
|
|
<codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(member!=len);</highlight></codeline>
|
||
|
|
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1ae513e1a05cbbae2a6f37e6cbb3bb63e2" kindref="member">IIC_Stop</ref>();</highlight></codeline>
|
||
|
|
<codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___s_t_m32___a_t24_c00_1a7ba3cbef5e2eea37f514948f12f2119d" kindref="member">IIC_Delay</ref>();}</highlight></codeline>
|
||
|
|
<codeline lineno="94"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight></codeline>
|
||
|
|
<codeline lineno="101" refid="classbsp___s_t_m32___a_t24_c00_1ad5b68ee911f6e46ab877049eaadc5b1c" refkind="member"><highlight class="comment"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___s_t_m32___a_t24_c00_1ad5b68ee911f6e46ab877049eaadc5b1c" kindref="member">bsp_STM32_AT24C00::AT_ReadByte</ref>(<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_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>len){</highlight></codeline>
|
||
|
|
<codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___i_i_c_1aae8c08f59f3fce9dce27f9f04beda683" kindref="member">IIC_Read</ref>(<ref refid="classbsp___s_t_m32___a_t24_c00_1a7b81cd0d8fea1bb0ce4e4b0143612bde" kindref="member">Address</ref>,addr,dat,len);}</highlight></codeline>
|
||
|
|
<codeline lineno="104"><highlight class="normal"></highlight></codeline>
|
||
|
|
</programlisting>
|
||
|
|
<location file="D:/gitt/MicrochipFor32/bsp_Device/bsp_AT24C00.cpp"/>
|
||
|
|
</compounddef>
|
||
|
|
</doxygen>
|