mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-05 12:25:03 +02:00
spi_slave: add a flag SPI_SLAVE_NO_RETURN_RESULT to bypass return descriptor from ISR
if using this flag, driver willn't return the trans-done descriptor from ISR, so `spi_slave_get_trans_result()` shouldn't be called. besides, callback is the only way to know transaction status in that case, so a `post_trans_cb` will be checked mandatory.
This commit is contained in:
@@ -224,6 +224,7 @@ esp_err_t spi_device_queue_trans(spi_device_handle_t handle, spi_transaction_t *
|
||||
out.
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG if parameter is invalid
|
||||
* - ESP_ERR_NOT_SUPPORTED if flag `SPI_DEVICE_NO_RETURN_RESULT` is set
|
||||
* - ESP_ERR_TIMEOUT if there was no completed transaction before ticks_to_wait expired
|
||||
* - ESP_OK on success
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ extern "C"
|
||||
#define SPI_SLAVE_TXBIT_LSBFIRST (1<<0) ///< Transmit command/address/data LSB first instead of the default MSB first
|
||||
#define SPI_SLAVE_RXBIT_LSBFIRST (1<<1) ///< Receive data LSB first instead of the default MSB first
|
||||
#define SPI_SLAVE_BIT_LSBFIRST (SPI_SLAVE_TXBIT_LSBFIRST|SPI_SLAVE_RXBIT_LSBFIRST) ///< Transmit and receive LSB first
|
||||
|
||||
#define SPI_SLAVE_NO_RETURN_RESULT (1<<2) ///< Don't return the descriptor to the host on completion (use `post_trans_cb` to notify instead)
|
||||
|
||||
typedef struct spi_slave_transaction_t spi_slave_transaction_t;
|
||||
typedef void(*slave_transaction_cb_t)(spi_slave_transaction_t *trans);
|
||||
@@ -158,6 +158,7 @@ esp_err_t spi_slave_queue_trans(spi_host_device_t host, const spi_slave_transact
|
||||
* out.
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG if parameter is invalid
|
||||
* - ESP_ERR_NOT_SUPPORTED if flag `SPI_SLAVE_NO_RETURN_RESULT` is set
|
||||
* - ESP_OK on success
|
||||
*/
|
||||
esp_err_t spi_slave_get_trans_result(spi_host_device_t host, spi_slave_transaction_t **trans_desc, TickType_t ticks_to_wait);
|
||||
|
||||
Reference in New Issue
Block a user