FreeRTOS: Common I/O
AWS IoT Common I/O library
Return to main page ↑
iot_spi.h File Reference

File for the APIs of SPI called by application layer. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  IotSPIMasterConfig_t
 The configuration parameters for SPI Master. More...
 

Macros

#define IOT_SPI_SUCCESS   ( 0 )
 The return codes for the methods in SPI. More...
 
#define IOT_SPI_INVALID_VALUE   ( 1 )
 
#define IOT_SPI_WRITE_FAILED   ( 2 )
 
#define IOT_SPI_READ_FAILED   ( 3 )
 
#define IOT_SPI_TRANSFER_ERROR   ( 4 )
 
#define IOT_SPI_BUS_BUSY   ( 5 )
 
#define IOT_SPI_NOTHING_TO_CANCEL   ( 6 )
 
#define IOT_SPI_FUNCTION_NOT_SUPPORTED   ( 7 )
 

Typedefs

typedef struct IotSPIDescriptor_t * IotSPIHandle_t
 IotSPIHandle_t is the handle type returned by calling iot_spi_open(). This is initialized in open and returned to caller. The caller must pass this pointer to the rest of APIs.
 
typedef void(* IotSPICallback_t) (IotSPITransactionStatus_t xStatus, void *pvSPIparam)
 The callback function for completion of SPI operation.
 

Enumerations

enum  IotSPITransactionStatus_t { eSPISuccess = IOT_SPI_SUCCESS, eSPIWriteError = IOT_SPI_WRITE_FAILED, eSPIReadError = IOT_SPI_READ_FAILED, eSPITransferError = IOT_SPI_TRANSFER_ERROR }
 The SPI return status from Async operations. More...
 
enum  IotSPIMode_t { eSPIMode0, eSPIMode1, eSPIMode2, eSPIMode3 }
 The SPI Modes denoting the clock polarity and clock phase. More...
 
enum  IotSPIBitOrder_t { eSPIMSBFirst, eSPILSBFirst }
 The bit order of the data transmission. More...
 
enum  IotSPIIoctlRequest_t { eSPISetMasterConfig, eSPIGetMasterConfig, eSPIGetTxNoOfbytes, eSPIGetRxNoOfbytes }
 Ioctl request for SPI HAL. More...
 

Functions

IotSPIHandle_t iot_spi_open (int32_t lSPIInstance)
 Initializes SPI peripheral with default configuration. More...
 
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. More...
 
int32_t iot_spi_ioctl (IotSPIHandle_t const pxSPIPeripheral, IotSPIIoctlRequest_t xSPIRequest, void *const pvBuffer)
 Configures the SPI port with user configuration. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int32_t iot_spi_close (IotSPIHandle_t const pxSPIPeripheral)
 Stops the ongoing operation on SPI bus and de-initializes the SPI peripheral. More...
 
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 the cancellation. More...
 
int32_t iot_spi_select_slave (int32_t lSPIInstance, int32_t lSPISlave)
 This function is used to select spi slave. More...
 

Detailed Description

File for the APIs of SPI called by application layer.