Skip to content

Commit 4e6e1d6

Browse files
authored
Use PIN_I2S_ defines if they exist in board pin definition. (#991)
1 parent 0133ecc commit 4e6e1d6

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

libraries/I2S/src/I2S.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,26 @@ I2S::I2S(PinMode direction) {
2727
_running = false;
2828
_bps = 16;
2929
_writtenHalf = false;
30+
_isOutput = direction == OUTPUT;
3031
_pinBCLK = 26;
3132
_pinDOUT = 28;
33+
#ifdef PIN_I2S_BCLK
34+
_pinBCLK = PIN_I2S_BCLK;
35+
#endif
36+
37+
#ifdef PIN_I2S_DOUT
38+
if (_isOutput) {
39+
_pinDOUT = PIN_I2S_DOUT;
40+
}
41+
#endif
42+
43+
#ifdef PIN_I2S_DIN
44+
if (!_isOutput) {
45+
_pinDOUT = PIN_I2S_DIN;
46+
}
47+
#endif
3248
_freq = 48000;
3349
_arb = nullptr;
34-
_isOutput = direction == OUTPUT;
3550
_cb = nullptr;
3651
_buffers = 8;
3752
_bufferWords = 16;

0 commit comments

Comments
 (0)