📄 main_8c.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>WirelessUSB(TM) LS PRoC DVK Protocol Slave Tutorial: main.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
<h1>main.c File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
The main Protocol Slave Tutorial code.
<p>
<code>#include "<a class="el" href="protocol_8h.html">protocol.h</a>"</code><br>
<code>#include "radio.h"</code><br>
<code>#include "lcd.h"</code><br>
<code>#include "stdlib.h"</code><br>
<p>
Include dependency graph for main.c:<p><center><img src="main_8c__incl.png" border="0" usemap="#main.c_map" alt="Include dependency graph"></center>
<map name="main.c_map">
<area href="protocol_8h.html" shape="rect" coords="154,157,234,184" alt="">
<area href="ls__config_8h.html" shape="rect" coords="152,82,237,109" alt="">
<area href="isr_8h.html" shape="rect" coords="133,8,178,34" alt="">
<area href="timer_8h.html" shape="rect" coords="202,8,266,34" alt="">
<area href="flash_8h.html" shape="rect" coords="290,8,352,34" alt="">
</map>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8c.html#a0">COUNTER_TIMEOUT</a> 10</td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8c.html#a8">button_pressed</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8c.html#a9">app_unload_packet</a> (<a class="el" href="cypdef_8h.html#a1">UINT8</a> temp)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8c.html#a10">main</a> ()</td></tr>
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8c.html#a1">flag_LED</a> = 1</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8c.html#a2">button_up</a> = TRUE</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8c.html#a3">channel</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8c.html#a4">pn_code</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8c.html#a5">local_bind_state</a> = 0xFF</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="struct__SYS__PARAMETERS.html">SYS_PARAMETERS</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8c.html#a6">sys_params</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8c.html#a7">bind_state</a></td></tr>
</table>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="a0" doxytag="main.c::COUNTER_TIMEOUT"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">#define COUNTER_TIMEOUT 10 </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Timeout to send a null packet every five iterations through the loop.
<p>
</td>
</tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="a8" doxytag="main.c::button_pressed"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> button_pressed </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Description: Check to see if the button is pressed<p>
Inputs: void<p>
Returns:<ul>
<li>1 - Button pressed</li><li>0 - Button not pressed </li></ul>
</td>
</tr>
</table>
<a class="anchor" name="a9" doxytag="main.c::app_unload_packet"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void app_unload_packet </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td>
<td class="mdname1" valign="top" nowrap> <em>temp</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Description: Switches LED's between LED1 and LED4 by turning one off and other one on.<p>
Inputs: Void<p>
Returns: Void </td>
</tr>
</table>
<a class="anchor" name="a10" doxytag="main.c::main"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void main </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Description: The Protocol Slave Tutorial main routine initializes the system by initializing the ISR, timer, and protocol. Then the protocol is set to a slave role. <a class="el" href="protocol_8c.html#a16">slave_bind()</a> is used to bind to a master device. After binding, it continuously checks for a button press, timeout, and an ACK_DATA packet. If the button has been pressed, then it will send a packet to the master device. If a timeout occurs, then it will send a null packet to look for the ACK_DATA packet from the master. If an ACK_DATA packet is received, then <a class="el" href="main_8c.html#a9">app_unload_packet()</a> is called to toggle the LEDs. It also displays channel, PN code, and bind state through the LCD.<p>
Inputs: Void<p>
Returns: Void </td>
</tr>
</table>
<p>
Here is the call graph for this function:<p><center><img src="main_8c_a10_cgraph.png" border="0" usemap="#main_8c_a10_cgraph_map" alt=""></center>
<map name="main_8c_a10_cgraph_map">
<area href="main_8c.html#a9" shape="rect" coords="109,7,248,34" alt="">
<area href="main_8c.html#a8" shape="rect" coords="122,58,234,85" alt="">
<area href="isr_8c.html#a0" shape="rect" coords="148,109,209,135" alt="">
<area href="protocol_8c.html#a14" shape="rect" coords="132,159,225,186" alt="">
<area href="protocol_8c.html#a16" shape="rect" coords="297,235,382,262" alt="">
<area href="protocol_8h.html#a94" shape="rect" coords="110,261,246,287" alt="">
<area href="timer_8h.html#a10" shape="rect" coords="112,311,245,338" alt="">
<area href="timer_8c.html#a3" shape="rect" coords="140,362,217,389" alt="">
</map>
<hr><h2>Variable Documentation</h2>
<a class="anchor" name="a1" doxytag="main.c::flag_LED"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> <a class="el" href="main_8c.html#a1">flag_LED</a> = 1 </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Flag for toggling LEDs.
<p>
</td>
</tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -