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.

This commit is contained in:
Dean Camera 2012-02-09 20:26:13 +00:00
parent 7a1033025b
commit a2d18e46f8
7 changed files with 292 additions and 54 deletions

View file

@ -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

View file

@ -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.

View file

@ -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