diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-07-22 15:38:12 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-07-22 15:38:12 +0000 |
commit | 9b0e4b8356eb79003a806d010f4b00123350ed90 (patch) | |
tree | bf3c74f3cf45da2990995252dd74226fe793d755 /LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h | |
parent | 2461ae508c32914ff8aa0920ed99d4fceb18b141 (diff) | |
download | lufa-9b0e4b8356eb79003a806d010f4b00123350ed90.tar.gz lufa-9b0e4b8356eb79003a806d010f4b00123350ed90.tar.bz2 lufa-9b0e4b8356eb79003a806d010f4b00123350ed90.zip |
Convert over internal pseudo-function macros to true inline functions for added type-safety and compile-checking.
Diffstat (limited to 'LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h')
-rw-r--r-- | LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h b/LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h index 8b289fb66..e2c3d6a10 100644 --- a/LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h +++ b/LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h @@ -70,24 +70,27 @@ #endif /* Public Interface - May be used in end-application: */ - /* Pseudo-Function Macros: */ - #if defined(__DOXYGEN__) - /** Initializes the TWI hardware into master mode, ready for data transmission and reception. This must be - * before any other TWI operations. - */ - static inline void TWI_Init(void); - - /** Turns off the TWI driver hardware. If this is called, any further TWI operations will require a call to - * \ref TWI_Init() before the TWI can be used again. - */ - static inline void TWI_ShutDown(void); - #else - #define TWI_Init() MACROS{ TWCR |= (1 << TWEN); }MACROE - #define TWI_ShutDown() MACROS{ TWCR &= ~(1 << TWEN); }MACROE - #endif - /* Inline Functions: */ + /** Initializes the TWI hardware into master mode, ready for data transmission and reception. This must be + * before any other TWI operations. + */ + static inline void TWI_Init(void) ATTR_ALWAYS_INLINE; + static inline void TWI_Init(void) + { + TWCR |= (1 << TWEN); + } + + /** Turns off the TWI driver hardware. If this is called, any further TWI operations will require a call to + * \ref TWI_Init() before the TWI can be used again. + */ + static inline void TWI_ShutDown(void) ATTR_ALWAYS_INLINE; + static inline void TWI_ShutDown(void) + { + TWCR &= ~(1 << TWEN); + } + /** Sends a TWI STOP onto the TWI bus, terminating communication with the currently addressed device. */ + static inline void TWI_StopTransmission(void) ATTR_ALWAYS_INLINE; static inline void TWI_StopTransmission(void) { TWCR = ((1 << TWINT) | (1 << TWSTO) | (1 << TWEN)); |