EasyManua.ls Logo

Espressif ESP32-S2 - Page 397

Espressif ESP32-S2
1695 pages
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
host: SPI peripheral to free
esp_err_t spi_slave_queue_trans(spi_host_device_t host, const spi_slave_transaction_t
*trans_desc, TickType_t ticks_to_wait)
Queue a SPI transaction for execution.
Queues a SPI transaction to be executed by this slave device. (The transaction queue size was specified when the
slave device was initialised via spi_slave_initialize.) This function may block if the queue is full (depending on
the ticks_to_wait parameter). No SPI operation is directly initiated by this function, the next queued transaction
will happen when the master initiates a SPI transaction by pulling down CS and sending out clock signals.
This function hands over ownership of the buffers in trans_desc to the SPI slave driver; the application
is not to access this memory until spi_slave_queue_trans is called to hand ownership back to the
application.
Return
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_OK on success
Parameters
host: SPI peripheral that is acting as a slave
trans_desc: Description of transaction to execute. Not const because we may want to write
status back into the transaction description.
ticks_to_wait: Ticks to wait until theres room in the queue; use portMAX_DELAY to never
time out.
esp_err_t spi_slave_get_trans_result(spi_host_device_t host, spi_slave_transaction_t
**trans_desc, TickType_t ticks_to_wait)
Get the result of a SPI transaction queued earlier.
This routine will wait until a transaction to the given device (queued earlier with spi_slave_queue_trans) has
succesfully completed. It will then return the description of the completed transaction so software can inspect
the result and e.g. free the memory or re-use the buffers.
It is mandatory to eventually use this function for any transaction queued by spi_slave_queue_trans.
Return
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_OK on success
Parameters
host: SPI peripheral to that is acting as a slave
[out] trans_desc: Pointer to variable able to contain a pointer to the description of the
transaction that is executed
ticks_to_wait: Ticks to wait until theres a returned item; use portMAX_DELAY to never
time out.
esp_err_t spi_slave_transmit(spi_host_device_t host, spi_slave_transaction_t *trans_desc, Tick-
Type_t ticks_to_wait)
Do a SPI transaction.
Essentially does the same as spi_slave_queue_trans followed by spi_slave_get_trans_result. Do not use this
when there is still a transaction queued that hasnt been finalized using spi_slave_get_trans_result.
Return
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_OK on success
Parameters
host: SPI peripheral to that is acting as a slave
trans_desc: Pointer to variable able to contain a pointer to the description of the transaction that
is executed. Not const because we may want to write status back into the transaction description.
ticks_to_wait: Ticks to wait until theres a returned item; use portMAX_DELAY to never
time out.
Structures
Espressif Systems 386
Submit Document Feedback
Release v4.4

Table of Contents