Skip to content

Commit bd8eb9b

Browse files
Shift I2S input data by 1 bit (#2121)
Fixes #2037
1 parent d53d003 commit bd8eb9b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

libraries/I2S/src/pio_i2s.pio

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ static inline void pio_i2s_in_program_init(PIO pio, uint sm, uint offset, uint d
294294
pio_sm_set_pins(pio, sm, 0); // clear pins
295295

296296
pio_sm_exec(pio, sm, pio_encode_set(pio_y, bits - 2));
297+
298+
// Offset the data by 1 bit
299+
pio_sm_exec(pio, sm, pio_encode_in(pio_pins, bits - 1));
297300
}
298301

299302
%}

libraries/I2S/src/pio_i2s.pio.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +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));
381383
}
382384

383385
#endif

0 commit comments

Comments
 (0)