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

121 lines
20 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___digit_8cpp" kind="file" language="C++">
<compoundname>bsp_Digit.cpp</compoundname>
<includes refid="bsp___digit_8h" local="yes">bsp_Digit.h</includes>
<incdepgraph>
<node id="1">
<label>D:/gitt/MicrochipFor32/bsp_Device/bsp_Digit.cpp</label>
<link refid="bsp___digit_8cpp"/>
<childnode refid="2" relation="include">
</childnode>
</node>
<node id="2">
<label>bsp_Digit.h</label>
<link refid="bsp___digit_8h"/>
<childnode refid="3" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
</node>
<node id="3">
<label>varint.h</label>
<link refid="varint_8h"/>
<childnode refid="4" relation="include">
</childnode>
</node>
<node id="5">
<label>gpio.h</label>
</node>
<node id="4">
<label>stdint.h</label>
</node>
</incdepgraph>
<briefdescription>
<para>数码管显示类 </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="34"><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>头文件</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="36"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="bsp___digit_8h" kindref="compound">bsp_Digit.h</ref>&quot;</highlight></codeline>
<codeline lineno="38"><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="39"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>成员函数</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="40"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="41" refid="classbsp___digit_1a0608eae8fc20fea488b578b4440a5973" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___digit_1a0608eae8fc20fea488b578b4440a5973" kindref="member">bsp_Digit::dat</ref>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>SendVal)<sp/>{</highlight></codeline>
<codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>8;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>HAL_GPIO_WritePin(<ref refid="classbsp___digit_1a74829f4e2ae8a7a041b8bd249d93242f" kindref="member">GPIOx_MOSIO</ref>,<ref refid="classbsp___digit_1ac3fb901cccd34c97bcdff090060d0eb9" kindref="member">GPIO_Pin_MOSIO</ref>,((SendVal<sp/>&lt;&lt;<sp/>i)<sp/>&amp;<sp/>0x80)?GPIO_PIN_SET:<sp/>GPIO_PIN_RESET);</highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>HAL_GPIO_WritePin(<ref refid="classbsp___digit_1a128d72d3f9705a6635fd5ba3a8f11219" kindref="member">GPIOx_S_CLK</ref>,<ref refid="classbsp___digit_1af642ff2d193c72cd6e44da895997936e" kindref="member">GPIO_Pin_S_CLK</ref>,GPIO_PIN_RESET);</highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>HAL_GPIO_WritePin(<ref refid="classbsp___digit_1a128d72d3f9705a6635fd5ba3a8f11219" kindref="member">GPIOx_S_CLK</ref>,<sp/><ref refid="classbsp___digit_1af642ff2d193c72cd6e44da895997936e" kindref="member">GPIO_Pin_S_CLK</ref>,<sp/>GPIO_PIN_SET);}}</highlight></codeline>
<codeline lineno="46"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="47" refid="classbsp___digit_1a8362aa8c9725ab2000e4b1f3c816de8b" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___digit_1a8362aa8c9725ab2000e4b1f3c816de8b" kindref="member">bsp_Digit::com</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/>HAL_GPIO_WritePin(<ref refid="classbsp___digit_1a35b4df52093b6f34e2bd0e99a6fac473" kindref="member">GPIOx_R_CLK</ref>,<sp/><ref refid="classbsp___digit_1a3914358421f51f43a9098ddd37d83a59" kindref="member">GPIO_Pin_R_CLK</ref>,<sp/>GPIO_PIN_RESET);</highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/>HAL_GPIO_WritePin(<ref refid="classbsp___digit_1a35b4df52093b6f34e2bd0e99a6fac473" kindref="member">GPIOx_R_CLK</ref>,<sp/><ref refid="classbsp___digit_1a3914358421f51f43a9098ddd37d83a59" kindref="member">GPIO_Pin_R_CLK</ref>,<sp/>GPIO_PIN_SET);}</highlight></codeline>
<codeline lineno="50"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="51" refid="classbsp___digit_1a9f91f206f32eef69e91c5975ad12db6b" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___digit_1a9f91f206f32eef69e91c5975ad12db6b" kindref="member">bsp_Digit::DatCom</ref>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>SendVal,<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>cha){</highlight></codeline>
<codeline lineno="52"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa" kindref="member">u16</ref><sp/>i=0xFFFF/<ref refid="classbsp___digit_1a26571e190c198e068d6aa92af584352d" kindref="member">division</ref>;</highlight></codeline>
<codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a0608eae8fc20fea488b578b4440a5973" kindref="member">dat</ref>(<ref refid="classbsp___digit_1af87156a3cca1c199e469b0ce7b8ce7f9" kindref="member">Polarity</ref>?~<ref refid="bsp___digit_8h_1a9c1f3d665aa750ca904e9e547a2c98f8" kindref="member">digit_ca</ref>[SendVal]:<ref refid="bsp___digit_8h_1a9c1f3d665aa750ca904e9e547a2c98f8" kindref="member">digit_ca</ref>[SendVal]);</highlight></codeline>
<codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a0608eae8fc20fea488b578b4440a5973" kindref="member">dat</ref>(1&lt;&lt;cha);</highlight></codeline>
<codeline lineno="55"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a8362aa8c9725ab2000e4b1f3c816de8b" kindref="member">com</ref>();</highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(++i);}</highlight></codeline>
<codeline lineno="57"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="58" refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" kindref="member">bsp_Digit::num</ref>(<ref refid="varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa" kindref="member">u16</ref><sp/>num){</highlight></codeline>
<codeline lineno="59"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a9f91f206f32eef69e91c5975ad12db6b" kindref="member">DatCom</ref>(<ref refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" kindref="member">num</ref>%10,0);<ref refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" kindref="member">num</ref>/=10;</highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a9f91f206f32eef69e91c5975ad12db6b" kindref="member">DatCom</ref>(<ref refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" kindref="member">num</ref>%10,1);<ref refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" kindref="member">num</ref>/=10;</highlight></codeline>
<codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a9f91f206f32eef69e91c5975ad12db6b" kindref="member">DatCom</ref>(<ref refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" kindref="member">num</ref>%10,2);<ref refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" kindref="member">num</ref>/=10;</highlight></codeline>
<codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a9f91f206f32eef69e91c5975ad12db6b" kindref="member">DatCom</ref>(<ref refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" kindref="member">num</ref>%10,3);<ref refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" kindref="member">num</ref>/=10;}</highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="64" refid="classbsp___digit_1a1b609eee1a20e598fdb7090b8a0b0524" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___digit_1a1b609eee1a20e598fdb7090b8a0b0524" kindref="member">bsp_Digit::dop</ref>(<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>cha){</highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa" kindref="member">u16</ref><sp/>i=0xFFFF/<ref refid="classbsp___digit_1a26571e190c198e068d6aa92af584352d" kindref="member">division</ref>;</highlight></codeline>
<codeline lineno="66"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a0608eae8fc20fea488b578b4440a5973" kindref="member">dat</ref>(<ref refid="classbsp___digit_1af87156a3cca1c199e469b0ce7b8ce7f9" kindref="member">Polarity</ref>?0x80:0x7E);</highlight></codeline>
<codeline lineno="67"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a0608eae8fc20fea488b578b4440a5973" kindref="member">dat</ref>(1&lt;&lt;cha);</highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a8362aa8c9725ab2000e4b1f3c816de8b" kindref="member">com</ref>();</highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(++i);}</highlight></codeline>
<codeline lineno="70"><highlight class="normal"></highlight><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="71" refid="classbsp___digit_1a7bde5d953a88e04dae985b3ce82a386e" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classbsp___digit_1a7bde5d953a88e04dae985b3ce82a386e" kindref="member">bsp_Digit::numdop</ref>(<ref refid="varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa" kindref="member">u16</ref><sp/>num,<ref refid="varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca" kindref="member">u8</ref><sp/>cha){</highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" kindref="member">bsp_Digit::num</ref>(<ref refid="classbsp___digit_1a37e6984660f0b60322d420c766107b40" kindref="member">num</ref>);</highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a1b609eee1a20e598fdb7090b8a0b0524" kindref="member">bsp_Digit::dop</ref>(cha);}</highlight></codeline>
<codeline lineno="75"><highlight class="comment">//----------------------------------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>构造函数</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="77" refid="classbsp___digit_1a83071caacf301b37cf47b6eee55c2818" refkind="member"><highlight class="normal"><ref refid="classbsp___digit_1a83071caacf301b37cf47b6eee55c2818" kindref="member">bsp_Digit::bsp_Digit</ref>(</highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/>GPIO_TypeDef*<sp/>GPIOx_MOSIO,<sp/>uint16_t<sp/>GPIO_Pin_MOSIO,</highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/>GPIO_TypeDef*<sp/>GPIOx_S_CLK,<sp/>uint16_t<sp/>GPIO_Pin_S_CLK,</highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/><sp/><sp/>GPIO_TypeDef*<sp/>GPIOx_R_CLK,<sp/>uint16_t<sp/>GPIO_Pin_R_CLK,</highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"><sp/>Polarity){</highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a26571e190c198e068d6aa92af584352d" kindref="member">bsp_Digit::division</ref>=2;</highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1af87156a3cca1c199e469b0ce7b8ce7f9" kindref="member">bsp_Digit::Polarity</ref><sp/>=<sp/><ref refid="classbsp___digit_1af87156a3cca1c199e469b0ce7b8ce7f9" kindref="member">Polarity</ref>;</highlight></codeline>
<codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a74829f4e2ae8a7a041b8bd249d93242f" kindref="member">bsp_Digit::GPIOx_MOSIO</ref><sp/>=<sp/><ref refid="classbsp___digit_1a74829f4e2ae8a7a041b8bd249d93242f" kindref="member">GPIOx_MOSIO</ref>;</highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1ac3fb901cccd34c97bcdff090060d0eb9" kindref="member">bsp_Digit::GPIO_Pin_MOSIO</ref><sp/>=<sp/><ref refid="classbsp___digit_1ac3fb901cccd34c97bcdff090060d0eb9" kindref="member">GPIO_Pin_MOSIO</ref>;</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a128d72d3f9705a6635fd5ba3a8f11219" kindref="member">bsp_Digit::GPIOx_S_CLK</ref><sp/>=<sp/><ref refid="classbsp___digit_1a128d72d3f9705a6635fd5ba3a8f11219" kindref="member">GPIOx_S_CLK</ref>;</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1af642ff2d193c72cd6e44da895997936e" kindref="member">bsp_Digit::GPIO_Pin_S_CLK</ref><sp/>=<sp/><ref refid="classbsp___digit_1af642ff2d193c72cd6e44da895997936e" kindref="member">GPIO_Pin_S_CLK</ref>;</highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a35b4df52093b6f34e2bd0e99a6fac473" kindref="member">bsp_Digit::GPIOx_R_CLK</ref><sp/>=<sp/><ref refid="classbsp___digit_1a35b4df52093b6f34e2bd0e99a6fac473" kindref="member">GPIOx_R_CLK</ref>;</highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classbsp___digit_1a3914358421f51f43a9098ddd37d83a59" kindref="member">bsp_Digit::GPIO_Pin_R_CLK</ref><sp/>=<sp/><ref refid="classbsp___digit_1a3914358421f51f43a9098ddd37d83a59" kindref="member">GPIO_Pin_R_CLK</ref>;}</highlight></codeline>
</programlisting>
<location file="D:/gitt/MicrochipFor32/bsp_Device/bsp_Digit.cpp"/>
</compounddef>
</doxygen>