aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/Peripheral/AVR8
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-02-23 03:51:17 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-02-23 03:51:17 +0000
commite11fddfe66fcd6fa5b783bb5f1c39dfb5687538d (patch)
tree22da0a1f9754ad8a475212c4cc1585f3ca94f990 /LUFA/Drivers/Peripheral/AVR8
parentc24027f3b5f1ca7bceababc82ea5b897b18dbac1 (diff)
downloadlufa-e11fddfe66fcd6fa5b783bb5f1c39dfb5687538d.tar.gz
lufa-e11fddfe66fcd6fa5b783bb5f1c39dfb5687538d.tar.bz2
lufa-e11fddfe66fcd6fa5b783bb5f1c39dfb5687538d.zip
Update Temperature board driver to be AVR32 compatible when the ADC peripheral driver is eventually ported. Make architecture includes explicit for both the AVR32 and the AVR8, to make way for future architecture ports.
Add SPI driver aliases for the old function names in the AVR8 driver, so that existing code will still compile against the new version.
Diffstat (limited to 'LUFA/Drivers/Peripheral/AVR8')
-rw-r--r--LUFA/Drivers/Peripheral/AVR8/ADC.h2
-rw-r--r--LUFA/Drivers/Peripheral/AVR8/SPI.h37
-rw-r--r--LUFA/Drivers/Peripheral/AVR8/TWI.h2
3 files changed, 26 insertions, 15 deletions
diff --git a/LUFA/Drivers/Peripheral/AVR8/ADC.h b/LUFA/Drivers/Peripheral/AVR8/ADC.h
index 06f9d3b28..eac7f9fb5 100644
--- a/LUFA/Drivers/Peripheral/AVR8/ADC.h
+++ b/LUFA/Drivers/Peripheral/AVR8/ADC.h
@@ -51,8 +51,6 @@
#define __ADC_AVR8_H__
/* Includes: */
- #include "../../../Common/Common.h"
-
#include <avr/io.h>
#include <stdbool.h>
diff --git a/LUFA/Drivers/Peripheral/AVR8/SPI.h b/LUFA/Drivers/Peripheral/AVR8/SPI.h
index f466162be..42ff8e7c3 100644
--- a/LUFA/Drivers/Peripheral/AVR8/SPI.h
+++ b/LUFA/Drivers/Peripheral/AVR8/SPI.h
@@ -118,7 +118,7 @@
* \param[in] SPIOptions SPI Options, a mask consisting of one of each of the SPI_SPEED_*,
* SPI_SCK_*, SPI_SAMPLE_* and SPI_MODE_* masks
*/
- static inline void SPI_Init(const uint8_t SPIOptions)
+ static inline void SPI_Init(const uintN_t SPIOptions)
{
DDRB |= ((1 << 1) | (1 << 2));
PORTB |= ((1 << 0) | (1 << 3));
@@ -143,14 +143,14 @@
/** Sends and receives a byte through the SPI interface, blocking until the transfer is complete.
*
- * \param[in] Byte Byte to send through the SPI interface
+ * \param[in] Data Byte to send through the SPI interface
*
* \return Response byte from the attached SPI device
*/
- static inline uint8_t SPI_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
- static inline uint8_t SPI_TransferByte(const uint8_t Byte)
+ static inline uint8_t SPI_Transfer(const uint8_t Data) ATTR_ALWAYS_INLINE;
+ static inline uint8_t SPI_Transfer(const uint8_t Data)
{
- SPDR = Byte;
+ SPDR = Data;
while (!(SPSR & (1 << SPIF)));
return SPDR;
}
@@ -158,12 +158,12 @@
/** Sends a byte through the SPI interface, blocking until the transfer is complete. The response
* byte sent to from the attached SPI device is ignored.
*
- * \param[in] Byte Byte to send through the SPI interface
+ * \param[in] Data Byte to send through the SPI interface
*/
- static inline void SPI_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
- static inline void SPI_SendByte(const uint8_t Byte)
+ static inline void SPI_Send(const uint8_t Data) ATTR_ALWAYS_INLINE;
+ static inline void SPI_Send(const uint8_t Data)
{
- SPDR = Byte;
+ SPDR = Data;
while (!(SPSR & (1 << SPIF)));
}
@@ -172,13 +172,28 @@
*
* \return The response byte from the attached SPI device
*/
- static inline uint8_t SPI_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
- static inline uint8_t SPI_ReceiveByte(void)
+ static inline uint8_t SPI_Receive(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
+ static inline uint8_t SPI_Receive(void)
{
SPDR = 0x00;
while (!(SPSR & (1 << SPIF)));
return SPDR;
}
+
+ #if defined(__DOXYGEN__)
+ /** Alias for \ref SPI_Transfer(), for compatibility with legacy LUFA applications. */
+ static inline uint8_t SPI_TransferByte(const uint8_t Byte) ATTR_DEPRECATED;
+
+ /** Alias for \ref SPI_Send(), for compatibility with legacy LUFA applications. */
+ static inline void SPI_SendByte(const uint8_t Byte) ATTR_DEPRECATED;
+
+ /** Alias for \ref SPI_Receive(), for compatibility with legacy LUFA applications. */
+ static inline uint8_t SPI_ReceiveByte(void) ATTR_DEPRECATED;
+ #else
+ #define SPI_TransferByte(x) SPI_Transfer(x)
+ #define SPI_SendByte(x) SPI_Send(x)
+ #define SPI_ReceiveByte() SPI_Receive()
+ #endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
diff --git a/LUFA/Drivers/Peripheral/AVR8/TWI.h b/LUFA/Drivers/Peripheral/AVR8/TWI.h
index d169b8230..43f70d9ac 100644
--- a/LUFA/Drivers/Peripheral/AVR8/TWI.h
+++ b/LUFA/Drivers/Peripheral/AVR8/TWI.h
@@ -51,8 +51,6 @@
#define __TWI_AVR8_H__
/* Includes: */
- #include "../../../Common/Common.h"
-
#include <avr/io.h>
#include <stdbool.h>
#include <util/twi.h>