63 #define SPI_PCS(npcs) ((~(1 << (npcs)) & 0xF) << 16) 66 #define SPI_SCBR(baudrate, masterClock) ((uint32_t) ((masterClock) / (baudrate)) << 8) 69 #define SPI_DLYBS(delay, masterClock) ((uint32_t) ((((masterClock) / 1000000) * (delay)) / 1000) << 16) 72 #define SPI_DLYBCT(delay, masterClock) ((uint32_t) ((((masterClock) / 1000000) * (delay)) / 32000) << 24) 89 extern void SPI_Configure(
Spi* spi, uint32_t dwId, uint32_t dwConfiguration ) ;
93 extern void SPI_Write(
Spi* spi, uint32_t dwNpcs, uint16_t wData ) ;
98 #if (defined _SAM3S_) || (defined _SAM3S8_) || (defined _SAM3N_) 99 extern void SPI_PdcEnableTx(
Spi* spi ) ;
100 extern void SPI_PdcDisableTx(
Spi* spi ) ;
101 extern void SPI_PdcEnableRx(
Spi* spi ) ;
102 extern void SPI_PdcDisableRx(
Spi* spi ) ;
104 extern void SPI_PdcSetTx(
Spi* spi,
void* pvTxBuf, uint32_t dwTxCount,
void* pvTxNextBuf, uint32_t dwTxNextCount ) ;
105 extern void SPI_PdcSetRx(
Spi* spi,
void* pvRxBuf, uint32_t dwRxCount,
void* pvRxNextBuf, uint32_t dwRxNextCount ) ;
107 extern uint32_t SPI_WriteBuffer(
Spi* spi,
void* pvBuffer, uint32_t dwLength ) ;
109 extern uint32_t SPI_ReadBuffer(
Spi* spi,
void* pvBuffer, uint32_t dwLength ) ;
void SPI_DisableIt(Spi *spi, uint32_t dwSources)
Disables one or more interrupt sources of a SPI peripheral.
Definition: spi.c:116
void SPI_EnableIt(Spi *spi, uint32_t dwSources)
Enables one or more interrupt sources of a SPI peripheral.
Definition: spi.c:105
void SPI_ConfigureNPCS(Spi *spi, uint32_t dwNpcs, uint32_t dwConfiguration)
Configures a chip select of a SPI peripheral. The chip select configuration is computed using several...
Definition: spi.c:149
uint32_t SPI_IsFinished(Spi *pSpi)
Check if SPI transfer finish.
Definition: spi.c:206
uint32_t SPI_GetStatus(Spi *spi)
Get the current status register of the given SPI peripheral.
Definition: spi.c:161
Spi hardware registers.
Definition: component_spi.h:41
uint32_t SPI_Read(Spi *spi)
Reads and returns the last word of data received by a SPI peripheral. This method must be called afte...
Definition: spi.c:174
void SPI_Configure(Spi *spi, uint32_t dwId, uint32_t dwConfiguration)
Configures a SPI peripheral as specified. The configuration can be computed using several macros (see...
Definition: spi.c:129
void SPI_Disable(Spi *spi)
Disables a SPI peripheral.
Definition: spi.c:94
void SPI_Enable(Spi *spi)
Enables a SPI peripheral.
Definition: spi.c:84
void SPI_Write(Spi *spi, uint32_t dwNpcs, uint16_t wData)
Sends data through a SPI peripheral. If the SPI is configured to use a fixed peripheral select...
Definition: spi.c:190