X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/a2d18e46f8c30391cf3c06f1f93c50cb24d5e1ae..04b8360b15e3f1a78cb74e97b0c9acbb068f025a:/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h diff --git a/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h b/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h index 74a215b6c..f1e6da5f0 100644 --- a/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h +++ b/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h @@ -51,6 +51,7 @@ /* Includes: */ #include "../../../../Common/Common.h" #include "../../../Misc/AT45DB642D.h" + #include "../../../Peripheral/SerialSPI.h" /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_DATAFLASH_H) @@ -89,6 +90,8 @@ { DATAFLASH_CHIPCS_PORT.DIRSET = DATAFLASH_CHIPCS_MASK; DATAFLASH_CHIPCS_PORT.OUTSET = DATAFLASH_CHIPCS_MASK; + + PORTE.REMAP |= PORT_USART0_bm; } /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash. @@ -100,9 +103,7 @@ static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) { - // TODO: USART in SPI mode on PORT C - #warning The Dataflash driver for the selected board is currently incomplete and non-functional. - return 0; + return SerialSPI_TransferByte(&USARTE0, Byte); } /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. @@ -112,7 +113,7 @@ static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline void Dataflash_SendByte(const uint8_t Byte) { - return; // TODO + SerialSPI_SendByte(&USARTE0, Byte); } /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. @@ -122,7 +123,7 @@ static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; static inline uint8_t Dataflash_ReceiveByte(void) { - return 0; // TODO + return SerialSPI_ReceiveByte(&USARTE0); } /** Determines the currently selected dataflash chip. @@ -170,10 +171,7 @@ if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS)) return; - if (PageAddress & 0x01) - Dataflash_SelectChip(DATAFLASH_CHIP2); - else - Dataflash_SelectChip(DATAFLASH_CHIP1); + Dataflash_SelectChip(DATAFLASH_CHIP1); } /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive @@ -207,8 +205,6 @@ static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, const uint16_t BufferByte) { - PageAddress >>= 1; - Dataflash_SendByte(PageAddress >> 5); Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8)); Dataflash_SendByte(BufferByte);