3      Copyright (C) Dean Camera, 2012. 
   5   dean [at] fourwalledcubicle [dot] com 
  10   Copyright 2012  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 disclaim 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 Buttons driver header for the Micropendous series boards. 
  33  *  \copydetails Group_Buttons_MICROPENDOUS_32U2 
  35  *  \note This file should not be included directly. It is automatically included as needed by the Buttons driver 
  36  *        dispatch header located in LUFA/Drivers/Board/Buttons.h. 
  39 /** \ingroup Group_Buttons 
  40  *  \defgroup Group_Buttons_MICROPENDOUS_A MICROPENDOUS_A 
  41  *  \brief Board specific Button driver header for the Micropendous A (https://code.google.com/p/micropendous/wiki/MicropendousA). 
  43  *  See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. 
  46 /** \ingroup Group_Buttons 
  47  *  \defgroup Group_Buttons_MICROPENDOUS_1 MICROPENDOUS_1 
  48  *  \brief Board specific Button driver header for the Micropendous 1 (https://code.google.com/p/micropendous/wiki/Micropendous1). 
  50  *  See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. 
  53 /** \ingroup Group_Buttons 
  54  *  \defgroup Group_Buttons_MICROPENDOUS_2 MICROPENDOUS_2 
  55  *  \brief Board specific Button driver header for the Micropendous 2 (https://code.google.com/p/micropendous/wiki/Micropendous2). 
  57  *  See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. 
  60 /** \ingroup Group_Buttons 
  61  *  \defgroup Group_Buttons_MICROPENDOUS_3 MICROPENDOUS_3 
  62  *  \brief Board specific Button driver header for the Micropendous 3 (https://code.google.com/p/micropendous/wiki/Micropendous3). 
  64  *  See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. 
  67 /** \ingroup Group_Buttons 
  68  *  \defgroup Group_Buttons_MICROPENDOUS_4 MICROPENDOUS_4 
  69  *  \brief Board specific Button driver header for the Micropendous 4 (https://code.google.com/p/micropendous/wiki/Micropendous4). 
  71  *  See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. 
  74 /** \ingroup Group_Buttons 
  75  *  \defgroup Group_Buttons_MICROPENDOUS_DIP MICROPENDOUS_DIP 
  76  *  \brief Board specific Button driver header for the Micropendous DIP (https://code.google.com/p/micropendous/wiki/MicropendousDIP). 
  78  *  See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. 
  81 /** \ingroup Group_Buttons 
  82  *  \defgroup Group_Buttons_MICROPENDOUS_REV1 MICROPENDOUS_REV1 
  83  *  \brief Board specific Button driver header for the Micropendous Arduino-like Revision 1 (https://code.google.com/p/micropendous/wiki/Micropendous). 
  85  *  See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. 
  88 /** \ingroup Group_Buttons 
  89  *  \defgroup Group_Buttons_MICROPENDOUS_REV2 MICROPENDOUS_REV2 
  90  *  \brief Board specific Button driver header for the Micropendous Arduino-like Revision 2 (https://code.google.com/p/micropendous/wiki/Micropendous). 
  92  *  See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. 
  95 /** \ingroup Group_Buttons 
  96  *  \defgroup Group_Buttons_MICROPENDOUS_32U2 MICROPENDOUS_32U2 
  97  *  \brief Board specific Buttons driver header for the Micropendous 32U2. 
  99  *  \note There are multiple supported Micropendous boards, compile with <code>BOARD = MICROPENDOUS_{VERSION}</code>. 
 101  *  Board specific Buttons driver header for the Micropendous 32U2 (https://code.google.com/p/micropendous/wiki/Micropendous_32U2). 
 103  *  <b>BOARD_MICROPENDOUS_1 and BOARD_MICROPENDOUS_32U2</b>: 
 105  *    <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr> 
 106  *    <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr> 
 109  *  <b>Other Revisions</b>: 
 111  *    <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr> 
 112  *    <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr> 
 118 #ifndef __BUTTONS_MICROPENDOUS_H__ 
 119 #define __BUTTONS_MICROPENDOUS_H__ 
 122                 #include "../../../../Common/Common.h" 
 124         /* Enable C linkage for C++ Compilers: */ 
 125                 #if defined(__cplusplus) 
 129         /* Preprocessor Checks: */ 
 130                 #if !defined(__INCLUDE_FROM_BUTTONS_H) 
 131                         #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. 
 134         /* Private Interface - For use in library only: */ 
 135         #if !defined(__DOXYGEN__) 
 136                 #if (BOARD == BOARD_MICROPENDOUS_32U2) 
 137                         #define _BOARD_BUTTON1_MASK             (1 << 7) 
 138                         #define _BOARD_BUTTON_PORTLETTER        D 
 139                 #elif (BOARD == BOARD_MICROPENDOUS_A) 
 140                         #define _BOARD_BUTTON1_MASK             (1 << 2) 
 141                         #define _BOARD_BUTTON_PORTLETTER        E 
 142                 #elif (BOARD == BOARD_MICROPENDOUS_1) 
 143                         #define _BOARD_BUTTON1_MASK             (1 << 7) 
 144                         #define _BOARD_BUTTON_PORTLETTER        D 
 145                 #elif (BOARD == BOARD_MICROPENDOUS_2) 
 146                         #define _BOARD_BUTTON1_MASK             (1 << 2) 
 147                         #define _BOARD_BUTTON_PORTLETTER        E 
 148                 #elif (BOARD == BOARD_MICROPENDOUS_3) 
 149                         #define _BOARD_BUTTON1_MASK             (1 << 2) 
 150                         #define _BOARD_BUTTON_PORTLETTER        E 
 151                 #elif (BOARD == BOARD_MICROPENDOUS_4) 
 152                         #define _BOARD_BUTTON1_MASK             (1 << 2) 
 153                         #define _BOARD_BUTTON_PORTLETTER        E 
 154                 #elif (BOARD == BOARD_MICROPENDOUS_DIP) 
 155                         #define _BOARD_BUTTON1_MASK             (1 << 2) 
 156                         #define _BOARD_BUTTON_PORTLETTER        E 
 157                 #elif (BOARD == BOARD_MICROPENDOUS_REV1) 
 158                         #define _BOARD_BUTTON1_MASK             (1 << 2) 
 159                         #define _BOARD_BUTTON_PORTLETTER        E 
 160                 #elif (BOARD == BOARD_MICROPENDOUS_REV2) 
 161                         #define _BOARD_BUTTON1_MASK             (1 << 2) 
 162                         #define _BOARD_BUTTON_PORTLETTER        E 
 165                 #define _BOARD_BUTTON_CONCAT2(Reg, Letter)  Reg ## Letter 
 166                 #define _BOARD_BUTTON_CONCAT(Reg, Letter)   _BOARD_BUTTON_CONCAT2(Reg, Letter) 
 168                 #define _BOARD_BUTTON_PORT                 _BOARD_BUTTON_CONCAT(PORT, _BOARD_BUTTON_PORTLETTER) 
 169                 #define _BOARD_BUTTON_PIN                  _BOARD_BUTTON_CONCAT(PIN,  _BOARD_BUTTON_PORTLETTER) 
 170                 #define _BOARD_BUTTON_DDR                  _BOARD_BUTTON_CONCAT(DDR,  _BOARD_BUTTON_PORTLETTER) 
 173         /* Public Interface - May be used in end-application: */ 
 175                         /** Button mask for the first button on the board. */ 
 176                         #define BUTTONS_BUTTON1                _BOARD_BUTTON1_MASK 
 178                 /* Inline Functions: */ 
 179                 #if !defined(__DOXYGEN__) 
 180                         static inline void Buttons_Init(void) 
 182                                 _BOARD_BUTTON_DDR  
&= ~BUTTONS_BUTTON1
; 
 183                                 _BOARD_BUTTON_PORT 
|=  BUTTONS_BUTTON1
; 
 186                         static inline void Buttons_Disable(void) 
 188                                 _BOARD_BUTTON_DDR  
&= ~BUTTONS_BUTTON1
; 
 189                                 _BOARD_BUTTON_PORT 
&= ~BUTTONS_BUTTON1
; 
 192                         static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT
; 
 193                         static inline uint8_t Buttons_GetStatus(void) 
 195                                 return ((_BOARD_BUTTON_PIN 
& BUTTONS_BUTTON1
) ^ BUTTONS_BUTTON1
); 
 199         /* Disable C linkage for C++ Compilers: */ 
 200                 #if defined(__cplusplus)