Espressif ESP32-S2 Programming Manual page 669

Table of Contents

Advertisement

Chapter 2. API Reference
Header File
components/esp_serial_slave_link/include/esp_serial_slave_link/essl_spi.h
Functions
esp_err_t essl_spi_init_dev(essl_handle_t
Initialize the ESSL SPI device function list and get its handle.
Return
• ESP_OK: On success
• ESP_ERR_NO_MEM: Memory exhausted
• ESP_ERR_INVALID_STATE: SPI driver is not initialized
• ESP_ERR_INVALID_ARG: Wrong register ID
Parameters
• [out] out_handle: Output of the handle
• init_config: Configuration for the ESSL SPI device
esp_err_t essl_spi_deinit_dev(essl_handle_t
Deinitialize the ESSL SPI device and free the memory used by the device.
Return
• ESP_OK: On success
• ESP_ERR_INVALID_STATE: ESSL SPI is not in use
Parameters
• handle: Handle of the ESSL SPI device
esp_err_t
essl_spi_read_reg(void *arg, uint8_t addr, uint8_t *out_value, uint32_t wait_ms)
Read from the shared registers.
Note The registers for Master/Slave synchronization are reserved. Do not use them. (see rx_sync_reg in
essl_spi_config_t)
Return
• ESP_OK: success
• ESP_ERR_INVALID_STATE: ESSL SPI has not been initialized.
• ESP_ERR_INVALID_ARG: The address argument is not valid. See note 1.
• or other return value from :cpp:func:spi_device_transmit.
Parameters
• arg: Context of the component. (Member arg from essl_handle_t)
• addr: Address of the shared registers. (Valid: 0 ~ SOC_SPI_MAXIMUM_BUFFER_SIZE, reg-
isters for M/S sync are reserved, see note1).
• [out] out_value: Read buffer for the shared registers.
• wait_ms: Time to wait before timeout (reserved for future use, user should set this to 0).
esp_err_t
essl_spi_get_packet(void *arg, void *out_data, size_t size, uint32_t wait_ms)
Get a packet from Slave.
Return
• ESP_OK: On Success
• ESP_ERR_INVALID_STATE: ESSL SPI has not been initialized.
• ESP_ERR_INVALID_ARG: The output data address is neither DMA capable nor 4 byte-aligned
• ESP_ERR_INVALID_SIZE: Master requires size bytes of data but Slave did not load enough
bytes.
Parameters
• arg: Context of the component. (Member arg from essl_handle_t)
• [out] out_data: Output data address
• size: The size of the output data.
• wait_ms: Time to wait before timeout (reserved for future use, user should set this to 0).
esp_err_t
essl_spi_write_reg(void *arg, uint8_t addr, uint8_t value, uint8_t *out_value, uint32_t
Write to the shared registers.
Espressif Systems
*out_handle, const
handle)
wait_ms)
658
Submit Document Feedback
essl_spi_config_t
*init_config)
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?

Table of Contents

Save PDF