|
SmartSnippets DA1459x SDK
|
Go to the documentation of this file.
74 #if dg_configSPI_ADAPTER
95 #ifndef CONFIG_SPI_USE_ASYNC_TRANSACTIONS
96 # define CONFIG_SPI_USE_ASYNC_TRANSACTIONS (1)
107 #ifndef CONFIG_SPI_USE_SYNC_TRANSACTIONS
108 # define CONFIG_SPI_USE_SYNC_TRANSACTIONS (1)
111 #if (CONFIG_SPI_USE_SYNC_TRANSACTIONS == 0) && (CONFIG_SPI_USE_ASYNC_TRANSACTIONS == 0)
112 #error "At least one macro CONFIG_SPI_USE_SYNC_TRANSACTIONS or CONFIG_SPI_USE_ASYNC_TRANSACTIONS must be set"
169 AD_SPI_ERROR_NONE = 0,
170 AD_SPI_ERROR_HANDLE_INVALID = -1,
171 AD_SPI_ERROR_ADAPTER_NOT_OPEN = -2,
172 AD_SPI_ERROR_CONFIG_SPI_ROLE_INVALID = -3,
173 AD_SPI_ERROR_CONFIG_DMA_CHANNEL_INVALID = -4,
174 AD_SPI_ERROR_CONFIG_SPI_CS_INVALID = -5,
175 AD_SPI_ERROR_TRANSF_IN_PROGRESS = -6,
176 AD_SPI_ERROR_NO_SPI_CLK_PIN = -7,
177 AD_SPI_ERROR_DRIVER_CLOCK_DIV_INVALID = -8,
178 AD_SPI_ERROR_DRIVER_CONF_INVALID = -9,
179 AD_SPI_ERROR_IO_CFG_INVALID = -10,
180 AD_SPI_ERROR_CONFIG_RX_TX_TL_INVALID = -11,
277 typedef void (*ad_spi_user_cb)(
void *user_data, uint16_t transferred);
279 #if (CONFIG_SPI_USE_SYNC_TRANSACTIONS == 1)
429 #if (CONFIG_SPI_USE_ASYNC_TRANSACTIONS == 1)
501 uint8_t *rbuf,
size_t rlen, ad_spi_user_cb cb,
void *user_data);
SPI configuration.
Definition: hw_spi.h:326
hw_spi_config_t spi
Definition: ad_spi.h:149
SPI I/O configuration.
Definition: ad_spi.h:133
ad_io_conf_t spi_clk
Definition: ad_spi.h:135
int ad_spi_write_read_async(ad_spi_handle_t handle, const uint8_t *wbuf, size_t wlen, uint8_t *rbuf, size_t rlen, ad_spi_user_cb cb, void *user_data)
Perform asynchronous SPI write and then read transaction. It can be used as write command and read bu...
const uint8_t cs_cnt
Definition: ad_spi.h:137
void ad_spi_activate_cs(ad_spi_handle_t handle, uint8_t csid)
Activate chip select for a specific device.
ad_io_conf_t spi_do
Definition: ad_spi.h:134
Central include header file with platform definitions.
int ad_spi_write_async(ad_spi_handle_t handle, const uint8_t *wbuf, size_t wlen, ad_spi_user_cb cb, void *user_data)
Perform a non blocking write transaction.
SPI controller configuration.
Definition: ad_spi.h:158
const ad_spi_driver_conf_t * drv
Definition: ad_spi.h:161
int ad_spi_read(ad_spi_handle_t handle, uint8_t *rbuf, size_t rlen)
Perform a blocking read transaction.
Serial Peripheral Interface (SPI) Low Level Driver (LLD) API definition.
void ad_spi_init(void)
Initialize adapter.
int ad_spi_reconfig(ad_spi_handle_t handle, const ad_spi_driver_conf_t *drv_conf)
Reconfigure SPI controller.
int ad_spi_close(ad_spi_handle_t handle, bool force)
Close SPI controller.
OS abstraction layer API.
SPI driver configuration.
Definition: ad_spi.h:148
Adapters shared definitions.
AD_IO_CONF_STATE
Adapters IO configuration state.
Definition: ad.h:65
const ad_spi_io_conf_t * io
Definition: ad_spi.h:160
int ad_spi_io_config(HW_SPI_ID id, const ad_spi_io_conf_t *io, AD_IO_CONF_STATE state)
Initialize controller pins to on / off io configuration.
ad_io_conf_t spi_di
Definition: ad_spi.h:136
int ad_spi_write(ad_spi_handle_t handle, const uint8_t *wbuf, size_t wlen)
Perform a blocking write transaction.
void * ad_spi_handle_t
SPI Handle returned by ad_spi_open()
Definition: ad_spi.h:122
Definition of API for the GPIO Low Level Driver.
const HW_SPI_ID id
Definition: ad_spi.h:159
ad_spi_handle_t ad_spi_open(const ad_spi_controller_conf_t *conf)
Open SPI controller.
void ad_spi_deactivate_cs(ad_spi_handle_t handle)
Deactivate chip select for a specific device.
ad_io_conf_t * spi_cs
Definition: ad_spi.h:138
void ad_spi_deactivate_cs_when_spi_done(ad_spi_handle_t handle)
Wait for SPI interface to be idle and deactivate chip select.
Adapters IO configuration.
Definition: ad.h:104
int ad_spi_write_read(ad_spi_handle_t handle, const uint8_t *wbuf, uint8_t *rbuf, size_t len)
Perform a blocking write and read transaction.
int ad_spi_read_async(ad_spi_handle_t handle, const uint8_t *rbuf, size_t rlen, ad_spi_user_cb cb, void *user_data)
Perform a blocking read transaction.
AD_SPI_ERROR
enum with return values of API calls
Definition: ad_spi.h:168