1.1.8.4 Library Interface

SPI driver library provides the following interfaces:

Functions

NameDescriptionAsynchronous ModeSynchronous Mode
DRV_SPI_InitializeInitializes the SPI instance for the specified driver indexYesYes
DRV_SPI_StatusGets the current status of the SPI driver moduleYesYes
DRV_SPI_OpenOpens the specified SPI driver instance and returns a handle to itYesYes
DRV_SPI_CloseCloses an opened-instance of the SPI driverYesYes
DRV_SPI_TransferSetupSets the dynamic configuration of the driver including chip select pinYesYes
DRV_SPI_LockUse this API to lock the SPI driver for exclusive use by a clientYesYes
DRV_SPI_WriteReadTransferAddQueues a write-read transfer operationYesNo
DRV_SPI_WriteTransferAddQueues a write operationYesNo
DRV_SPI_ReadTransferAddQueues a read operationYesNo
DRV_SPI_TransferEventHandlerSetAllows a client to set a transfer event handling function for the driver to call back when queued transfer has finishedYesNo
DRV_SPI_TransferStatusGetReturns transfer add request statusYesNo
DRV_SPI_WriteTransferThis is a blocking function that transmits data over SPINoYes
DRV_SPI_ReadTransferThis is a blocking function that receives data over SPINoYes
DRV_SPI_WriteReadTransferThis is a blocking function that transmits and receives data over SPINoYes

Data types and constants

NameTypeDescription
DRV_SPI_TRANSFER_HANDLETypedefHandle identifying the transfer request queued
DRV_SPI_TRANSFER_HANDLE_INVALIDMacroDefinition of an invalid transfer handle
DRV_SPI_TRANSFER_EVENTEnumIdentifies the possible events that can result from a transfer add request
DRV_SPI_TRANSFER_EVENT_HANDLERTypedefPointer to a SPI Driver Transfer Event handler function
DRV_SPI_CLOCK_PHASEEnumIdentifies SPI Clock Phase Options
DRV_SPI_CLOCK_POLARITYEnumIdentifies SPI Clock Polarity Options
DRV_SPI_DATA_BITSEnumIdentifies SPI bits per transfer
DRV_SPI_CS_POLARITYEnumIdentifies SPI Chip Select Polarity Options