wifiiot_spi.h

Overview

Related Modules:

Wifiiot

Description:

Declares the SPI interface functions.

These functions are used for SPI initialization, deinitialization, and data transmission.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

WifiIotSpiCfgBasicInfo

Defines data communication parameters.

WifiIotSpiCfgInitParam

Specifies whether a device is a master or slave device.

Typedefs

Typedef Name

Description

SpiIsrFunc) (void)

typedef void(* 

Indicates the SPI callback, which is used in SpiRegisterUsrFunc.

Enumerations

Enumeration Name

Description

WifiIotSpiIdx { WIFI_IOT_SPI_ID_0 = 0, WIFI_IOT_SPI_ID_1 }

Enumerates SPI channel IDs.

WifiIotSpiCfgClockCpol { WIFI_IOT_SPI_CFG_CLOCK_CPOL_0, WIFI_IOT_SPI_CFG_CLOCK_CPOL_1 }

Enumerates communication polarities.

WifiIotSpiCfgClockCpha { WIFI_IOT_SPI_CFG_CLOCK_CPHA_0, WIFI_IOT_SPI_CFG_CLOCK_CPHA_1 }

Enumerates communication phases.

WifiIotSpiCfgFramMode { WIFI_IOT_SPI_CFG_FRAM_MODE_MOTOROLA, WIFI_IOT_SPI_CFG_FRAM_MODE_TI, WIFI_IOT_SPI_CFG_FRAM_MODE_MICROWIRE }

Enumerates communication protocols.

WifiIotSpiCfgDataWidth {   WIFI_IOT_SPI_CFG_DATA_WIDTH_E_4BIT = 0x3, WIFI_IOT_SPI_CFG_DATA_WIDTH_E_5BIT, WIFI_IOT_SPI_CFG_DATA_WIDTH_E_6BIT, WIFI_IOT_SPI_CFG_DATA_WIDTH_E_7BIT,   WIFI_IOT_SPI_CFG_DATA_WIDTH_E_8BIT, WIFI_IOT_SPI_CFG_DATA_WIDTH_E_9BIT, WIFI_IOT_SPI_CFG_DATA_WIDTH_E_10BIT, WIFI_IOT_SPI_CFG_DATA_WIDTH_E_11BIT,   WIFI_IOT_SPI_CFG_DATA_WIDTH_E_12BIT, WIFI_IOT_SPI_CFG_DATA_WIDTH_E_13BIT, WIFI_IOT_SPI_CFG_DATA_WIDTH_E_14BIT, WIFI_IOT_SPI_CFG_DATA_WIDTH_E_15BIT,   WIFI_IOT_SPI_CFG_DATA_WIDTH_E_16BIT }

Enumerates the communication data width, that is, the number of valid bits in each frame.

WifiIotSpiCfgEndian { WIFI_IOT_SPI_CFG_ENDIAN_LITTLE, WIFI_IOT_SPI_CFG_ENDIAN_BIG }

Enumerates the endian mode of each frame.

Functions

Function Name

Description

SpiSlaveWrite (WifiIotSpiIdx spiId, char writeData, unsigned int byteLen, unsigned int timeOutMs)

unsigned int 

Sends data in SPI slave mode.

SpiSlaveRead (WifiIotSpiIdx spiId, char readData, unsigned int byteLen, unsigned int timeOutMs)

unsigned int 

Reads data in SPI slave mode.

SpiHostWrite (WifiIotSpiIdx spiId, char writeData, unsigned int byteLen)

unsigned int 

Sends data in half-duplex SPI master mode.

SpiHostRead (WifiIotSpiIdx spiId, char readData, unsigned int byteLen)

unsigned int 

Reads data in half-duplex SPI master mode.

SpiHostWriteread (WifiIotSpiIdx spiId, char writeData, char readData, unsigned int byteLen)

unsigned int 

Sends and reads data in full-duplex SPI master mode.

SpiSetBasicInfo (WifiIotSpiIdx spiId, const WifiIotSpiCfgBasicInfoparam)

unsigned int 

Sets the SPI channel parameter.

SpiInit (WifiIotSpiIdx spiId, WifiIotSpiCfgInitParam initParam, const WifiIotSpiCfgBasicInfo param)

unsigned int 

Initializes an SPI device.

SpiDeinit (WifiIotSpiIdx spiId)

unsigned int 

Deinitializes an SPI device.

SpiSetIrqMode (WifiIotSpiIdx spiId, unsigned char irqEn)

unsigned int 

Sets whether to enable the interrupt request (IRQ) mode for an SPI device.

SpiSetDmaMode (WifiIotSpiIdx spiId, unsigned char dmaEn)

unsigned int 

Sets whether to enable DMA to transfer data for an SPI device in slave mode.

SpiRegisterUsrFunc (WifiIotSpiIdx spiId, SpiIsrFunc prepareF, SpiIsrFunc restoreF)

unsigned int 

Registers the data TX preparation/recovery function.

SpiSetLoopBackMode (WifiIotSpiIdx spiId, unsigned char lbEn)

unsigned int 

Sets whether to enable loopback test for an SPI device.