aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2012-02-09 20:26:13 +0000
committerDean Camera <dean@fourwalledcubicle.com>2012-02-09 20:26:13 +0000
commita2d18e46f8c30391cf3c06f1f93c50cb24d5e1ae (patch)
tree81ca60b2e50350d0058967948a58d196ab9c4abd /LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED
parent7a1033025bbf0dcf4e4dc770fccb4edea86144a4 (diff)
downloadlufa-a2d18e46f8c30391cf3c06f1f93c50cb24d5e1ae.tar.gz
lufa-a2d18e46f8c30391cf3c06f1f93c50cb24d5e1ae.tar.bz2
lufa-a2d18e46f8c30391cf3c06f1f93c50cb24d5e1ae.zip
Update XMEGA board drivers to use the port inversion feature of the XMEGA architecture rather than performing the inversion in software. Add partially completed XMEGA-B1-XPLAINED Dataflash board driver and revert implementation of the XMEGA-A3BU-XPLAINED Dataflash driver as the chip is connected to the USART, not the SPI interface.
Diffstat (limited to 'LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED')
-rw-r--r--LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h24
-rw-r--r--LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h22
-rw-r--r--LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h20
3 files changed, 37 insertions, 29 deletions
diff --git a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h
index 738279123..d4e208407 100644
--- a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h
+++ b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h
@@ -76,28 +76,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);
- 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 = (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;
- PORTF_OUTCLR = (BUTTONS_BUTTON2 | BUTTONS_BUTTON3);
-
- PORTE_PIN5CTRL = 0;
- PORTF_PIN1CTRL = 0;
- PORTF_PIN2CTRL = 0;
+ PORTE.OUTCLR = BUTTONS_BUTTON1;
+ PORTE.PIN5CTRL = 0;
+
+ 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
diff --git a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
index 9eb3b38ea..c263853ee 100644
--- a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
+++ b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
@@ -29,24 +29,24 @@
*/
/** \file
- * \brief Board specific Dataflash driver header for the Atmel XMEGA A3BU Xplained.
- * \copydetails Group_Dataflash_A3BU_XPLAINED
+ * \brief Board specific Dataflash driver header for the Atmel XMEGA B1 Xplained.
+ * \copydetails Group_Dataflash_B1_XPLAINED
*
* \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.
*/
/** \ingroup Group_Dataflash
- * \defgroup Group_Dataflash_A3BU_XPLAINED A3BU_XPLAINED
- * \brief Board specific Dataflash driver header for the Atmel XMEGA A3BU Xplained.
+ * \defgroup Group_Dataflash_B1_XPLAINED B1_XPLAINED
+ * \brief Board specific Dataflash driver header for the Atmel XMEGA B1 Xplained.
*
- * Board specific Dataflash driver header for the Atmel XMEGA A3BU Xplained board.
+ * Board specific Dataflash driver header for the Atmel XMEGA B1 Xplained board.
*
* @{
*/
-#ifndef __DATAFLASH_A3BU_XPLAINED_H__
-#define __DATAFLASH_A3BU_XPLAINED_H__
+#ifndef __DATAFLASH_B1_XPLAINED_H__
+#define __DATAFLASH_B1_XPLAINED_H__
/* Includes: */
#include "../../../../Common/Common.h"
@@ -100,7 +100,9 @@
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte)
{
- return SPI_TransferByte(&SPID, Byte);
+ // TODO: USART in SPI mode on PORT D
+ #warning The Dataflash driver for the selected board is currently incomplete and non-functional.
+ return 0;
}
/** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash.
@@ -110,7 +112,7 @@
static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Dataflash_SendByte(const uint8_t Byte)
{
- SPI_SendByte(&SPID, Byte);
+ return; // TODO
}
/** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash.
@@ -120,7 +122,7 @@
static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Dataflash_ReceiveByte(void)
{
- return SPI_ReceiveByte(&SPID);
+ return 0; // TODO
}
/** Determines the currently selected dataflash chip.
diff --git a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h
index fdc2a4141..6212c9aed 100644
--- a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h
+++ b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h
@@ -79,24 +79,30 @@
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
{
- PORTR_DIRSET = LEDS_ALL_LEDS;
- PORTR_OUTSET = LEDS_ALL_LEDS;
+ PORTR.DIRSET = LEDS_ALL_LEDS;
+ PORTR.OUTCLR = LEDS_ALL_LEDS;
+
+ PORTCFG.MPCMASK = LEDS_ALL_LEDS;
+ PORTR.PIN0CTRL = PORT_INVEN_bm;
}
static inline void LEDs_Disable(void)
{
- PORTR_DIRCLR = LEDS_ALL_LEDS;
- PORTR_OUTCLR = LEDS_ALL_LEDS;
+ PORTR.DIRCLR = LEDS_ALL_LEDS;
+ PORTR.OUTCLR = LEDS_ALL_LEDS;
+
+ PORTCFG.MPCMASK = 0;
+ PORTR.PIN0CTRL = LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
- PORTR_OUTCLR = LEDMask;
+ PORTR_OUTSET = LEDMask;
}
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
{
- PORTR_OUTSET = LEDMask;
+ PORTR_OUTCLR = LEDMask;
}
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
@@ -117,7 +123,7 @@
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
- return (~PORTR_OUT & LEDS_ALL_LEDS);
+ return (PORTR_OUT & LEDS_ALL_LEDS);
}
#endif