3      Copyright (C) Dean Camera, 2014. 
   5   dean [at] fourwalledcubicle [dot] com 
  10   Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, distribute, and sell this 
  13   software and its documentation for any purpose is hereby granted 
  14   without fee, provided that the above copyright notice appear in 
  15   all copies and that both that the copyright notice and this 
  16   permission notice and warranty disclaimer appear in supporting 
  17   documentation, and that the name of the author not be used in 
  18   advertising or publicity pertaining to distribution of the 
  19   software without specific, written prior permission. 
  21   The author disclaims all warranties with regard to this 
  22   software, including all implied warranties of merchantability 
  23   and fitness.  In no event shall the author be liable for any 
  24   special, indirect or consequential damages or any damages 
  25   whatsoever resulting from loss of use, data or profits, whether 
  26   in an action of contract, negligence or other tortious action, 
  27   arising out of or in connection with the use or performance of 
  32  *  \brief Board specific LED driver header for the Atmel UC3-A3 Xplained. 
  33  *  \copydetails Group_LEDs_UC3A3_XPLAINED 
  35  *  \note This file should not be included directly. It is automatically included as needed by the LEDs driver 
  36  *        dispatch header located in LUFA/Drivers/Board/LEDs.h. 
  39 /** \ingroup Group_LEDs 
  40  *  \defgroup Group_LEDs_UC3A3_XPLAINED UC3A3_XPLAINED 
  41  *  \brief Board specific LED driver header for the Atmel UC3-A3 Xplained. 
  43  *  Board specific LED driver header for the Atmel UC3-A3 Xplained. 
  46  *    <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr> 
  47  *    <tr><td>LEDS_LED1</td><td>Yellow</td><td>LED0 LED</td><td>Low</td><td>GPIO35</td></tr> 
  48  *    <tr><td>LEDS_LED2</td><td>Yellow</td><td>LED1 LED</td><td>Low</td><td>GPIO73</td></tr> 
  49  *    <tr><td>LEDS_LED3</td><td>Yellow</td><td>LED2 LED</td><td>Low</td><td>GPIO34</td></tr> 
  50  *    <tr><td>LEDS_LED4</td><td>Yellow</td><td>LED3 LED</td><td>Low</td><td>GPIO38</td></tr> 
  51  *    <tr><td>LEDS_LED5</td><td>Green</td><td>Status</td><td>Low</td><td>GPIO50</td></tr> 
  52  *    <tr><td>LEDS_LED6</td><td>Red</td><td>Power</td><td>High</td><td>GPIO49</td></tr> 
  58 #ifndef __LEDS_UC3A3_XPLAINED_H__ 
  59 #define __LEDS_UC3A3_XPLAINED_H__ 
  62                 #include "../../../../Common/Common.h" 
  64         /* Enable C linkage for C++ Compilers: */ 
  65                 #if defined(__cplusplus) 
  69         /* Preprocessor Checks: */ 
  70                 #if !defined(__INCLUDE_FROM_LEDS_H) 
  71                         #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. 
  74         /* Private Interface - For use in library only: */ 
  75         #if !defined(__DOXYGEN__) 
  77                         #define LEDS_LEDMASK1   ((1UL << 3) | (1UL << 2) | (1UL << 6) | (1UL << 18) | (1UL << 17)) 
  78                         #define LEDS_LEDMASK3    (1UL << 9) 
  81         /* Public Interface - May be used in end-application: */ 
  83                         /** LED mask for the first LED on the board. */ 
  84                         #define LEDS_LED1        (1UL << 3) 
  86                         /** LED mask for the second LED on the board. */ 
  87                         #define LEDS_LED2        (1UL << 9) 
  89                         /** LED mask for the third LED on the board. */ 
  90                         #define LEDS_LED3        (1UL << 2) 
  92                         /** LED mask for the fourth LED on the board. */ 
  93                         #define LEDS_LED4        (1UL << 6) 
  95                         /** LED mask for the fifth LED on the board. */ 
  96                         #define LEDS_LED5        (1UL << 18) 
  98                         /** LED mask for the sixth LED on the board. */ 
  99                         #define LEDS_LED6        (1UL << 17) 
 101                         /** LED mask for all the LEDs on the board. */ 
 102                         #define LEDS_ALL_LEDS    (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4 | LEDS_LED5 | LEDS_LED6) 
 104                         /** LED mask for the none of the board LEDs */ 
 105                         #define LEDS_NO_LEDS     0 
 107                 /* Inline Functions: */ 
 108                 #if !defined(__DOXYGEN__) 
 109                         static inline void LEDs_Init(void) 
 111                                 AVR32_GPIO
.port
[1].gpers 
= LEDS_LEDMASK1
; 
 112                                 AVR32_GPIO
.port
[1].oders 
= LEDS_LEDMASK1
; 
 113                                 AVR32_GPIO
.port
[1].ovrs  
= LEDS_LEDMASK1
; 
 115                                 AVR32_GPIO
.port
[3].gpers 
= LEDS_LEDMASK3
; 
 116                                 AVR32_GPIO
.port
[3].oders 
= LEDS_LEDMASK3
; 
 117                                 AVR32_GPIO
.port
[3].ovrs  
= LEDS_LEDMASK3
; 
 120                         static inline void LEDs_Disable(void) 
 122                                 AVR32_GPIO
.port
[1].gperc 
= LEDS_LEDMASK1
; 
 123                                 AVR32_GPIO
.port
[1].oderc 
= LEDS_LEDMASK1
; 
 124                                 AVR32_GPIO
.port
[1].ovrc  
= LEDS_LEDMASK1
; 
 126                                 AVR32_GPIO
.port
[3].gperc 
= LEDS_LEDMASK3
; 
 127                                 AVR32_GPIO
.port
[3].oderc 
= LEDS_LEDMASK3
; 
 128                                 AVR32_GPIO
.port
[3].ovrc  
= LEDS_LEDMASK3
; 
 131                         static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask
) 
 133                                 AVR32_GPIO
.port
[1].ovrc  
= (LEDMask 
& LEDS_LEDMASK1
); 
 134                                 AVR32_GPIO
.port
[3].ovrc  
= (LEDMask 
& LEDS_LEDMASK3
); 
 137                         static inline void LEDs_TurnOffLEDs(const uint32_t LEDMask
) 
 139                                 AVR32_GPIO
.port
[1].ovrs  
= (LEDMask 
& LEDS_LEDMASK1
); 
 140                                 AVR32_GPIO
.port
[3].ovrs  
= (LEDMask 
& LEDS_LEDMASK3
); 
 143                         static inline void LEDs_SetAllLEDs(const uint32_t LEDMask
) 
 145                                 AVR32_GPIO
.port
[1].ovrs  
= LEDS_LEDMASK1
; 
 146                                 AVR32_GPIO
.port
[1].ovrc  
= (LEDMask 
& LEDS_LEDMASK1
); 
 148                                 AVR32_GPIO
.port
[3].ovrs  
= LEDS_LEDMASK3
; 
 149                                 AVR32_GPIO
.port
[3].ovrc  
= (LEDMask 
& LEDS_LEDMASK3
); 
 152                         static inline void LEDs_ChangeLEDs(const uint32_t LEDMask
, const uint32_t ActiveMask
) 
 154                                 AVR32_GPIO
.port
[1].ovrs  
= (LEDMask    
& LEDS_LEDMASK1
); 
 155                                 AVR32_GPIO
.port
[1].ovrc  
= (ActiveMask 
& LEDS_LEDMASK1
); 
 157                                 AVR32_GPIO
.port
[3].ovrs  
= (LEDMask    
& LEDS_LEDMASK3
); 
 158                                 AVR32_GPIO
.port
[3].ovrc  
= (ActiveMask 
& LEDS_LEDMASK3
); 
 161                         static inline void LEDs_ToggleLEDs(const uint32_t LEDMask
) 
 163                                 AVR32_GPIO
.port
[1].ovrt  
= (LEDMask 
& LEDS_LEDMASK1
); 
 164                                 AVR32_GPIO
.port
[3].ovrt  
= (LEDMask 
& LEDS_LEDMASK3
); 
 167                         static inline uint32_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT
; 
 168                         static inline uint32_t LEDs_GetLEDs(void) 
 170                                 return ((~AVR32_GPIO
.port
[1].ovr 
& LEDS_LEDMASK1
) | (~AVR32_GPIO
.port
[3].ovr 
& LEDS_LEDMASK3
)); 
 174         /* Disable C linkage for C++ Compilers: */ 
 175                 #if defined(__cplusplus)