Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
/** \ingroup Group_SerialSPI
* \defgroup Group_SerialSPI_AVR8 Master SPI Mode Serial USART Peripheral Driver (AVR8)
*
/** \ingroup Group_SerialSPI
* \defgroup Group_SerialSPI_AVR8 Master SPI Mode Serial USART Peripheral Driver (AVR8)
*
* On-chip serial USART driver for the 8-bit AVR8 microcontrollers.
*
* \note This file should not be included directly. It is automatically included as needed by the SPI Master
* driver dispatch header located in LUFA/Drivers/Peripheral/SerialSPI.h.
*
* On-chip serial USART driver for the 8-bit AVR8 microcontrollers.
*
* \note This file should not be included directly. It is automatically included as needed by the SPI Master
* driver dispatch header located in LUFA/Drivers/Peripheral/SerialSPI.h.
*
* The following snippet is an example of how this module may be used within a typical
* application.
*
* \code
* // Initialize the Master SPI mode USART driver before first use, with 1Mbit baud
* The following snippet is an example of how this module may be used within a typical
* application.
*
* \code
* // Initialize the Master SPI mode USART driver before first use, with 1Mbit baud
* // Send several bytes, ignoring the returned data
* SerialSPI_SendByte(0x01);
* SerialSPI_SendByte(0x02);
* SerialSPI_SendByte(0x03);
* // Send several bytes, ignoring the returned data
* SerialSPI_SendByte(0x01);
* SerialSPI_SendByte(0x02);
* SerialSPI_SendByte(0x03);
* // Receive several bytes, sending a dummy 0x00 byte each time
* uint8_t Byte1 = SerialSPI_ReceiveByte();
* uint8_t Byte2 = SerialSPI_ReceiveByte();
* uint8_t Byte3 = SerialSPI_ReceiveByte();
* // Receive several bytes, sending a dummy 0x00 byte each time
* uint8_t Byte1 = SerialSPI_ReceiveByte();
* uint8_t Byte2 = SerialSPI_ReceiveByte();
* uint8_t Byte3 = SerialSPI_ReceiveByte();
* // Send a byte, and store the received byte from the same transaction
* uint8_t ResponseByte = SerialSPI_TransferByte(0xDC);
* \endcode
* // Send a byte, and store the received byte from the same transaction
* uint8_t ResponseByte = SerialSPI_TransferByte(0xDC);
* \endcode
- #if !defined(__DOXYGEN__)
- #define SERIAL_SPI_UBBRVAL(Baud) ((Baud < (F_CPU / 2)) ? ((F_CPU / (2 * Baud)) - 1) : 0)
- #endif
+ #if !defined(__DOXYGEN__)
+ #define SERIAL_SPI_UBBRVAL(Baud) ((Baud < (F_CPU / 2)) ? ((F_CPU / (2 * Baud)) - 1) : 0)
+
+ /* Master USART SPI mode flag definitions missing in the AVR8 toolchain */
+ #if !defined(UCPHA1)
+ #define UCPHA1 1
+ #endif
+ #if !defined(UDORD1)
+ #define UDORD1 2
+ #endif
+ #endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** \name SPI SCK Polarity Configuration Masks */
/* Public Interface - May be used in end-application: */
/* Macros: */
/** \name SPI SCK Polarity Configuration Masks */
*
* \param[in] SPIOptions USART SPI Options, a mask consisting of one of each of the \c USART_SPI_SCK_*,
* \c USART_SPI_SAMPLE_* and \c USART_SPI_ORDER_* masks.
*
* \param[in] SPIOptions USART SPI Options, a mask consisting of one of each of the \c USART_SPI_SCK_*,
* \c USART_SPI_SAMPLE_* and \c USART_SPI_ORDER_* masks.
/** Sends and receives a byte through the USART SPI interface, blocking until the transfer is complete.
*
* \param[in] DataByte Byte to send through the USART SPI interface.
/** Sends and receives a byte through the USART SPI interface, blocking until the transfer is complete.
*
* \param[in] DataByte Byte to send through the USART SPI interface.