xmpl_leds.c - Using the LED Macros

LED Macro Example

/* $Id: pgXmplLed.html,v 1.1.1.4 2013/04/09 21:12:16 awachtler Exp $ */
/* Example use of the LED macros */

#include "board.h"
#include "ioutil.h"
#include "xmpl.h"

#ifdef NO_LEDS
# error "No LED Interface defined"
#endif

int main(void)
{
    volatile uint8_t c,x;

    LED_INIT();

    /* step 1: test the LED_TOGGLE macro */
    LED_SET_VALUE(0);
    WAIT_MS(500);
    for (c=0; c<LED_NUMBER; c++)
    {
        for (x=0; x<16; x++)
        {
            LED_TOGGLE(c);
            WAIT_MS(100);
        }
    }

    /* step 2: set each individual LED to on */
    LED_SET_VALUE(0);
    WAIT_MS(500);
    for (c=0; c<LED_NUMBER; c++)
    {
        LED_SET(c);
        WAIT_MS(500);
    }

    /* step 3: set each individual LED to off */
    for (c=0; c<LED_NUMBER; c++)
    {
        LED_CLR(c);
        WAIT_MS(500);
    }

    /* step 4: dislay BCD coded numbers from 0 to LED_MAX_VALUE */
    LED_SET_VALUE(0);
    WAIT_MS(500);
    for (c=0; c<=LED_MAX_VALUE;c++)
    {
        LED_SET_VALUE(c);
        WAIT_MS(500);
    }

    /* step 5: terminate in endless blinking loop */
    do
    {
        LED_SET_VALUE(0x55);
        WAIT_MS(500);
        LED_SET_VALUE(0xaa);
        WAIT_MS(500);
    }while(1);
}
/* EOF */


This documentation for µracoli was generated on Tue Apr 9 2013 by  doxygen 1.7.1