Functions | |
cy_en_scb_spi_status_t | Cy_SCB_SPI_Transfer (CySCB_Type *base, void *txBuffer, void *rxBuffer, uint32_t size, cy_stc_scb_spi_context_t *context) |
This function starts an SPI transfer operation. More... | |
void | Cy_SCB_SPI_AbortTransfer (CySCB_Type *base, cy_stc_scb_spi_context_t *context) |
Aborts the current SPI transfer. More... | |
uint32_t | Cy_SCB_SPI_GetTransferStatus (CySCB_Type const *base, cy_stc_scb_spi_context_t const *context) |
Returns the status of the transfer operation started by Cy_SCB_SPI_Transfer. More... | |
uint32_t | Cy_SCB_SPI_GetNumTransfered (CySCB_Type const *base, cy_stc_scb_spi_context_t const *context) |
Returns the number of data elements transferred since the last call to Cy_SCB_SPI_Transfer. More... | |
cy_en_scb_spi_status_t Cy_SCB_SPI_Transfer | ( | CySCB_Type * | base, |
void * | txBuffer, | ||
void * | rxBuffer, | ||
uint32_t | size, | ||
cy_stc_scb_spi_context_t * | context | ||
) |
This function starts an SPI transfer operation.
It configures transmit and receive buffers for an SPI transfer. If the data that will be received is not important, pass NULL as rxBuffer. If the data that will be transmitted is not important, pass NULL as txBuffer and then the CY_SCB_SPI_DEFAULT_TX is sent out as each data element. Note that passing NULL as rxBuffer and txBuffer are considered invalid cases.
After the function configures TX and RX interrupt sources, it returns and Cy_SCB_SPI_Interrupt manages further data transfer.
When the transfer operation is completed (requested number of data elements sent and received), the CY_SCB_SPI_TRANSFER_ACTIVE status is cleared and the CY_SCB_SPI_TRANSFER_CMPLT_EVENT event is generated.
base | The pointer to the SPI SCB instance. |
txBuffer | The pointer of the buffer with data to transmit. The element size is defined by the data type that depends on the configured TX data width. |
rxBuffer | The pointer to the buffer to store received data. The element size is defined by the data type that depends on the configured RX data width. |
size | The number of data elements to transmit and receive. |
context | The pointer to the context structure cy_stc_scb_spi_context_t allocated by the user. The structure is used during the SPI operation for internal configuration and data retention. The user must not modify anything in this structure. |
void Cy_SCB_SPI_AbortTransfer | ( | CySCB_Type * | base, |
cy_stc_scb_spi_context_t * | context | ||
) |
Aborts the current SPI transfer.
It disables the TX and RX interrupt sources, clears the TX and RX FIFOs and the status.
base | The pointer to the SPI SCB instance. |
context | The pointer to the context structure cy_stc_scb_spi_context_t allocated by the user. The structure is used during the SPI operation for internal configuration and data retention. The user must not modify anything in this structure. |
uint32_t Cy_SCB_SPI_GetTransferStatus | ( | CySCB_Type const * | base, |
cy_stc_scb_spi_context_t const * | context | ||
) |
Returns the status of the transfer operation started by Cy_SCB_SPI_Transfer.
This status is a bit mask and the value returned may have a multiple-bit set.
base | The pointer to the SPI SCB instance. |
context | The pointer to the context structure cy_stc_scb_spi_context_t allocated by the user. The structure is used during the SPI operation for internal configuration and data retention. The user must not modify anything in this structure. |
uint32_t Cy_SCB_SPI_GetNumTransfered | ( | CySCB_Type const * | base, |
cy_stc_scb_spi_context_t const * | context | ||
) |
Returns the number of data elements transferred since the last call to Cy_SCB_SPI_Transfer.
base | The pointer to the SPI SCB instance. |
context | The pointer to the context structure cy_stc_scb_spi_context_t allocated by the user. The structure is used during the SPI operation for internal configuration and data retention. The user must not modify anything in this structure. |