Examples

The µracoli examples illustrate the use of the various library functions. This simple programms operate the LEDs, the HIF or the radio transceiver. They can be used either for testing the hardware or as starting point for own applications.

## Example Usage

Each example consists of a C source file, a GNUMakefile that is used for command line builds and an aps-file for Atmel AvrStudio . Here are the files, that belong to the example xmpl_hif.c - Using the Host Interface Functions.

         xmpl/xmpl.h .................... common defines for all examples
         xmpl/xmpl_hif.c ................ example source file
         xmpl/xmpl_hif.aps .............. AVR Studio file
         xmpl/xmpl_hif.mk ............... GNU Makefile

Building on the Command Line

The example can be build with command `make -f xmpl_hif.mk TARGET`. TARGET is either all (building this example for supported boards) or the name of the board to build for (see Boards and Modules).

Here is the log for building xmpl_hif.c for the board rdk230.

     make -C install/xmpl/ -f xmpl_hif.mk rdk230
        make: Entering directory `[...]/install/xmpl'
        make -f xmpl_hif.mk BOARD=rdk230 MCU=atmega1281 F_CPU=8000000UL ./obj ./bin __xmpl_hif__
        make[1]: Entering directory `[...]/install/xmpl'
        avr-gcc -Wall -Wundef -Os -g -mmcu=atmega1281 -Wa,-adhlns=./obj/xmpl_hif_rdk230.lst -Drdk230 -DF_CPU=8000000UL -I../inc -I. -c -o obj/xmpl_hif_rdk230.o xmpl_hif.c
        avr-gcc -o bin/xmpl_hif_rdk230.elf -Wall -Wundef -Os -g -mmcu=atmega1281 -Wa,-adhlns=obj/xmpl_hif_rdk230.o -Drdk230 -DF_CPU=8000000UL -I../inc -I. obj/xmpl_hif_rdk230.o -L../lib -lradio_rdk230 -lio_rdk230
        avr-objcopy -O ihex bin/xmpl_hif_rdk230.elf bin/xmpl_hif_rdk230.hex
        make[1]: Leaving directory `[...]/install/xmpl'
        make: Leaving directory `[...]/install/xmpl'

After make did run, the files `bin/xmpl_hif_rdk230.elf` and `bin/xmpl_hif_rdk230.hex` are created. The directory `./obj` stores temporary files that are created during the build.

Building Examples with AvrStudio.

Double click on the xmpl_hif.aps and AvrStudio starts with the project file. In the next step select "Project/Configuration Options", this opens the "Project Options" dialogue. In the section "General" there is a drop down list named "Active Configuration". Here you can select your board (see Boards and Modules).

Now click "Build" / "Build and Run" or type "Strg+F7" to build and flash the example.

The result files for the AvrStudio build are stored in the directory with the name of the selected configuration, e.g. in this case "rdk230".

Note:
  Not every example is available for every board, e.g. since the board tiny23x has no UART interface, the examples that requires a HIF are not available.

## Ioutils Examples

- xmpl_leds.c - Using the LED Macros
- xmpl_keys.c - Using the KEY Macros
- xmpl_key_events.c - Implementing Key Events
- xmpl_timer.c - Using the Timer Macros
- xmpl_hif.c - Using the Host Interface Functions
- xmpl_dbg.c - Using the Debug Pin Macros

## Transceiver Examples

- xmpl_trx_base.c - Using Basic Transceiver Access Functions
- xmpl_trx_tx.c - Transmitting Frames
- xmpl_trx_rx.c - Receiving Frames
- xmpl_trx_echo.c - Echo Frames
- xmpl_trx_txaret.c - Transmitting Frames with TX_ARET
- xmpl_trx_rxaack.c - Receiving Frames with RX_AACK

## Radio Examples

- Using the Radio Module
- xmpl_radio_range.c - Simple Range Test Application
- xmpl_linbuf_tx.c - Using Linear Buffers for Data Transmission
- xmpl_linbuf_rx.c - Using Linear Buffers for Data Reception
- xmpl_radio_stream.c - Using Radio Stream Functions

## Board Specfic Examples

LittleGee231

- xmpl_lgee_acc_simple.c - Printing Accelerometer Values to the Radio