Skip to content

Commit

Permalink
docs(i2s): Fix I2S documentation example (#9916)
Browse files Browse the repository at this point in the history
* docs(i2s): Fix I2S documentation example

* docs(idf): Fix name of Arduino as component link
  • Loading branch information
lucasssvaz committed Jun 24, 2024
1 parent 26db8cb commit 1f2ba1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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

0 comments on commit 1f2ba1f

Please sign in to comment.