| AVR Z-LINKŪ |

# main.c File Reference

## Detailed Description

File containing the main loop.

Application note:
  AVR414: User's Guide - ATAVRRZ502 - Accessory Kit

Documentation
  For comprehensive code documentation, supported compilers, compiler settings and supported devices see readme.html

Author:
  Atmel Corporation: http://www.atmel.com
  Support email: avr@atmel.com

Name

Revision
  1.2

RCSfile
  callbacks.c,v

Date
  2006/09/15 17:02:19

Definition in file main.c.

`#include <stdbool.h>`
`#include <stdint.h>`
`#include "compiler.h"`
`#include "serialPortHAL.h"`
`#include "atParser.h"`
`#include "ieee_const.h"`
`#include "ieee_types.h"`
`#include "wpan_mac.h"`

Include dependency graph for main.c:

Go to the source code of this file.

## Functions
static void | applicationInit (void)
| Function called to initialize the AVR, IEEE 802.15.4 stack and serial interface.
int | main (void)
| Main function for the AVR414 firmware.

## Function Documentation

static void applicationInit | ( | void |  | ) | `[static]`

Function called to initialize the AVR, IEEE 802.15.4 stack and serial interface.

Definition at line 79 of file main.c.

References serialInterfaceInitialization().

Referenced by main().

    00079                                    {
    00080
    00081         //Initialize MAC library and enable interrupts.
    00082         wpan_init( );
    00083         sei( );
    00084
    00085         //Initialize serial interface. Either USART0 or FTDI USB chip.
    00086         serialInterfaceInitialization( );
    00087 }

Here is the call graph for this function:

int main | ( | void |  | ) |

Main function for the AVR414 firmware.

On reset this function will be called and it will setup the AVR for the purposes of this application. This is done by calling the local (static) applicationInit( ) member. This function will initialize the IEEE 802.15.4 stack and the serial interface. Then an endless loop is entered:

1. call the wpan_task() function until it returns false (No more events in the queue).
2. if new data is available:
   - call handleNewCommand() to parse it.
   - reset receiver module of serial interface. The receiver is turned off to ensure that interrupts are not nested.

Definition at line 56 of file main.c.

References applicationInit(), dataAvailable(), handleNewCommand(), and rxReset().

    00056                 {
    00057
    00058         applicationInit( );
    00059
    00060         while( true ){
    00061
    00062                 while( wpan_task( ) ){
    00063
    00064             ;
    00065         }
    00066
    00067                 if( dataAvailable( ) ){
    00068
    00069                         handleNewCommand( );
    00070                         rxReset( );
    00071                 }
    00072         }
    00073 }

Here is the call graph for this function:

@DOC_TITLE@