From 0ad6f1fb530d2e5656ddd7824c97ee3a6b96f675 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 1 Nov 2011 06:06:41 +0000 Subject: Add partial support for the Atmel A3BU Xplained's Dataflash IC (physical USART-as-SPI transport driver still pending). --- LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'LUFA/Drivers/Board/AVR8/XPLAIN') diff --git a/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h b/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h index 42b9b77f5..71ff72b15 100644 --- a/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h +++ b/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h @@ -98,6 +98,38 @@ DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK; } + /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash. + * + * \param[in] Byte of data to send to the dataflash + * + * \return Last response byte from the dataflash + */ + 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(Byte); + } + + /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. + * + * \param[in] Byte of data to send to the dataflash + */ + static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; + static inline void Dataflash_SendByte(const uint8_t Byte) + { + SPI_SendByte(Byte); + } + + /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. + * + * \return Last response byte from the dataflash + */ + static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; + static inline uint8_t Dataflash_ReceiveByte(void) + { + return SPI_ReceiveByte(); + } + /** Determines the currently selected dataflash chip. * * \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected -- cgit v1.2.3