Skip to content

Commit dab26a3

Browse files
committed
docs(i2s): Fix I2S documentation example
1 parent 0ef2986 commit dab26a3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: docs/en/api/i2s.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -536,21 +536,21 @@ Sample code
536536
#include <ESP_I2S.h>
537537
538538
const int buff_size = 128;
539-
int available, read;
539+
int available_bytes, read_bytes;
540540
uint8_t buffer[buff_size];
541541
I2SClass I2S;
542542
543543
void setup() {
544544
I2S.setPins(5, 25, 26, 35, 0); //SCK, WS, SDOUT, SDIN, MCLK
545545
I2S.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO);
546546
I2S.read();
547-
available = I2S.available();
548-
if(available < buff_size) {
549-
read = I2S.read(buffer, available);
547+
available_bytes = I2S.available();
548+
if(available_bytes < buff_size) {
549+
read_bytes = I2S.read(buffer, available_bytes);
550550
} else {
551-
read = I2S.read(buffer, buff_size);
551+
read_bytes = I2S.read(buffer, buff_size);
552552
}
553-
I2S.write(buffer, read);
553+
I2S.write(buffer, read_bytes);
554554
I2S.end();
555555
}
556556

0 commit comments

Comments
 (0)