Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/en/advanced_utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Advanced Utilities
:maxdepth: 2

Library Builder <lib_builder>
ESP-IDF as Component <esp-idf_component>
Arduino as an ESP-IDF component <esp-idf_component>
OTA Web Update <ota_web_update>
makeEspArduino <make>
12 changes: 6 additions & 6 deletions docs/en/api/i2s.rst
Original file line number Diff line number Diff line change
Expand Up @@ -536,21 +536,21 @@ Sample code
#include <ESP_I2S.h>

const int buff_size = 128;
int available, read;
int available_bytes, read_bytes;
uint8_t buffer[buff_size];
I2SClass I2S;

void setup() {
I2S.setPins(5, 25, 26, 35, 0); //SCK, WS, SDOUT, SDIN, MCLK
I2S.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO);
I2S.read();
available = I2S.available();
if(available < buff_size) {
read = I2S.read(buffer, available);
available_bytes = I2S.available();
if(available_bytes < buff_size) {
read_bytes = I2S.read(buffer, available_bytes);
} else {
read = I2S.read(buffer, buff_size);
read_bytes = I2S.read(buffer, buff_size);
}
I2S.write(buffer, read);
I2S.write(buffer, read_bytes);
I2S.end();
}

Expand Down