aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers
diff options
context:
space:
mode:
Diffstat (limited to 'LUFA/Drivers')
-rw-r--r--LUFA/Drivers/Board/ATAVRUSBRF01/Buttons.h (renamed from LUFA/Drivers/Board/USBKEY/HWB.h)30
-rw-r--r--LUFA/Drivers/Board/Buttons.h (renamed from LUFA/Drivers/Board/HWB.h)44
-rw-r--r--LUFA/Drivers/Board/STK525/Buttons.h (renamed from LUFA/Drivers/Board/STK526/HWB.h)40
-rw-r--r--LUFA/Drivers/Board/STK525/Dataflash.h2
-rw-r--r--LUFA/Drivers/Board/STK526/Buttons.h (renamed from LUFA/Drivers/Board/STK525/HWB.h)39
-rw-r--r--LUFA/Drivers/Board/STK526/Dataflash.h2
-rw-r--r--LUFA/Drivers/Board/USBKEY/Buttons.h (renamed from LUFA/Drivers/Board/ATAVRUSBRF01/HWB.h)30
-rw-r--r--LUFA/Drivers/Board/USBKEY/Dataflash.h2
8 files changed, 108 insertions, 81 deletions
diff --git a/LUFA/Drivers/Board/USBKEY/HWB.h b/LUFA/Drivers/Board/ATAVRUSBRF01/Buttons.h
index 13af186a0..29cc4e362 100644
--- a/LUFA/Drivers/Board/USBKEY/HWB.h
+++ b/LUFA/Drivers/Board/ATAVRUSBRF01/Buttons.h
@@ -30,14 +30,14 @@
/** \file
*
- * Board specific HWB driver header for the USBKEY.
+ * Board specific Buttons driver header for the ATAVRUSBRF01.
*
- * \note This file should not be included directly. It is automatically included as needed by the HWB driver
- * dispatch header located in LUFA/Drivers/Board/HWB.h.
+ * \note This file should not be included directly. It is automatically included as needed by the Buttons driver
+ * dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
-#ifndef __HWB_USBKEY_H__
-#define __HWB_USBKEY_H__
+#ifndef __BUTTONS_ATAVRUSBRF01_H__
+#define __BUTTONS_ATAVRUSBRF01_H__
/* Includes: */
#include <avr/io.h>
@@ -51,23 +51,27 @@
#endif
/* Preprocessor Checks: */
- #if !defined(INCLUDE_FROM_HWB_H)
- #error Do not include this file directly. Include LUFA/Drivers/Board/HWB.h instead.
+ #if !defined(INCLUDE_FROM_BUTTONS_H)
+ #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
/* Public Interface - May be used in end-application: */
+ /* Macros: */
+ /** Button mask for the first button on the board. */
+ #define BUTTONS_BUTTON1 (1 << 7)
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
- static inline void HWB_Init(void)
+ static inline void Buttons_Init(void)
{
- DDRE &= ~(1 << 2);
- PORTE |= (1 << 2);
+ DDRD &= ~BUTTONS_BUTTON1;
+ PORTD |= BUTTONS_BUTTON1;
}
- static inline bool HWB_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
- static inline bool HWB_GetStatus(void)
+ static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
+ static inline uint8_t Buttons_GetStatus(void)
{
- return (!(PINE & (1 << 2)));
+ return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
}
#endif
diff --git a/LUFA/Drivers/Board/HWB.h b/LUFA/Drivers/Board/Buttons.h
index f6221afd3..46d147345 100644
--- a/LUFA/Drivers/Board/HWB.h
+++ b/LUFA/Drivers/Board/Buttons.h
@@ -30,25 +30,25 @@
/** \file
*
- * This file is the master dispatch header file for the board-specific HWB driver, for boards containing a
- * physical pushbutton connected to the AVR's HWB IO pin.
+ * This file is the master dispatch header file for the board-specific Buttons driver, for boards containing
+ * physical pushbuttons connected to the AVR's GPIO pins.
*
- * User code should include this file, which will in turn include the correct HWB driver header file for the
+ * User code should include this file, which will in turn include the correct Button driver header file for the
* currently selected board.
*
- * If the BOARD value is set to BOARD_USER, this will include the /Board/HWB.h file in the user project
+ * If the BOARD value is set to BOARD_USER, this will include the /Board/Buttons.h file in the user project
* directory.
*/
/** \ingroup Group_BoardDrivers
- * @defgroup Group_HWB HWB Driver - LUFA/Drivers/Board/HWB.h
+ * @defgroup Group_Buttons Buttons Driver - LUFA/Drivers/Board/Buttons.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - None
*
* \section Module Description
- * Functions, macros, variables, enums and types related to the control of board HWB.
+ * Functions, macros, variables, enums and types related to the control of physical board GPIO buttons.
*
* If the BOARD value is set to BOARD_USER, this will include the /Board/Dataflash.h file in the user project
* directory. Otherwise, it will include the appropriate built in board driver header file.
@@ -56,12 +56,12 @@
* @{
*/
-#ifndef __HWB_H__
-#define __HWB_H__
+#ifndef __BUTTONS_H__
+#define __BUTTONS_H__
/* Macros: */
#if !defined(__DOXYGEN__)
- #define INCLUDE_FROM_HWB_H
+ #define INCLUDE_FROM_BUTTONS_H
#define INCLUDE_FROM_BOARD_DRIVER
#endif
@@ -71,33 +71,33 @@
#if !defined(BOARD)
#error BOARD must be set in makefile to a value specified in BoardTypes.h.
#elif (BOARD == BOARD_USBKEY)
- #include "USBKEY/HWB.h"
+ #include "USBKEY/BUTTONS.h"
#elif (BOARD == BOARD_STK525)
- #include "STK525/HWB.h"
+ #include "STK525/BUTTONS.h"
#elif (BOARD == BOARD_STK526)
- #include "STK526/HWB.h"
+ #include "STK526/BUTTONS.h"
#elif (BOARD == BOARD_ATAVRUSBRF01)
- #include "ATAVRUSBRF01/HWB.h"
+ #include "ATAVRUSBRF01/BUTTONS.h"
#elif (BOARD == BOARD_USER)
- #include "Board/HWB.h"
+ #include "Board/BUTTONS.h"
#else
- #error The selected board does not contain a HWB.
+ #error The selected board does not contain any GPIO buttons.
#endif
/* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__)
- /** Initializes the HWB driver, so that the current button position can be read. This sets the appropriate
- * I/O pin to an input with pull-up enabled.
+ /** Initializes the BUTTONS driver, so that the current button position can be read. This sets the appropriate
+ * I/O pins to an inputs with pull-ups enabled.
*
- * This must be called before any HWB functions are used.
+ * This must be called before any Button driver functions are used.
*/
- static inline void HWB_Init(void);
+ static inline void Buttons_Init(void);
- /** Returns the current position of the HWB button on the board.
+ /** Returns a mask indicating which board buttons are currently pressed.
*
- * \return Boolean true if the button is currently pressed, false otherwise
+ * \return Mask indicating which board buttons are currently pressed
*/
- static inline bool HWB_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
+ static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
#endif
#endif
diff --git a/LUFA/Drivers/Board/STK526/HWB.h b/LUFA/Drivers/Board/STK525/Buttons.h
index 6f1861bc1..dc7aca733 100644
--- a/LUFA/Drivers/Board/STK526/HWB.h
+++ b/LUFA/Drivers/Board/STK525/Buttons.h
@@ -30,14 +30,20 @@
/** \file
*
- * Board specific HWB driver header for the STK526.
+ * Board specific Buttons driver header for the STK525.
*
- * \note This file should not be included directly. It is automatically included as needed by the HWB driver
- * dispatch header located in LUFA/Drivers/Board/HWB.h.
+ * \note This file should not be included directly. It is automatically included as needed by the Buttons driver
+ * dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
-#ifndef __HWB_STK526_H__
-#define __HWB_STK526_H__
+#ifndef __BUTTONS_STK525_H__
+#define __BUTTONS_STK525_H__
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <stdbool.h>
+
+ #include "../../../Common/Common.h"
/* Includes: */
#include <avr/io.h>
@@ -51,29 +57,33 @@
#endif
/* Preprocessor Checks: */
- #if !defined(INCLUDE_FROM_HWB_H)
- #error Do not include this file directly. Include LUFA/Drivers/Board/HWB.h instead.
+ #if !defined(INCLUDE_FROM_BUTTONS_H)
+ #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
/* Public Interface - May be used in end-application: */
+ /* Macros: */
+ /** Button mask for the first button on the board. */
+ #define BUTTONS_BUTTON1 (1 << 2)
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
- static inline void HWB_Init(void)
+ static inline void Buttons_Init(void)
{
- DDRD &= ~(1 << 7);
- PORTD |= (1 << 7);
+ DDRE &= ~BUTTONS_BUTTON1;
+ PORTE |= BUTTONS_BUTTON1;
}
- static inline bool HWB_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
- static inline bool HWB_GetStatus(void)
+ static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
+ static inline uint8_t Buttons_GetStatus(void)
{
- return (!(PIND & (1 << 7)));
+ return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
}
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
diff --git a/LUFA/Drivers/Board/STK525/Dataflash.h b/LUFA/Drivers/Board/STK525/Dataflash.h
index b2ea1b8e9..bc9ab9fbd 100644
--- a/LUFA/Drivers/Board/STK525/Dataflash.h
+++ b/LUFA/Drivers/Board/STK525/Dataflash.h
@@ -30,7 +30,7 @@
/** \file
*
- * Board specific HWB driver header for the STK525.
+ * Board specific Dataflash driver header for the STK525.
*
* \note This file should not be included directly. It is automatically included as needed by the dataflash driver
* dispatch header located in LUFA/Drivers/Board/Dataflash.h.
diff --git a/LUFA/Drivers/Board/STK525/HWB.h b/LUFA/Drivers/Board/STK526/Buttons.h
index 2200453ee..fba578cb2 100644
--- a/LUFA/Drivers/Board/STK525/HWB.h
+++ b/LUFA/Drivers/Board/STK526/Buttons.h
@@ -30,14 +30,20 @@
/** \file
*
- * Board specific HWB driver header for the STK525.
+ * Board specific Buttons driver header for the STK526.
*
- * \note This file should not be included directly. It is automatically included as needed by the HWB driver
- * dispatch header located in LUFA/Drivers/Board/HWB.h.
+ * \note This file should not be included directly. It is automatically included as needed by the Buttons driver
+ * dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
-#ifndef __HWB_STK525_H__
-#define __HWB_STK525_H__
+#ifndef __BUTTONS_STK526_H__
+#define __BUTTONS_STK526_H__
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <stdbool.h>
+
+ #include "../../../Common/Common.h"
/* Includes: */
#include <avr/io.h>
@@ -51,23 +57,27 @@
#endif
/* Preprocessor Checks: */
- #if !defined(INCLUDE_FROM_HWB_H)
- #error Do not include this file directly. Include LUFA/Drivers/Board/HWB.h instead.
+ #if !defined(INCLUDE_FROM_BUTTONS_H)
+ #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
/* Public Interface - May be used in end-application: */
+ /* Macros: */
+ /** Button mask for the first button on the board. */
+ #define BUTTONS_BUTTON1 (1 << 2)
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
- static inline void HWB_Init(void)
+ static inline void Buttons_Init(void)
{
- DDRE &= ~(1 << 2);
- PORTE |= (1 << 2);
+ DDRD &= ~BUTTONS_BUTTON1;
+ PORTD |= BUTTONS_BUTTON1;
}
- static inline bool HWB_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
- static inline bool HWB_GetStatus(void)
+ static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
+ static inline uint8_t Buttons_GetStatus(void)
{
- return (!(PINE & (1 << 2)));
+ return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
}
#endif
@@ -75,6 +85,5 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
-
diff --git a/LUFA/Drivers/Board/STK526/Dataflash.h b/LUFA/Drivers/Board/STK526/Dataflash.h
index 65c5e202c..cb8193e56 100644
--- a/LUFA/Drivers/Board/STK526/Dataflash.h
+++ b/LUFA/Drivers/Board/STK526/Dataflash.h
@@ -30,7 +30,7 @@
/** \file
*
- * Board specific HWB driver header for the STK525.
+ * Board specific Dataflash driver header for the STK525.
*
* \note This file should not be included directly. It is automatically included as needed by the dataflash driver
* dispatch header located in LUFA/Drivers/Board/Dataflash.h.
diff --git a/LUFA/Drivers/Board/ATAVRUSBRF01/HWB.h b/LUFA/Drivers/Board/USBKEY/Buttons.h
index 87426de16..78c5b5662 100644
--- a/LUFA/Drivers/Board/ATAVRUSBRF01/HWB.h
+++ b/LUFA/Drivers/Board/USBKEY/Buttons.h
@@ -30,14 +30,14 @@
/** \file
*
- * Board specific HWB driver header for the ATAVRUSBRF01.
+ * Board specific Buttons driver header for the USBKEY.
*
- * \note This file should not be included directly. It is automatically included as needed by the HWB driver
- * dispatch header located in LUFA/Drivers/Board/HWB.h.
+ * \note This file should not be included directly. It is automatically included as needed by the Buttons driver
+ * dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
-#ifndef __HWB_ATAVRUSBRF01_H__
-#define __HWB_ATAVRUSBRF01_H__
+#ifndef __BUTTONS_USBKEY_H__
+#define __BUTTONS_USBKEY_H__
/* Includes: */
#include <avr/io.h>
@@ -51,23 +51,27 @@
#endif
/* Preprocessor Checks: */
- #if !defined(INCLUDE_FROM_HWB_H)
- #error Do not include this file directly. Include LUFA/Drivers/Board/HWB.h instead.
+ #if !defined(INCLUDE_FROM_BUTTONS_H)
+ #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
/* Public Interface - May be used in end-application: */
+ /* Macros: */
+ /** Button mask for the first button on the board. */
+ #define BUTTONS_BUTTON1 (1 << 2)
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
- static inline void HWB_Init(void)
+ static inline void Buttons_Init(void)
{
- DDRD &= ~(1 << 7);
- PORTD |= (1 << 7);
+ DDRE &= ~BUTTONS_BUTTON1;
+ PORTE |= BUTTONS_BUTTON1;
}
- static inline bool HWB_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
- static inline bool HWB_GetStatus(void)
+ static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
+ static inline uint8_t Buttons_GetStatus(void)
{
- return (!(PIND & (1 << 7)));
+ return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
}
#endif
diff --git a/LUFA/Drivers/Board/USBKEY/Dataflash.h b/LUFA/Drivers/Board/USBKEY/Dataflash.h
index cae62fd49..d4bfdc943 100644
--- a/LUFA/Drivers/Board/USBKEY/Dataflash.h
+++ b/LUFA/Drivers/Board/USBKEY/Dataflash.h
@@ -30,7 +30,7 @@
/** \file
*
- * Board specific HWB driver header for the STK525.
+ * Board specific Dataflash driver header for the STK525.
*
* \note This file should not be included directly. It is automatically included as needed by the dataflash driver
* dispatch header located in LUFA/Drivers/Board/Dataflash.h.