EasyManuals Logo

Espressif ESP32-S2 User Manual

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
Page #311 background imageLoading...
Page #311 background image
Chapter 2. API Reference
Return
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
ESP_ERR_NO_MEM Out of memory
ESP_ERR_INVALID_STATE Current I2S port is in use
esp_err_t i2s_driver_uninstall(i2s_port_t i2s_num)
Uninstall I2S driver.
Return
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
ESP_ERR_INVALID_STATE I2S port has been uninstalled by others (e.g. LCD i80)
Parameters
i2s_num: I2S port number
esp_err_t i2s_write(i2s_port_t i2s_num, const void *src, size_t size, size_t *bytes_written, TickType_t
ticks_to_wait)
Write data to I2S DMA transmit buffer.
Return
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
Parameters
i2s_num: I2S port number
src: Source address to write from
size: Size of data in bytes
[out] bytes_written: Number of bytes written, if timeout, the result will be less than the
size passed in.
ticks_to_wait: TX buffer wait timeout in RTOS ticks. If this many ticks pass without space
becoming available in the DMA transmit buffer, then the function will return (note that if the data
is written to the DMA buffer in pieces, the overall operation may still take longer than this timeout.)
Pass portMAX_DELAY for no timeout.
esp_err_t i2s_write_expand(i2s_port_t i2s_num, const void *src, size_t size, size_t src_bits, size_t
aim_bits, size_t *bytes_written, TickType_t ticks_to_wait)
Write data to I2S DMA transmit buffer while expanding the number of bits per sample. For example, expanding
16-bit PCM to 32-bit PCM.
Format of the data in source buffer is determined by the I2S configuration (see i2s_config_t).
Parameters
i2s_num: I2S port number
src: Source address to write from
size: Size of data in bytes
src_bits: Source audio bit
aim_bits: Bit wanted, no more than 32, and must be greater than src_bits
[out] bytes_written: Number of bytes written, if timeout, the result will be less than the
size passed in.
ticks_to_wait: TX buffer wait timeout in RTOS ticks. If this many ticks pass without space
becoming available in the DMA transmit buffer, then the function will return (note that if the data
is written to the DMA buffer in pieces, the overall operation may still take longer than this timeout.)
Pass portMAX_DELAY for no timeout.
Return
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
esp_err_t i2s_read(i2s_port_t i2s_num, void *dest, size_t size, size_t *bytes_read, TickType_t
ticks_to_wait)
Read data from I2S DMA receive buffer.
Note If the built-in ADC mode is enabled, we should call i2s_adc_enable and i2s_adc_disable around the
whole reading process, to prevent the data getting corrupted.
Espressif Systems 300
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

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

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish