X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/deed746d3716d59153e04860c646bfb7b82ca820..ccc82ce74598a00bf484cdec3e186af609efcc50:/LUFA/Drivers/Peripheral/SPI.h diff --git a/LUFA/Drivers/Peripheral/SPI.h b/LUFA/Drivers/Peripheral/SPI.h index d66e9fe24..8c38dcc27 100644 --- a/LUFA/Drivers/Peripheral/SPI.h +++ b/LUFA/Drivers/Peripheral/SPI.h @@ -99,7 +99,13 @@ /** SPI data sample mode mask for SPI_Init(). Indicates that the data should be sampled on the trailing edge. */ #define SPI_SAMPLE_TRAILING (1 << CPHA) - + + /** SPI data order mask for SPI_Init(). Indicates that data should be shifted out MSB first. */ + #define SPI_ORDER_MSB_FIRST (0 << DORD) + + /** SPI data order mask for SPI_Init(). Indicates that data should be shifted out MSB first. */ + #define SPI_ORDER_LSB_FIRST (1 << DORD) + /** SPI mode mask for SPI_Init(). Indicates that the SPI interface should be initialized into slave mode. */ #define SPI_MODE_SLAVE (0 << MSTR) @@ -107,15 +113,16 @@ #define SPI_MODE_MASTER (1 << MSTR) /* Inline Functions: */ - /** Initializes the SPI subsystem, ready for transfers. Must be called before calling any other + /** Initialises the SPI subsystem, ready for transfers. Must be called before calling any other * SPI routines. * * \param[in] SPIOptions SPI Options, a mask consisting of one of each of the SPI_SPEED_*, - * SPI_SCK_*, SPI_SAMPLE_* and SPI_MODE_* masks. + * SPI_SCK_*, SPI_SAMPLE_*, SPI_ORDER_* and SPI_MODE_* masks. */ static inline void SPI_Init(const uint8_t SPIOptions) { DDRB |= ((1 << 1) | (1 << 2)); + DDRB &= ((1 << 0) | (1 << 3)); PORTB |= ((1 << 0) | (1 << 3)); SPCR = ((1 << SPE) | SPIOptions);