1 /* This source file is part of the ATMEL FREERTOS-0.9.0 Release */
\r
3 /*This file has been prepared for Doxygen automatic documentation generation.*/
\r
4 /*! \file *********************************************************************
\r
6 * \brief FreeRTOS Led Driver example for AVR32 UC3.
\r
8 * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
\r
9 * - Supported devices: All AVR32 devices can be used.
\r
12 * \author Atmel Corporation: http://www.atmel.com \n
\r
13 * Support email: avr32@atmel.com
\r
15 *****************************************************************************/
\r
17 /* Copyright (c) 2007, Atmel Corporation All rights reserved.
\r
19 * Redistribution and use in source and binary forms, with or without
\r
20 * modification, are permitted provided that the following conditions are met:
\r
22 * 1. Redistributions of source code must retain the above copyright notice,
\r
23 * this list of conditions and the following disclaimer.
\r
25 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
26 * this list of conditions and the following disclaimer in the documentation
\r
27 * and/or other materials provided with the distribution.
\r
29 * 3. The name of ATMEL may not be used to endorse or promote products derived
\r
30 * from this software without specific prior written permission.
\r
32 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
\r
33 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
34 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
\r
35 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
\r
36 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
\r
37 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
\r
38 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
\r
39 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
\r
41 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
46 # include <avr32/io.h>
\r
48 # include <avr32/iouc3a0512.h>
\r
50 # error Unknown compiler
\r
53 #include "FreeRTOS.h"
\r
55 #include "partest.h"
\r
58 /*-----------------------------------------------------------
\r
59 * Simple parallel port IO routines.
\r
60 *-----------------------------------------------------------*/
\r
62 #define partstALL_OUTPUTS_OFF ( ( unsigned portCHAR ) 0x00 )
\r
63 #define partstMAX_OUTPUT_LED ( ( unsigned portCHAR ) 8 )
\r
65 static volatile unsigned portCHAR ucCurrentOutputValue = partstALL_OUTPUTS_OFF; /*lint !e956 File scope parameters okay here. */
\r
67 /*-----------------------------------------------------------*/
\r
69 void vParTestInitialise( void )
\r
71 LED_Display(partstALL_OUTPUTS_OFF); /* Start with all LEDs off. */
\r
73 /*-----------------------------------------------------------*/
\r
75 void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
\r
77 unsigned portCHAR ucBit;
\r
79 if( uxLED >= partstMAX_OUTPUT_LED )
\r
84 ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
\r
88 if( xValue == pdTRUE )
\r
90 ucCurrentOutputValue |= ucBit;
\r
94 ucCurrentOutputValue &= ~ucBit;
\r
97 LED_Display(ucCurrentOutputValue);
\r
101 /*-----------------------------------------------------------*/
\r
103 void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
\r
105 unsigned portCHAR ucBit;
\r
107 if( uxLED >= partstMAX_OUTPUT_LED )
\r
112 ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
\r
116 ucCurrentOutputValue ^= ucBit;
\r
117 LED_Display(ucCurrentOutputValue);
\r