⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpuser_h.html

📁 Controller Area Network Programming Interface Environment Ver0.8。 CanPie版本0.8. CAN总线通讯编程接口源代码。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<HTML><HEAD><TITLE>cpuser.h File Reference</TITLE><LINK HREF="micro.css" REL="stylesheet" TYPE="text/css"></HEAD><BODY BGCOLOR="#FFFFFF"><a name="PageTop"></a><!------ Document Header -------------------------------------------><table border="0" cellspacing="0" cellpadding="0"><tr><td valign="bottom"><img src="pictures/maphead.gif" vspace="0" border="0" height="20"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td valign="bottom"><a href="index.html"><img src="pictures/button_index.gif" vspace="0" border="0" height="25"></a></td><td valign="bottom"><a href="files.html"><img src="pictures/button_files.gif" vspace="0" border="0" height="25"></a></td><td valign="bottom"><a href="globals.html"><img src="pictures/button_funcs.gif" vspace="0" border="0" height="25"></a></td><td valign="bottom" width="80">&nbsp;</td><td valign="bottom"><a href="annotated.html"><img src="pictures/button_structs.gif" vspace="0" border="0" height="25"></a></td><td valign="bottom"><a href="functions.html"><img src="pictures/button_members.gif" vspace="0" border="0" height="25"></a></td></tr></table><hr noshade width=680 size=1 align=left><!------ Document Start --------------------------------------------><table width=680><tr><td><!-- Generated by Doxygen 1.2.6 --><h1>cpuser.h File Reference</h1>CANpie user functions. <a href="#_details">More...</a><p><code>#include "<a class="el" href="cpconst_h-source.html">cpconst.h</a>"</code><br><p><a href="cpuser_h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0><tr><td colspan=2><br><h2>Functions</h2></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpuser_h.html#a0">CpUserAppInit</a> (_U08 channel, _U16 rcvFifoSize, _U16 trmFifoSize, _U16 timeout)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Initialize the CAN driver.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpuser_h.html#a1">CpUserAppDeInit</a> (_U08 channel)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>De-Initialize the CAN driver.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpuser_h.html#a2">CpUserBaudrate</a> (_U08 channel, _U08 baud)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Setup baudrate.</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpuser_h.html#a3">CpUserFifoClear</a> (_U08 channel, _U08 buffer)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Clear FIFO buffer.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpuser_h.html#a4">CpUserFilterAll</a> (_U08 channel, _BIT enable)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Set global filter.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpuser_h.html#a5">CpUserFilterMsg</a> (_U08 channel, _U16 id, _BIT enable)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Set filter for single message.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpuser_h.html#a6">CpUserIntFunctions</a> (_U08 channel, _U08(*rx_handler)(<a class="el" href="struct_CpStruct_CAN.html">CpStruct_CAN</a> *), _U08(*tx_handler)(<a class="el" href="struct_CpStruct_CAN.html">CpStruct_CAN</a> *), _U08(*err_handler)(_U08))</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Install callback functions.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpuser_h.html#a7">CpUserMsgRead</a> (_U08 channel, <a class="el" href="struct_CpStruct_CAN.html">CpStruct_CAN</a> *msgPtr)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Read CAN message from Receive FIFO.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpuser_h.html#a8">CpUserMsgWrite</a> (_U08 channel, <a class="el" href="struct_CpStruct_CAN.html">CpStruct_CAN</a> *msgPtr)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Write CAN message to transmit FIFO.</em> <a href="#a8">More...</a><em></em></font><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>CANpie user functions.<p> <p> The user functions always call the core functions, they never access the hardware directly. That means the user functions do not have to be modified when implementing the CANpie on an existing hardware. A typical user function is the writing of a CAN message to the FIFO buffer (e.g. <a class="el" href="cpuser_h.html#a8">CpUserMsgWrite</a>() ).<p> The CAN driver is initialized with the function <a class="el" href="cpuser_h.html#a0">CpUserAppInit</a>(). This routine will call several core functions for the correct setup of the CAN controller. The core functions called are: <ul> <li><a class="el" href="cpfifo_h.html#a2">CpFifoSetup</a>() <li><a class="el" href="cpcore_h.html#a12">CpCoreInitDriver</a>() <li><a class="el" href="cpuser_h.html#a2">CpUserBaudrate</a>() <li><a class="el" href="cpuser_h.html#a4">CpUserFilterAll</a>() </ul> The initial baudrate is set to 20kBit/s by default. <b>The function <a class="el" href="cpuser_h.html#a0">CpUserAppInit</a>() must be called before any other CANpie function.</b><p><hr><h2>Function Documentation</h2><a name="a1" doxytag="cpuser.h::CpUserAppDeInit"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td nowrap valign="top"><b> Cp_EXPORT _U08 Cp_PREFIX CpUserAppDeInit (          </b></td>          <td valign="bottom"><b>_U08 <em>channel</em>&nbsp;)          </b></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>De-Initialize the CAN driver.<p><dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>channel</em>&nbsp;</td><td>CAN channel of the hardware </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>Error code taken from the CpErr enumeration. If no error occured, the function will return CpErr_OK.<p></dl>This function must be called when the application program quits.     </td>  </tr></table><a name="a0" doxytag="cpuser.h::CpUserAppInit"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td nowrap valign="top"><b> Cp_EXPORT _U08 Cp_PREFIX CpUserAppInit (          </b></td>          <td valign="bottom"><b>_U08 <em>channel</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_U16 <em>rcvFifoSize</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_U16 <em>trmFifoSize</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_U16 <em>timeout</em>&nbsp;)          </b></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Initialize the CAN driver.<p><dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>channel</em>&nbsp;</td><td>CAN channel of the hardware </td></tr><tr><td valign=top><em>rcvFifoSize</em>&nbsp;</td><td>Size of the reception FIFO (number of messages) </td></tr><tr><td valign=top><em>trmFifoSize</em>&nbsp;</td><td>Size of the transmit FIFO (number of messages) </td></tr><tr><td valign=top><em>timeout</em>&nbsp;</td><td>Timeout value for transmission of messages in milliseconds </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>Error code taken from the CpErr enumeration. If no error occured, the function will return CpErr_OK.<p></dl>This function must be called by the application program prior to all other functions. It is responsible for initializing the CAN controller interface.     </td>  </tr></table><a name="a2" doxytag="cpuser.h::CpUserBaudrate"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td nowrap valign="top"><b> Cp_EXPORT _U08 Cp_PREFIX CpUserBaudrate (          </b></td>          <td valign="bottom"><b>_U08 <em>channel</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_U08 <em>baud</em>&nbsp;)          </b></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Setup baudrate.<p><dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>channel</em>&nbsp;</td><td>CAN channel of the hardware </td></tr><tr><td valign=top><em>baudrate</em>&nbsp;</td><td>constant for the baudrate, taken from CP_BAUD enumeration </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>Error code taken from the CpErr enumeration. If no error occured, the function will return CpErr_OK.<p></dl>This function sets the baudrate of the selected CAN channel. Possible values for the baudrate are: <ul> <li>CP_BAUD_10K - 10 kBit/s <li>CP_BAUD_20K - 20 kBit/s <li>CP_BAUD_50K - 50 kBit/s <li>CP_BAUD_100K - 100 kBit/s <li>CP_BAUD_125K - 125 kBit/s <li>CP_BAUD_250K - 250 kBit/s <li>CP_BAUD_500K - 500 kBit/s <li>CP_BAUD_800K - 800 kBit/s <li>CP_BAUD_1M - 1 MBit/s </ul> It simply calls the <a class="el" href="cpcore_h.html#a5">CpCoreBaudrate</a>() function with bit timing values that are defined in the table "CpStruct_BitTiming". The values of this table depend on the used CAN controller and the controller clock frequency.     </td>  </tr></table><a name="a3" doxytag="cpuser.h::CpUserFifoClear"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td nowrap valign="top"><b> Cp_EXPORT _U08 Cp_PREFIX CpUserFifoClear (          </b></td>          <td valign="bottom"><b>_U08 <em>channel</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_U08 <em>buffer</em>&nbsp;)          </b></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Clear FIFO buffer.<p><dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>channel</em>&nbsp;</td><td>CAN channel of the hardware </td></tr><tr><td valign=top><em>buffer</em>&nbsp;</td><td>CP_FIFO_RCV for the Receive FIFO or CP_FIFO_TRM for the Transmit FIFO<p></td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>Error code taken from the CpErr enumeration. If no error occured, the function will return CpErr_OK.<p></dl>Deletes all messages of the specific FIFO buffer.     </td>  </tr></table><a name="a4" doxytag="cpuser.h::CpUserFilterAll"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td nowrap valign="top"><b> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -