PSoC 6 Peripheral Driver Library

General Description

Functions

__STATIC_INLINE uint32_t Cy_SCB_SPI_Read (CySCB_Type const *base)
 Reads a single data element from the SPI RX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_SPI_ReadArray (CySCB_Type const *base, void *buffer, uint32_t size)
 Reads an array of data out of the SPI RX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_SPI_Write (CySCB_Type *base, uint32_t data)
 Places a single data element in the SPI TX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_SPI_WriteArray (CySCB_Type *base, void *buffer, uint32_t size)
 Places an array of data in the SPI TX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_SPI_WriteArrayBlocking (CySCB_Type *base, void *buffer, uint32_t size)
 Places an array of data in the SPI TX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_SPI_GetTxFifoStatus (CySCB_Type const *base)
 Returns the current status of the TX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_SPI_ClearTxFifoStatus (CySCB_Type *base, uint32_t clearMask)
 Clears the selected statuses of the TX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_SPI_GetRxFifoStatus (CySCB_Type const *base)
 Returns the current status of the RX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_SPI_ClearRxFifoStatus (CySCB_Type *base, uint32_t clearMask)
 Clears the selected statuses of the RX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_SPI_GetSlaveMasterStatus (CySCB_Type const *base)
 Returns the current status of either the slave or the master, depending on the configured SPI mode. More...
 
__STATIC_INLINE void Cy_SCB_SPI_ClearSlaveMasterStatus (CySCB_Type *base, uint32_t clearMask)
 Clears the selected statuses of either the slave or the master. More...
 
__STATIC_INLINE uint32_t Cy_SCB_SPI_GetNumInTxFifo (CySCB_Type const *base)
 Returns the number of data elements in the SPI TX FIFO. More...
 
__STATIC_INLINE bool Cy_SCB_SPI_IsTxComplete (CySCB_Type const *base)
 Checks whether the TX FIFO and Shifter are empty and there is no more data to send. More...
 
__STATIC_INLINE uint32_t Cy_SCB_SPI_GetNumInRxFifo (CySCB_Type const *base)
 Returns the number of data elements in the SPI RX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_SPI_ClearRxFifo (CySCB_Type *base)
 Clears all data out of the SPI RX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_SPI_ClearTxFifo (CySCB_Type *base)
 Clears all data out of the SPI TX FIFO. More...
 

Function Documentation

◆ Cy_SCB_SPI_Read()

__STATIC_INLINE uint32_t Cy_SCB_SPI_Read ( CySCB_Type const *  base)

Reads a single data element from the SPI RX FIFO.

This function does not check whether the RX FIFO has data before reading it. If the RX FIFO is empty, the function returns CY_SCB_SPI_RX_NO_DATA.

Parameters
baseThe pointer to the SPI SCB instance.
Returns
Data from the RX FIFO. The data element size is defined by the configured RX data width.
Note
  • This function only reads data available in the RX FIFO. It does not initiate an SPI transfer.
  • When in the master mode, this function writes data into the TX FIFO and waits until the transfer is completed before reading data from the RX FIFO.

◆ Cy_SCB_SPI_ReadArray()

__STATIC_INLINE uint32_t Cy_SCB_SPI_ReadArray ( CySCB_Type const *  base,
void *  buffer,
uint32_t  size 
)

Reads an array of data out of the SPI RX FIFO.

This function does not block. It returns how many data elements were read from the RX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
bufferThe pointer to the location to place data read from the RX FIFO. The element size is defined by the data type, which depends on the configured RX data width.
sizeThe number of data elements to read from the RX FIFO.
Returns
The number of data elements read from the RX FIFO.
Note
  • This function only reads data available in the RX FIFO. It does not initiate an SPI transfer.
  • When in the master mode, this function writes data into the TX FIFO and waits until the transfer is completed before reading data from the RX FIFO.

◆ Cy_SCB_SPI_Write()

__STATIC_INLINE uint32_t Cy_SCB_SPI_Write ( CySCB_Type base,
uint32_t  data 
)

Places a single data element in the SPI TX FIFO.

This function does not block. It returns how many data elements were placed in the TX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
dataData to put in the TX FIFO. The element size is defined by the data type, which depends on the configured TX data width.
Returns
The number of data elements placed in the TX FIFO: 0 or 1.
Note
  • When in the master mode, writing data into the TX FIFO starts an SPI transfer.
  • When in the slave mode, writing data into the TX FIFO does not start an SPI transfer. The data is loaded in the TX FIFO and will be sent to the master on its request.
  • The SPI interface is full-duplex, therefore reads and writes occur at the same time. Thus, for every data element transferred out of the TX FIFO, one is transferred into the RX FIFO.

◆ Cy_SCB_SPI_WriteArray()

__STATIC_INLINE uint32_t Cy_SCB_SPI_WriteArray ( CySCB_Type base,
void *  buffer,
uint32_t  size 
)

Places an array of data in the SPI TX FIFO.

This function does not block. It returns how many data elements were placed in the TX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
bufferThe pointer to the data to place in the TX FIFO. The element size is defined by the data type, which depends on the configured TX data width.
sizeThe number of data elements to transmit.
Returns
The number of data elements placed in the TX FIFO.
Note
  • When in the master mode, writing data into the TX FIFO starts an SPI transfer.
  • When in the slave mode, writing data into the TX FIFO does not start an SPI transfer. The data is loaded in the TX FIFO and will be sent to the master on its request.
  • The SPI interface is full-duplex, therefore reads and writes occur at the same time. Thus, for every data element transferred out of the TX FIFO, one is transferred into the RX FIFO.

◆ Cy_SCB_SPI_WriteArrayBlocking()

__STATIC_INLINE void Cy_SCB_SPI_WriteArrayBlocking ( CySCB_Type base,
void *  buffer,
uint32_t  size 
)

Places an array of data in the SPI TX FIFO.

This function blocks until the number of data elements specified by size is placed in the SPI TX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
bufferThe pointer to data to place in the TX FIFO. The element size is defined by the data type, which depends on the configured TX data width.
sizeThe number of data elements to write into the TX FIFO.
Note
  • When in the master mode, writing data into the TX FIFO starts an SPI transfer.
  • When in the slave mode, writing data into the TX FIFO does not start an SPI transfer. The data is loaded in the TX FIFO and will be sent to the master on its request.
  • The SPI interface is full-duplex, therefore reads and writes occur at the same time. Thus, for every data element transferred out of the TX FIFO, one is transferred into the RX FIFO.

◆ Cy_SCB_SPI_GetTxFifoStatus()

__STATIC_INLINE uint32_t Cy_SCB_SPI_GetTxFifoStatus ( CySCB_Type const *  base)

Returns the current status of the TX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
Returns
SPI TX FIFO Statuses

◆ Cy_SCB_SPI_ClearTxFifoStatus()

__STATIC_INLINE void Cy_SCB_SPI_ClearTxFifoStatus ( CySCB_Type base,
uint32_t  clearMask 
)

Clears the selected statuses of the TX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
clearMaskThe mask of which statuses to clear. See SPI TX FIFO Statuses for the set of constants.
Note

◆ Cy_SCB_SPI_GetRxFifoStatus()

__STATIC_INLINE uint32_t Cy_SCB_SPI_GetRxFifoStatus ( CySCB_Type const *  base)

Returns the current status of the RX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
Returns
SPI RX FIFO Statuses

◆ Cy_SCB_SPI_ClearRxFifoStatus()

__STATIC_INLINE void Cy_SCB_SPI_ClearRxFifoStatus ( CySCB_Type base,
uint32_t  clearMask 
)

Clears the selected statuses of the RX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
clearMaskThe mask of which statuses to clear. See SPI RX FIFO Statuses for the set of constants.
Note

◆ Cy_SCB_SPI_GetSlaveMasterStatus()

__STATIC_INLINE uint32_t Cy_SCB_SPI_GetSlaveMasterStatus ( CySCB_Type const *  base)

Returns the current status of either the slave or the master, depending on the configured SPI mode.

Parameters
baseThe pointer to the SPI SCB instance.
Returns
SPI Master and Slave Statuses

◆ Cy_SCB_SPI_ClearSlaveMasterStatus()

__STATIC_INLINE void Cy_SCB_SPI_ClearSlaveMasterStatus ( CySCB_Type base,
uint32_t  clearMask 
)

Clears the selected statuses of either the slave or the master.

Parameters
baseThe pointer to the SPI SCB instance.
clearMaskThe mask of which statuses to clear. See SPI Master and Slave Statuses for the set of constants.

◆ Cy_SCB_SPI_GetNumInTxFifo()

__STATIC_INLINE uint32_t Cy_SCB_SPI_GetNumInTxFifo ( CySCB_Type const *  base)

Returns the number of data elements in the SPI TX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
Returns
The number of data elements in the TX FIFO. The size of a data element defined by the configured TX data width.
Note
This number does not include any data currently in the TX shifter.

◆ Cy_SCB_SPI_IsTxComplete()

__STATIC_INLINE bool Cy_SCB_SPI_IsTxComplete ( CySCB_Type const *  base)

Checks whether the TX FIFO and Shifter are empty and there is no more data to send.

Parameters
basePointer to the SPI SCB instance.
Returns
If true, transmission complete. If false, transmission is not complete.

◆ Cy_SCB_SPI_GetNumInRxFifo()

__STATIC_INLINE uint32_t Cy_SCB_SPI_GetNumInRxFifo ( CySCB_Type const *  base)

Returns the number of data elements in the SPI RX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
Returns
The number of data elements in the RX FIFO. The size of a data element defined by the configured RX data width.
Note
This number does not include any data currently in the RX shifter.

◆ Cy_SCB_SPI_ClearRxFifo()

__STATIC_INLINE void Cy_SCB_SPI_ClearRxFifo ( CySCB_Type base)

Clears all data out of the SPI RX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
Side Effects
Any data currently in the shifter is cleared and lost.

◆ Cy_SCB_SPI_ClearTxFifo()

__STATIC_INLINE void Cy_SCB_SPI_ClearTxFifo ( CySCB_Type base)

Clears all data out of the SPI TX FIFO.

Parameters
baseThe pointer to the SPI SCB instance.
Side Effects
The TX FIFO clear operation also clears the shift register; the shifter can be cleared in the middle of a data element transfer, corrupting it. The data element corruption means that all bits that have not been transmitted are transmitted as 1s on the bus.