📄 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 Master 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 Master 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">MAX_NUM_TRANSMIT</a> 5</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#a6">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#a7">app_unload_packet</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#a8">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">app_rx_buffer</a> [MAX_DATA_LEN]</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">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#a3">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#a4">channel</a></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#a5">sys_params</a></td></tr>
</table>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="a0" doxytag="main.c::MAX_NUM_TRANSMIT"></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 MAX_NUM_TRANSMIT 5 </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Maximum number of transmits.
<p>
</td>
</tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="a6" 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="a7" 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">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: Switches LED's between LED1 and LED4 by turning one off and other one on.<p>
Inputs: Void<p>
Returns: Void </td>
</tr>
</table>
<p>
Here is the call graph for this function:<p><center><img src="main_8c_a7_cgraph.png" border="0" usemap="#main_8c_a7_cgraph_map" alt=""></center>
<map name="main_8c_a7_cgraph_map">
<area href="protocol_8h.html#a97" shape="rect" coords="194,8,357,34" alt="">
</map>
<a class="anchor" name="a8" 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 Master Tutorial main routine initializes the system by initializing the ISR, timer, and protocol. Then the protocol is set to a master role. <a class="el" href="protocol_8c.html#a19">master_bind_mode()</a> is used to bind to a slave device. After binding, it continuously checks for a button press or goes into <a class="el" href="protocol_8c.html#a20">master_data_mode()</a>, which looks for a data packet from the slave device and calls <a class="el" href="main_8c.html#a7">app_unload_packet()</a> if a packet is received. If a button is pressed, a data packet is sent to the slave device.<p>
Inputs: Void<p>
Returns: Void </td>
</tr>
</table>
<p>
Here is the call graph for this function:<p><center><img src="main_8c_a8_cgraph.png" border="0" usemap="#main_8c_a8_cgraph_map" alt=""></center>
<map name="main_8c_a8_cgraph_map">
<area href="main_8c.html#a7" shape="rect" coords="113,8,252,34" alt="">
<area href="main_8c.html#a6" shape="rect" coords="126,58,238,85" alt="">
<area href="isr_8c.html#a0" shape="rect" coords="152,109,213,136" alt="">
<area href="protocol_8c.html#a20" shape="rect" coords="114,160,250,186" alt="">
<area href="protocol_8h.html#a95" shape="rect" coords="109,210,256,237" alt="">
<area href="protocol_8c.html#a16" shape="rect" coords="136,261,229,288" alt="">
<area href="timer_8c.html#a3" shape="rect" coords="144,312,221,338" alt="">
</map>
<hr><h2>Variable Documentation</h2>
<a class="anchor" name="a1" doxytag="main.c::app_rx_buffer"></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">app_rx_buffer</a>[MAX_DATA_LEN] </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
To store the last received packet.
<p>
</td>
</tr>
</table>
<a class="anchor" name="a2" 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#a2">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>
</table>
<a class="anchor" name="a3" doxytag="main.c::button_up"></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#a3">button_up</a> = TRUE </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Button state.
<p>
</td>
</tr>
</table>
<a class="anchor" name="a4" doxytag="main.c::channel"></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#a4">channel</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Channel the radio is on, to display in LCD module.
<p>
</td>
</tr>
</table>
<a class="anchor" name="a5" doxytag="main.c::sys_params"></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="struct__SYS__PARAMETERS.html">SYS_PARAMETERS</a> <a class="el" href="protocol_8c.html#a2">sys_params</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
To set/retrieve radio parameters. Such as PN code, channel, MID, etc.
<p>
To retrieve radio attributes. In this file it is used to retrieve the channel the radio is on. </td>
</tr>
</table>
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=Generator content="Microsoft Word 10 (filtered)">
<title>Cypress Semiconductor Corporation</title>
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
{font-family:"\@MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:#1A419D;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:#1A419D;
text-decoration:underline;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link="#1A419D" vlink="#1A419D">
<div class=Section1>
<div>
<div align=center>
<table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width="100%"
style='width:100.0%;border-collapse:collapse;border:none'>
<tr>
<td width="100%" style='width:100.0%;border:none;border-top:solid windowtext 1.0pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><b><span
style='font-size:13.0pt;font-family:Arial;color:blue'><a
href="http://www.cypress.com/">Cypress Semiconductor Corporation</a></span></b><b><span
style='font-size:13.0pt;font-family:Arial'>牋 </span></b><b><span
style='font-size:16.0pt;font-family:Symbol'>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -