Group NeuralSPOT-spi
Classes
Type | Name |
---|---|
struct | ns_spi_cfg |
Public Types
Type | Name |
---|---|
typedef void(* | ns_spi_cb |
typedef struct ns_spi_cfg | ns_spi_config_t |
enum | ns_spi_status_e |
Public Attributes
Type | Name |
---|---|
ns_spi_cb | ns_spi_cfg::cb |
int8_t | ns_spi_cfg::iom |
void * | ns_spi_cfg::iomHandle |
am_hal_iom_config_t | ns_spi_cfg::sIomCfg |
Public Functions
Type | Name |
---|---|
uint32_t | ns_spi_interface_init (ns_spi_config_t * cfg, uint32_t speed, am_hal_iom_spi_mode_e mode) Initialize the SPI interface. |
uint32_t | ns_spi_read (ns_spi_config_t * cfg, const void * buf, uint32_t bufLen, uint64_t reg, uint32_t regLen, uint32_t csPin) Read from a SPI device. The SPI device is selected by the csPin parameter. |
uint32_t | ns_spi_read_dma (ns_spi_config_t * cfg, const void * buf, uint32_t bufLen, uint64_t reg, uint32_t regLen, uint32_t csPin) Issure DMA read, the cfg->callback will be called when the transfer is complete. |
uint32_t | ns_spi_transfer (ns_spi_config_t * cfg, const void * txBuf, const void * rxBuf, uint32_t size, uint32_t csPin) Transfer data to/from a SPI device. The SPI device is selected by the csPin parameter. |
uint32_t | ns_spi_write (ns_spi_config_t * cfg, const void * buf, uint32_t bufLen, uint64_t reg, uint32_t regLen, uint32_t csPin) Write to a SPI device. The SPI device is selected by the csPin parameter. |
Public Types Documentation
typedef ns_spi_cb
typedef void(* ns_spi_cb) (struct ns_spi_cfg *);
typedef ns_spi_config_t
typedef struct ns_spi_cfg ns_spi_config_t;
enum ns_spi_status_e
enum ns_spi_status_e {
NS_SPI_STATUS_SUCCESS = 0,
NS_SPI_STATUS_ERROR = 1
};
Public Attributes Documentation
variable cb
ns_spi_cb ns_spi_cfg::cb;
variable iom
int8_t ns_spi_cfg::iom;
variable iomHandle
void* ns_spi_cfg::iomHandle;
variable sIomCfg
am_hal_iom_config_t ns_spi_cfg::sIomCfg;
Public Functions Documentation
function ns_spi_interface_init
Initialize the SPI interface.
uint32_t ns_spi_interface_init (
ns_spi_config_t * cfg,
uint32_t speed,
am_hal_iom_spi_mode_e mode
)
Parameters:
cfg
SPI Configurationspeed
Bus speed in Hzmode
SPI mode (CPOL, CPHA)
Returns:
uint32_t
function ns_spi_read
Read from a SPI device. The SPI device is selected by the csPin parameter.
uint32_t ns_spi_read (
ns_spi_config_t * cfg,
const void * buf,
uint32_t bufLen,
uint64_t reg,
uint32_t regLen,
uint32_t csPin
)
Parameters:
cfg
SPI Configurationbuf
Buffer to read intobufLen
Buffer lengthreg
Register to read fromregLen
Register lengthcsPin
CS pin number
Returns:
uint32_t
function ns_spi_read_dma
Issure DMA read, the cfg->callback will be called when the transfer is complete.
uint32_t ns_spi_read_dma (
ns_spi_config_t * cfg,
const void * buf,
uint32_t bufLen,
uint64_t reg,
uint32_t regLen,
uint32_t csPin
)
Parameters:
cfg
buf
bufLen
reg
regLen
csPin
Returns:
uint32_t
function ns_spi_transfer
Transfer data to/from a SPI device. The SPI device is selected by the csPin parameter.
uint32_t ns_spi_transfer (
ns_spi_config_t * cfg,
const void * txBuf,
const void * rxBuf,
uint32_t size,
uint32_t csPin
)
Parameters:
cfg
SPI ConfigurationtxBuf
Transmit bufferrxBuf
Receive buffersize
Size of the transfercsPin
CS pin number
Returns:
uint32_t
function ns_spi_write
Write to a SPI device. The SPI device is selected by the csPin parameter.
uint32_t ns_spi_write (
ns_spi_config_t * cfg,
const void * buf,
uint32_t bufLen,
uint64_t reg,
uint32_t regLen,
uint32_t csPin
)
Parameters:
cfg
SPI Configurationbuf
Buffer to write frombufLen
Buffer lengthreg
Register to write toregLen
Register lengthcsPin
CS pin number
Returns:
uint32_t