1.1.8.4 Library Interface
SPI driver library provides the following interfaces:
Functions
Name | Description | Asynchronous Mode | Synchronous Mode |
---|---|---|---|
DRV_SPI_Initialize | Initializes the SPI instance for the specified driver index | Yes | Yes |
DRV_SPI_Status | Gets the current status of the SPI driver module | Yes | Yes |
DRV_SPI_Open | Opens the specified SPI driver instance and returns a handle to it | Yes | Yes |
DRV_SPI_Close | Closes an opened-instance of the SPI driver | Yes | Yes |
DRV_SPI_TransferSetup | Sets the dynamic configuration of the driver including chip select pin | Yes | Yes |
DRV_SPI_Lock | Use this API to lock the SPI driver for exclusive use by a client | Yes | Yes |
DRV_SPI_WriteReadTransferAdd | Queues a write-read transfer operation | Yes | No |
DRV_SPI_WriteTransferAdd | Queues a write operation | Yes | No |
DRV_SPI_ReadTransferAdd | Queues a read operation | Yes | No |
DRV_SPI_TransferEventHandlerSet | Allows a client to set a transfer event handling function for the driver to call back when queued transfer has finished | Yes | No |
DRV_SPI_TransferStatusGet | Returns transfer add request status | Yes | No |
DRV_SPI_WriteTransfer | This is a blocking function that transmits data over SPI | No | Yes |
DRV_SPI_ReadTransfer | This is a blocking function that receives data over SPI | No | Yes |
DRV_SPI_WriteReadTransfer | This is a blocking function that transmits and receives data over SPI | No | Yes |
Data types and constants
Name | Type | Description |
---|---|---|
DRV_SPI_TRANSFER_HANDLE | Typedef | Handle identifying the transfer request queued |
DRV_SPI_TRANSFER_HANDLE_INVALID | Macro | Definition of an invalid transfer handle |
DRV_SPI_TRANSFER_EVENT | Enum | Identifies the possible events that can result from a transfer add request |
DRV_SPI_TRANSFER_EVENT_HANDLER | Typedef | Pointer to a SPI Driver Transfer Event handler function |
DRV_SPI_CLOCK_PHASE | Enum | Identifies SPI Clock Phase Options |
DRV_SPI_CLOCK_POLARITY | Enum | Identifies SPI Clock Polarity Options |
DRV_SPI_DATA_BITS | Enum | Identifies SPI bits per transfer |
DRV_SPI_CS_POLARITY | Enum | Identifies SPI Chip Select Polarity Options |