44#define IOT_SPI_SUCCESS ( 0 )
45#define IOT_SPI_INVALID_VALUE ( 1 )
46#define IOT_SPI_WRITE_FAILED ( 2 )
47#define IOT_SPI_READ_FAILED ( 3 )
48#define IOT_SPI_TRANSFER_ERROR ( 4 )
49#define IOT_SPI_BUS_BUSY ( 5 )
50#define IOT_SPI_NOTHING_TO_CANCEL ( 6 )
51#define IOT_SPI_FUNCTION_NOT_SUPPORTED ( 7 )
103typedef struct IotSPIMasterConfig
114struct IotSPIDescriptor;
161 void * pvUserContext );
206 void *
const pvBuffer );
234 uint8_t *
const pvBuffer,
269 uint8_t *
const pvBuffer,
297 uint8_t *
const pvBuffer,
331 uint8_t *
const pvBuffer,
357 uint8_t *
const pvTxBuffer,
358 uint8_t *
const pvRxBuffer,
387 uint8_t *
const pvTxBuffer,
388 uint8_t *
const pvRxBuffer,
int32_t iot_spi_cancel(IotSPIHandle_t const pxSPIPeripheral)
This function is used to cancel the current operation in progress, if the underlying driver allows th...
int32_t iot_spi_select_slave(int32_t lSPIInstance, int32_t lSPISlave)
This function is used to select spi slave.
IotSPIMode_t
The SPI Modes denoting the clock polarity and clock phase.
Definition: iot_spi.h:70
#define IOT_SPI_READ_FAILED
Definition: iot_spi.h:47
IotSPITransactionStatus_t
The SPI return status from Async operations.
Definition: iot_spi.h:58
int32_t iot_spi_transfer_async(IotSPIHandle_t const pxSPIPeripheral, uint8_t *const pvTxBuffer, uint8_t *const pvRxBuffer, size_t xBytes)
The SPI master starts a asynchronous transfer between master and the slave.
int32_t iot_spi_transfer_sync(IotSPIHandle_t const pxSPIPeripheral, uint8_t *const pvTxBuffer, uint8_t *const pvRxBuffer, size_t xBytes)
The SPI master starts a synchronous transfer between master and the slave.
struct IotSPIDescriptor * IotSPIHandle_t
IotSPIHandle_t is the handle type returned by calling iot_spi_open(). This is initialized in open and...
Definition: iot_spi.h:121
void(* IotSPICallback_t)(IotSPITransactionStatus_t xStatus, void *pvSPIparam)
The callback function for completion of SPI operation.
Definition: iot_spi.h:126
void iot_spi_set_callback(IotSPIHandle_t const pxSPIPeripheral, IotSPICallback_t xCallback, void *pvUserContext)
Sets the application callback to be called on completion of an operation.
int32_t iot_spi_read_sync(IotSPIHandle_t const pxSPIPeripheral, uint8_t *const pvBuffer, size_t xBytes)
The SPI master starts reading from the slave synchronously.
int32_t iot_spi_read_async(IotSPIHandle_t const pxSPIPeripheral, uint8_t *const pvBuffer, size_t xBytes)
The SPI master starts reading from the slave asynchronously.
#define IOT_SPI_WRITE_FAILED
Definition: iot_spi.h:46
IotSPIHandle_t iot_spi_open(int32_t lSPIInstance)
Initializes SPI peripheral with default configuration.
int32_t iot_spi_write_sync(IotSPIHandle_t const pxSPIPeripheral, uint8_t *const pvBuffer, size_t xBytes)
The SPI master starts transmission of data to the slave synchronously.
int32_t iot_spi_write_async(IotSPIHandle_t const pxSPIPeripheral, uint8_t *const pvBuffer, size_t xBytes)
The SPI master starts transmission of data to the slave asynchronously.
int32_t iot_spi_ioctl(IotSPIHandle_t const pxSPIPeripheral, IotSPIIoctlRequest_t xSPIRequest, void *const pvBuffer)
Configures the SPI port with user configuration.
int32_t iot_spi_close(IotSPIHandle_t const pxSPIPeripheral)
Stops the ongoing operation on SPI bus and de-initializes the SPI peripheral.
IotSPIBitOrder_t
The bit order of the data transmission.
Definition: iot_spi.h:81
#define IOT_SPI_TRANSFER_ERROR
Definition: iot_spi.h:48
IotSPIIoctlRequest_t
Ioctl request for SPI HAL.
Definition: iot_spi.h:90
#define IOT_SPI_SUCCESS
The return codes for the methods in SPI.
Definition: iot_spi.h:44
@ eSPIMode1
Definition: iot_spi.h:72
@ eSPIMode2
Definition: iot_spi.h:73
@ eSPIMode0
Definition: iot_spi.h:71
@ eSPIMode3
Definition: iot_spi.h:74
@ eSPIReadError
Definition: iot_spi.h:61
@ eSPITransferError
Definition: iot_spi.h:62
@ eSPISuccess
Definition: iot_spi.h:59
@ eSPIWriteError
Definition: iot_spi.h:60
@ eSPIMSBFirst
Definition: iot_spi.h:82
@ eSPILSBFirst
Definition: iot_spi.h:83
@ eSPISetMasterConfig
Definition: iot_spi.h:91
@ eSPIGetRxNoOfbytes
Definition: iot_spi.h:94
@ eSPIGetTxNoOfbytes
Definition: iot_spi.h:93
@ eSPIGetMasterConfig
Definition: iot_spi.h:92
The configuration parameters for SPI Master.
Definition: iot_spi.h:104
IotSPIMode_t eMode
Definition: iot_spi.h:106
IotSPIBitOrder_t eSetBitOrder
Definition: iot_spi.h:107
uint32_t ulFreq
Definition: iot_spi.h:105
uint8_t ucDummyValue
Definition: iot_spi.h:108