aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/Board/STK526
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-05-06 07:50:34 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-05-06 07:50:34 +0000
commit63a8f66d92b5d7018a4d962f4f7b23774a621771 (patch)
tree49359656bc06962f6508e5896551343842461e36 /LUFA/Drivers/Board/STK526
parentf11f69fd2989899b3088ea7d11b981f2d68c05e0 (diff)
downloadlufa-63a8f66d92b5d7018a4d962f4f7b23774a621771.tar.gz
lufa-63a8f66d92b5d7018a4d962f4f7b23774a621771.tar.bz2
lufa-63a8f66d92b5d7018a4d962f4f7b23774a621771.zip
Changed HWB board driver to Buttons driver, to allow for the support of future boards with more than one mounted GPIO button.
Diffstat (limited to 'LUFA/Drivers/Board/STK526')
-rw-r--r--LUFA/Drivers/Board/STK526/Buttons.h (renamed from LUFA/Drivers/Board/STK526/HWB.h)40
-rw-r--r--LUFA/Drivers/Board/STK526/Dataflash.h2
2 files changed, 26 insertions, 16 deletions
diff --git a/LUFA/Drivers/Board/STK526/HWB.h b/LUFA/Drivers/Board/STK526/Buttons.h
index 6f1861bc1..fba578cb2 100644
--- a/LUFA/Drivers/Board/STK526/HWB.h
+++ b/LUFA/Drivers/Board/STK526/Buttons.h
@@ -30,14 +30,20 @@
/** \file
*
- * Board specific HWB driver header for the STK526.
+ * 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_STK526_H__
-#define __HWB_STK526_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,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);
+ 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 (!(PIND & (1 << 7)));
+ return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
}
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#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.