X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/f201f6697b7f99b63389509b42112026b8f6f76f..e368a899871fe9ecccdcac85019d15c73e13ced7:/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h diff --git a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h index 1665fa4b1..d5119eb5c 100644 --- a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h +++ b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h @@ -1,24 +1,24 @@ /* LUFA Library - Copyright (C) Dean Camera, 2011. + Copyright (C) Dean Camera, 2014. dean [at] fourwalledcubicle [dot] com - www.fourwalledcubicle.com + www.lufa-lib.org */ /* - Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that the copyright notice and this + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. - The author disclaim all warranties with regard to this + The author disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, indirect or consequential damages or any damages @@ -42,6 +42,13 @@ * * Board specific Buttons driver header for the Atmel XMEGA A3BU Xplained. * + * + * + * + * + * + *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1SW0 ButtonLowPORTE.5
BUTTONS_BUTTON2SW1 ButtonLowPORTF.1
BUTTONS_BUTTON3SW2 ButtonLowPORTF.2
+ * * @{ */ @@ -76,18 +83,28 @@ #if !defined(__DOXYGEN__) static inline void Buttons_Init(void) { - PORTE_OUTCLR = BUTTONS_BUTTON1; - PORTF_OUTCLR = (BUTTONS_BUTTON2 | BUTTONS_BUTTON3); + PORTE.OUTCLR = BUTTONS_BUTTON1; + PORTE.PIN5CTRL = (PORT_OPC_PULLUP_gc | PORT_INVEN_bm); + + PORTF.OUTCLR = (BUTTONS_BUTTON2 | BUTTONS_BUTTON3); + PORTF.PIN1CTRL = (PORT_OPC_PULLUP_gc | PORT_INVEN_bm); + PORTF.PIN2CTRL = (PORT_OPC_PULLUP_gc | PORT_INVEN_bm); + } + + static inline void Buttons_Disable(void) + { + PORTE.OUTCLR = BUTTONS_BUTTON1; + PORTE.PIN5CTRL = 0; - PORTE_PIN5CTRL = PORT_OPC_PULLUP_gc; - PORTF_PIN1CTRL = PORT_OPC_PULLUP_gc; - PORTF_PIN2CTRL = PORT_OPC_PULLUP_gc; + PORTF.OUTCLR = (BUTTONS_BUTTON2 | BUTTONS_BUTTON3); + PORTF.PIN1CTRL = 0; + PORTF.PIN2CTRL = 0; } static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) { - return ((~PORTE_IN & BUTTONS_BUTTON1) | (~PORTF_IN & (BUTTONS_BUTTON2 | BUTTONS_BUTTON3))); + return ((PORTE_IN & BUTTONS_BUTTON1) | (PORTF_IN & (BUTTONS_BUTTON2 | BUTTONS_BUTTON3))); } #endif