Skip to content

Commit a8e6634

Browse files
Avoid swapping L/R channels on I2S input (#2124)
Fixes #2123
1 parent bd8eb9b commit a8e6634

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

libraries/I2S/src/pio_i2s.pio

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ static inline void pio_i2s_in_program_init(PIO pio, uint sm, uint offset, uint d
295295

296296
pio_sm_exec(pio, sm, pio_encode_set(pio_y, bits - 2));
297297

298-
// Offset the data by 1 bit
299-
pio_sm_exec(pio, sm, pio_encode_in(pio_pins, bits - 1));
298+
pio_sm_exec(pio, sm, pio_encode_in(pio_pins, bits)); // Shift in 1st L data
299+
pio_sm_exec(pio, sm, pio_encode_in(pio_pins, bits - 1)); // Shift in 1st R data modulo one bit, avoiding bit shift from #2037
300300
}
301301

302302
%}

libraries/I2S/src/pio_i2s.pio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ static inline void pio_i2s_in_program_init(PIO pio, uint sm, uint offset, uint d
378378
pio_sm_set_pindirs_with_mask(pio, sm, pin_mask, pin_mask);
379379
pio_sm_set_pins(pio, sm, 0); // clear pins
380380
pio_sm_exec(pio, sm, pio_encode_set(pio_y, bits - 2));
381-
// Offset the data by 1 bit
382-
pio_sm_exec(pio, sm, pio_encode_in(pio_pins, bits - 1));
381+
pio_sm_exec(pio, sm, pio_encode_in(pio_pins, bits)); // Shift in 1st L data
382+
pio_sm_exec(pio, sm, pio_encode_in(pio_pins, bits - 1)); // Shift in 1st R data modulo one bit, avoiding bit shift from #2037
383383
}
384384

385385
#endif

0 commit comments

Comments
 (0)