Added Serial USART peripheral driver for the XMEGA platform.
Fix XMEGA SPI peripheral driver's incorrect const-ness on the SPI peripheral struct.
This commit is contained in:
parent
82fdedc192
commit
f45d60f768
7 changed files with 389 additions and 14 deletions
|
@ -163,7 +163,7 @@
|
|||
* \param[in] SPIOptions SPI Options, a mask consisting of one of each of the \c SPI_SPEED_*,
|
||||
* \c SPI_SCK_*, \c SPI_SAMPLE_*, \c SPI_ORDER_* and \c SPI_MODE_* masks.
|
||||
*/
|
||||
static inline void SPI_Init(const SPI_t* SPI,
|
||||
static inline void SPI_Init(SPI_t* const SPI,
|
||||
const uint8_t SPIOptions)
|
||||
{
|
||||
SPI->CTRL = (SPIOptions | SPI_ENABLE_bm);
|
||||
|
@ -171,21 +171,21 @@
|
|||
|
||||
/** Turns off the SPI driver, disabling and returning used hardware to their default configuration.
|
||||
*
|
||||
* \param[in, out] SPI Pointer to the base of the SPI peripheral within the device.
|
||||
* \param[in, out] SPI Pointer to the base of the SPI peripheral within the device.
|
||||
*/
|
||||
static inline void SPI_Disable(const SPI_t* SPI)
|
||||
static inline void SPI_Disable(SPI_t* const SPI)
|
||||
{
|
||||
SPI->CTRL &= ~SPI_ENABLE_bm;
|
||||
}
|
||||
|
||||
/** Retrieves the currently selected SPI mode, once the SPI interface has been configured.
|
||||
*
|
||||
* \param[in, out] SPI Pointer to the base of the SPI peripheral within the device.
|
||||
* \param[in, out] SPI Pointer to the base of the SPI peripheral within the device.
|
||||
*
|
||||
* \return \ref SPI_MODE_MASTER if the interface is currently in SPI Master mode, \ref SPI_MODE_SLAVE otherwise
|
||||
*/
|
||||
static inline uint8_t SPI_GetCurrentMode(const SPI_t* SPI) ATTR_ALWAYS_INLINE;
|
||||
static inline uint8_t SPI_GetCurrentMode(const SPI_t* SPI)
|
||||
static inline uint8_t SPI_GetCurrentMode(SPI_t* const SPI) ATTR_ALWAYS_INLINE;
|
||||
static inline uint8_t SPI_GetCurrentMode(SPI_t* const SPI)
|
||||
{
|
||||
return (SPI->CTRL & SPI_MASTER_bm);
|
||||
}
|
||||
|
@ -197,9 +197,9 @@
|
|||
*
|
||||
* \return Response byte from the attached SPI device.
|
||||
*/
|
||||
static inline uint8_t SPI_TransferByte(const SPI_t* SPI,
|
||||
static inline uint8_t SPI_TransferByte(SPI_t* const SPI,
|
||||
const uint8_t Byte) ATTR_ALWAYS_INLINE;
|
||||
static inline uint8_t SPI_TransferByte(const SPI_t* SPI,
|
||||
static inline uint8_t SPI_TransferByte(SPI_t* const SPI,
|
||||
const uint8_t Byte)
|
||||
{
|
||||
SPI->DATA = Byte;
|
||||
|
@ -213,9 +213,9 @@
|
|||
* \param[in, out] SPI Pointer to the base of the SPI peripheral within the device.
|
||||
* \param[in] Byte Byte to send through the SPI interface.
|
||||
*/
|
||||
static inline void SPI_SendByte(const SPI_t* SPI,
|
||||
static inline void SPI_SendByte(SPI_t* const SPI,
|
||||
const uint8_t Byte) ATTR_ALWAYS_INLINE;
|
||||
static inline void SPI_SendByte(const SPI_t* SPI,
|
||||
static inline void SPI_SendByte(SPI_t* const SPI,
|
||||
const uint8_t Byte)
|
||||
{
|
||||
SPI->DATA = Byte;
|
||||
|
@ -229,8 +229,8 @@
|
|||
*
|
||||
* \return The response byte from the attached SPI device.
|
||||
*/
|
||||
static inline uint8_t SPI_ReceiveByte(const SPI_t* SPI) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t SPI_ReceiveByte(const SPI_t* SPI)
|
||||
static inline uint8_t SPI_ReceiveByte(SPI_t* const SPI) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t SPI_ReceiveByte(SPI_t* const SPI)
|
||||
{
|
||||
SPI->DATA = 0;
|
||||
while (!(SPI->STATUS & SPI_IF_bm));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue