Added start of a port of the core USB driver code to the AVR32 UC3B architecture.
[pub/USBasp.git] / LUFA / Drivers / Board / EVK1101 / Buttons.h
index b827787..e76bc52 100644 (file)
@@ -1,21 +1,21 @@
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2010.\r
+     Copyright (C) Dean Camera, 2009.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
-  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 \r
-  Permission to use, copy, modify, distribute, and sell this \r
-  software and its documentation for any purpose is hereby granted\r
-  without fee, provided that the above copyright notice appear in \r
-  all copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting \r
-  documentation, and that the name of the author not be used in \r
-  advertising or publicity pertaining to distribution of the \r
+  Permission to use, copy, modify, and distribute this software\r
+  and its documentation for any purpose and without fee is hereby\r
+  granted, provided that the above copyright notice appear in all\r
+  copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting\r
+  documentation, and that the name of the author not be used in\r
+  advertising or publicity pertaining to distribution of the\r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
 */\r
 \r
 /** \file\r
- *\r
- *  Board specific Buttons driver header for the EVK1101.\r
+ *  \brief Board specific Buttons driver header for the Atmel EVK1101.\r
+ *  \copydetails Group_Buttons_EVK1101\r
  *\r
  *  \note This file should not be included directly. It is automatically included as needed by the Buttons driver\r
  *        dispatch header located in LUFA/Drivers/Board/Buttons.h.\r
  */\r
 \r
 /** \ingroup Group_Buttons\r
- *  @defgroup Group_Buttons_EVK1101 EVK1101\r
- *\r
- *  Board specific Buttons driver header for the EVK1101.\r
+ *  \defgroup Group_Buttons_EVK1101 EVK1101\r
+ *  \brief Board specific Buttons driver header for the Atmel EVK1101.\r
  *\r
- *  \note This file should not be included directly. It is automatically included as needed by the Buttons driver\r
- *        dispatch header located in LUFA/Drivers/Board/Buttons.h.\r
+ *  Board specific Buttons driver header for the Atmel EVK1101.\r
  *\r
  *  @{\r
  */\r
-\r
\r
 #ifndef __BUTTONS_EVK1101_H__\r
 #define __BUTTONS_EVK1101_H__\r
 \r
                #endif\r
 \r
        /* Preprocessor Checks: */\r
-               #if !defined(__INCLUDE_FROM_BUTTONS_H)\r
+               #if !defined(INCLUDE_FROM_BUTTONS_H)\r
                        #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.\r
                #endif\r
                \r
+       /* Private Interface - For use in library only: */\r
+       #if !defined(__DOXYGEN__)\r
+               /* Macros: */\r
+                       #define BUTTONS_PORT          1\r
+       #endif\r
+\r
        /* Public Interface - May be used in end-application: */\r
                /* Macros: */\r
-                       /** Button mask for the first button on the board. */\r
-                       #define BUTTONS_BUTTON1      (1UL << 2)\r
-       \r
-                       /** Button mask for the second button on the board. */\r
-                       #define BUTTONS_BUTTON2      (1UL << 3)\r
+                       /** Mask of the first button on the board */\r
+                       #define BUTTONS_BUTTON1       (1UL << 2)\r
+\r
+                       /** Mask of the second button on the board */\r
+                       #define BUTTONS_BUTTON2       (1UL << 3)\r
 \r
                /* Inline Functions: */\r
                #if !defined(__DOXYGEN__)\r
                        static inline void Buttons_Init(void)\r
                        {\r
-                               AVR32_GPIO.port[1].gpers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);\r
-                               AVR32_GPIO.port[1].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);\r
+                               AVR32_GPIO.port[BUTTONS_PORT].gpers  = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);\r
+                               AVR32_GPIO.port[BUTTONS_PORT].puers  = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);\r
                        }\r
 \r
-                       static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;\r
-                       static inline uint32_t Buttons_GetStatus(void)\r
+                       static inline uintN_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;\r
+                       static inline uintN_t Buttons_GetStatus(void)\r
                        {\r
-                               return (~AVR32_GPIO.port[1].pvr & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2));\r
+                               return (~(AVR32_GPIO.port[JOY_MOVE_PORT].pvr & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2)));\r
                        }\r
                #endif\r
 \r