diff options
Diffstat (limited to 'LUFA/Drivers/Peripheral/AVR8')
-rw-r--r-- | LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h | 6 | ||||
-rw-r--r-- | LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c | 1 | ||||
-rw-r--r-- | LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c | 21 | ||||
-rw-r--r-- | LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h | 12 |
6 files changed, 31 insertions, 29 deletions
diff --git a/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h b/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h index a0e9a87a3..fe0173057 100644 --- a/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h +++ b/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h @@ -104,7 +104,7 @@ #define _ADC_GET_MUX_MASK2(y) ADC_CHANNEL ## y #define _ADC_GET_MUX_MASK(y) _ADC_GET_MUX_MASK2(y) #endif - + /* Public Interface - May be used in end-application: */ /* Macros: */ /** \name ADC Reference Configuration Masks */ @@ -118,7 +118,7 @@ /** Reference mask, for using the internally generated 2.56V reference voltage as the ADC reference. */ #define ADC_REFERENCE_INT2560MV ((1 << REFS1) | (1 << REFS0)) //@} - + /** \name ADC Result Adjustment Configuration Masks */ //@{ /** Left-adjusts the 10-bit ADC result, so that the upper 8 bits of the value returned by the @@ -144,7 +144,7 @@ */ #define ADC_SINGLE_CONVERSION (0 << ADATE) //@} - + /** \name ADC Prescaler Configuration Masks */ //@{ /** Sets the ADC input clock to prescale by a factor of 2 the AVR's system clock. */ diff --git a/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h b/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h index 48b8740fe..d6dc248f7 100644 --- a/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h +++ b/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h @@ -70,7 +70,7 @@ * // Send a byte, and store the received byte from the same transaction * uint8_t ResponseByte = SPI_TransferByte(0xDC); * \endcode - * + * * @{ */ @@ -139,7 +139,7 @@ /** SPI data sample mode mask for \c SPI_Init(). Indicates that the data should be sampled on the trailing edge. */ #define SPI_SAMPLE_TRAILING (1 << CPHA) //@} - + /** \name SPI Data Ordering Configuration Masks */ //@{ /** SPI data order mask for \c SPI_Init(). Indicates that data should be shifted out MSB first. */ @@ -148,7 +148,7 @@ /** SPI data order mask for \c SPI_Init(). Indicates that data should be shifted out LSB first. */ #define SPI_ORDER_LSB_FIRST (1 << DORD) //@} - + /** \name SPI Mode Configuration Masks */ //@{ /** SPI mode mask for \c SPI_Init(). Indicates that the SPI interface should be initialized into slave mode. */ @@ -157,7 +157,7 @@ /** SPI mode mask for \c SPI_Init(). Indicates that the SPI interface should be initialized into master mode. */ #define SPI_MODE_MASTER (1 << MSTR) //@} - + /* Inline Functions: */ /** Initializes the SPI subsystem, ready for transfers. Must be called before calling any other * SPI routines. @@ -195,7 +195,7 @@ SPCR = 0; SPSR = 0; } - + /** Retrieves the currently selected SPI mode, once the SPI interface has been configured. * * \return \ref SPI_MODE_MASTER if the interface is currently in SPI Master mode, \ref SPI_MODE_SLAVE otherwise diff --git a/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c b/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c index 7b7f5d61f..70f9f5853 100644 --- a/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c +++ b/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c @@ -87,3 +87,4 @@ void Serial_SendData(const uint8_t* Buffer, uint16_t Length) while (Length--) Serial_SendByte(*(Buffer++)); } + diff --git a/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h b/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h index 639b3c3b4..55e18f9f2 100644 --- a/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h +++ b/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h @@ -70,7 +70,7 @@ /* Includes: */ #include "../../../Common/Common.h" #include "../../Misc/TerminalCodes.h" - + #include <stdio.h> /* Enable C linkage for C++ Compilers: */ @@ -87,7 +87,7 @@ #if !defined(__DOXYGEN__) /* External Variables: */ extern FILE USARTSerialStream; - + /* Function Prototypes: */ int Serial_putchar(char DataByte, FILE *Stream); @@ -127,7 +127,7 @@ * \param[in] StringPtr Pointer to a string located in SRAM space. */ void Serial_SendString(const char* StringPtr) ATTR_NON_NULL_PTR_ARG(1); - + /** Transmits a given buffer located in SRAM memory through the USART. * * \param[in] Buffer Pointer to a buffer containing the data to send. @@ -190,7 +190,7 @@ stdin = Stream; stdout = Stream; } - + *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar, _FDEV_SETUP_RW); } @@ -244,7 +244,7 @@ { if (!(Serial_IsCharReceived())) return -1; - + return UDR1; } diff --git a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c index d6db37d6e..b77aa0822 100644 --- a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c +++ b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c @@ -119,9 +119,9 @@ bool TWI_ReceiveByte(uint8_t* const Byte, TWCR = TWCRMask; while (!(TWCR & (1 << TWINT))); *Byte = TWDR; - + uint8_t Status = (TWSR & TW_STATUS_MASK); - + return ((LastByte) ? (Status == TW_MR_DATA_NACK) : (Status == TW_MR_DATA_ACK)); } @@ -133,19 +133,19 @@ uint8_t TWI_ReadPacket(const uint8_t SlaveAddress, uint8_t Length) { uint8_t ErrorCode; - + if ((ErrorCode = TWI_StartTransmission((SlaveAddress & TWI_DEVICE_ADDRESS_MASK) | TWI_ADDRESS_WRITE, TimeoutMS)) == TWI_ERROR_NoError) { while (InternalAddressLen--) { if (!(TWI_SendByte(*(InternalAddress++)))) - { + { ErrorCode = TWI_ERROR_SlaveNAK; break; } } - + if ((ErrorCode = TWI_StartTransmission((SlaveAddress & TWI_DEVICE_ADDRESS_MASK) | TWI_ADDRESS_READ, TimeoutMS)) == TWI_ERROR_NoError) { @@ -157,11 +157,11 @@ uint8_t TWI_ReadPacket(const uint8_t SlaveAddress, break; } } - + TWI_StopTransmission(); } } - + return ErrorCode; } @@ -180,7 +180,7 @@ uint8_t TWI_WritePacket(const uint8_t SlaveAddress, while (InternalAddressLen--) { if (!(TWI_SendByte(*(InternalAddress++)))) - { + { ErrorCode = TWI_ERROR_SlaveNAK; break; } @@ -194,9 +194,10 @@ uint8_t TWI_WritePacket(const uint8_t SlaveAddress, break; } } - + TWI_StopTransmission(); } - + return ErrorCode; } + diff --git a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h index 5a6c2966a..75dffb585 100644 --- a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h +++ b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h @@ -88,7 +88,7 @@ * } * } * \endcode - * + * * <b>High Level API Example:</b> * \code * // Initialize the TWI driver before first use at 200KHz @@ -154,10 +154,10 @@ * or \ref TWI_ADDRESS_WRITE to obtain the device's read and write address respectively. */ #define TWI_DEVICE_ADDRESS_MASK 0xFE - + /** Bit length prescaler for \ref TWI_Init(). This mask multiplies the TWI bit length prescaler by 1. */ #define TWI_BIT_PRESCALE_1 ((0 << TWPS1) | (0 << TWPS0)) - + /** Bit length prescaler for \ref TWI_Init(). This mask multiplies the TWI bit length prescaler by 4. */ #define TWI_BIT_PRESCALE_4 ((0 << TWPS1) | (1 << TWPS0)) @@ -166,7 +166,7 @@ /** Bit length prescaler for \ref TWI_Init(). This mask multiplies the TWI bit length prescaler by 64. */ #define TWI_BIT_PRESCALE_64 ((1 << TWPS1) | (1 << TWPS0)) - + /** Calculates the length of each bit on the TWI bus for a given target frequency. This may be used with * the \ref TWI_Init() function to convert a bus frequency to a number of clocks for the \c BitLength * parameter. @@ -189,7 +189,7 @@ TWI_ERROR_SlaveNotReady = 4, /**< Slave NAKed the TWI bus START condition. */ TWI_ERROR_SlaveNAK = 5, /**< Slave NAKed whilst attempting to send data to the device. */ }; - + /* Inline Functions: */ /** Initializes the TWI hardware into master mode, ready for data transmission and reception. This must be * before any other TWI operations. @@ -256,7 +256,7 @@ const bool LastByte) ATTR_NON_NULL_PTR_ARG(1); bool TWI_ReceiveByte(uint8_t* const Byte, const bool LastByte); - + /** High level function to perform a complete packet transfer over the TWI bus to the specified * device. * |