EasyManua.ls Logo

Espressif ESP32-S2 - Page 403

Espressif ESP32-S2
1695 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
• addr: Address of register to write, 0 to SOC_SPI_MAXIMUM_BUFFER_SIZE-1
• data: Buffer holding the data to write
• len: Length to write, SOC_SPI_MAXIMUM_BUFFER_SIZE-addr
esp_err_t spi_slave_hd_append_trans(spi_host_device_t host_id, spi_slave_chan_t chan,
spi_slave_hd_data_t *trans, TickType_t timeout)
Load transactions (append mode)
Note In this mode, user transaction descriptors will be appended to the DMA and the DMA will keep pro-
cessing the data without stopping
Return
• ESP_OK: on success
• ESP_ERR_INVALID_ARG: The input argument is invalid. Can be the following reason:
– The buffer given is not DMA capable
– The length of data is invalid (not larger than 0, or exceed the max transfer length)
– The transaction direction is invalid
• ESP_ERR_TIMEOUT: Master is still processing previous transaction. There is no available trans-
action for slave to load
• ESP_ERR_INVALID_STATE: Function called in invalid state. This API should be called under
append mode.
Parameters
• host_id: Host to load transactions
• chan: SPI_SLAVE_CHAN_TX or SPI_SLAVE_CHAN_RX
• trans: Transaction descriptor
• timeout: Timeout before the transaction is loaded
esp_err_t spi_slave_hd_get_append_trans_res(spi_host_device_t host_id, spi_slave_chan_t
chan, spi_slave_hd_data_t **out_trans,
TickType_t timeout)
Get the result of a data transaction (append mode)
Note This API should be called the same times as the spi_slave_hd_append_trans
Return
• ESP_OK: on success
• ESP_ERR_INVALID_ARG: Function is not valid
• ESP_ERR_TIMEOUT: There’s no transaction done before timeout
• ESP_ERR_INVALID_STATE: Function called in invalid state. This API should be called under
append mode.
Parameters
• host_id: Host to load the transaction
• chan: SPI_SLAVE_CHAN_TX or SPI_SLAVE_CHAN_RX
• [out] out_trans: Pointer to the transaction descriptor (spi_slave_hd_data_t) passed
to the driver before. Hardware has finished this transaction. Member trans_len indicates the
actual number of bytes of received data, it’s meaningless for TX.
• timeout: Timeout before the result is got
Structures
struct spi_slave_hd_data_t
Descriptor of data to send/receive.
Public Members
uint8_t *data
Buffer to send, must be DMA capable.
size_t len
Len of data to send/receive. For receiving the buffer length should be multiples of 4 bytes, otherwise the
extra part will be truncated.
Espressif Systems 392
Submit Document Feedback
Release v4.4

Table of Contents