Espressif ESP32-S2 Programming Manual page 390

Table of Contents

Advertisement

Chapter 2. API Reference
int queue_size
Transaction queue size.
spi_device_queue_trans but not yet finished using spi_device_get_trans_result) at the same time.
transaction_cb_t
pre_cb
Callback to be called before a transmission is started.
This callback is called within interrupt context should be in IRAM for best performance, see "Trans-
ferring Speed"section in the SPI Master documentation for full details. If not, the callback may crash
during flash operation when the driver is initialized with ESP_INTR_FLAG_IRAM.
transaction_cb_t
post_cb
Callback to be called after a transmission has completed.
This callback is called within interrupt context should be in IRAM for best performance, see "Trans-
ferring Speed"section in the SPI Master documentation for full details. If not, the callback may crash
during flash operation when the driver is initialized with ESP_INTR_FLAG_IRAM.
struct spi_transaction_t
This structure describes one SPI transaction. The descriptor should not be modified until the transaction fin-
ishes.
Public Members
uint32_t flags
Bitwise OR of SPI_TRANS_* flags.
uint16_t cmd
Command data, of which the length is set in the command_bits of spi_device_interface_config_t.
NOTE: this field, used to be "command"in ESP-IDF 2.1 and before, is re-written to be used in
a new way in ESP-IDF 3.0.
Example: write 0x0123 and command_bits=12 to send command 0x12, 0x3_ (in previous version, you
may have to write 0x3_12).
uint64_t addr
Address data, of which the length is set in the address_bits of spi_device_interface_config_t.
NOTE: this field, used to be "address"in ESP-IDF 2.1 and before, is re-written to be used in a
new way in ESP-IDF3.0.
Example: write 0x123400 and address_bits=24 to send address of 0x12, 0x34, 0x00 (in previous version,
you may have to write 0x12340000).
size_t length
Total data length, in bits.
size_t rxlength
Total data length received, should be not greater than length in full-duplex mode (0 defaults this to the
value of length).
void *user
User-defined variable. Can be used to store eg transaction ID.
const void *tx_buffer
Pointer to transmit buffer, or NULL for no MOSI phase.
uint8_t tx_data[4]
If SPI_TRANS_USE_TXDATA is set, data set here is sent directly from this variable.
void *rx_buffer
Pointer to receive buffer, or NULL for no MISO phase. Written by 4 bytes-unit if DMA is used.
uint8_t rx_data[4]
If SPI_TRANS_USE_RXDATA is set, data is received directly to this variable.
Espressif Systems
This sets how many transactions can be 'in the air'(queued using
379
Submit Document Feedback
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF