AliOS Things API HAL SOC SPI Guide - Shaofa/AliOS-Things-Certification-Manual GitHub Wiki
int32_t hal_spi_init(spi_dev_t *spi)
-
Description
Initialises the SPI interface for a given SPI device
-
Parameters
IN/OUT NAME DESC [in] spi the spi device -
Returns
0 : on success, EIO : if the SPI device could not be initialised
int32_t hal_spi_send(spi_dev_t *spi, const uint8_t *data, uint16_t size, uint32_t timeout)
-
Description
Spi send
-
Parameters
IN/OUT NAME DESC [in] spi the spi device [in] data spi send data [in] size spi send data size [in] timeout timeout in ms -
Returns
0 : on success, EIO : if the SPI device could not be initialised
int32_t hal_spi_recv(spi_dev_t *spi, uint8_t *data, uint16_t size, uint32_t timeout)
-
Description
spi_recv
-
Parameters
IN/OUT NAME DESC [in] spi the spi device [out] data spi recv data [in] size spi recv data size [in] timeout timeout in ms -
Returns
0 : on success, EIO : if the SPI device could not be initialised
int32_t hal_spi_send_recv(spi_dev_t *spi, const uint8_t *tx_data, uint16_t tx_size,
uint8_t *rx_data, uint16_t rx_size, uint32_t timeout)
-
Description
spi send data and recv
-
Parameters
IN/OUT NAME DESC [in] spi the spi device [in] tx_data spi send data [in] rx_data spi recv data [in] tx_size spi data to be sent [in] rx_size spi data to be recv [in] timeout timeout in ms -
Returns
0, on success; EIO : if the SPI device could not be initialised
int32_t hal_spi_finalize(spi_dev_t *spi)
-
Description
De-initialises a SPI interface
-
Parameters
IN/OUT NAME DESC [in] spi the SPI device to be de-initialised -
Returns
0 : on success, EIO : if an error occurred