Pin 39/38 as alternate OUT1/IN1 for I2S?

tonedef

New member
I'd like to use pin 39 and 38 instead of 7 and 8 for I2S on SAI1. How should I do that? Hate to patch library code, but I could just do this right (each file has two ref. to replace)?

C:\Users\<my_user>\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.60.0\libraries\Audio\input_i2s.cpp
C++:
CORE_PIN38_CONFIG  = 3;
IOMUXC_SAI1_RX_DATA0_SELECT_INPUT = 1;
// CORE_PIN8_CONFIG  = 3;  //1:RX_DATA0
// IOMUXC_SAI1_RX_DATA0_SELECT_INPUT = 2;

C:\Users\<my_user>\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.60.0\libraries\Audio\output_i2s.cpp
C++:
CORE_PIN39_CONFIG = 3;
//CORE_PIN7_CONFIG  = 3;  //1:TX_DATA0

Just did a little more digging while writing this and saw @jmbernardi's comment doing the same exact thing, so I believe it'll work, just wasn't sure if this is still the best/right way.
I actually figured out how to change I2S IN1 and OUT1A to the alternates, posting here if it helps anyone.

Code to change in the Audio library:
input_i2s.cpp (change IN1 to pin 38)
CORE_PIN38_CONFIG = 3; //1:RX_DATA0
IOMUXC_SAI1_RX_DATA0_SELECT_INPUT = 1;

output_i2s.cpp (change OUT1A to pin 39)
CORE_PIN39_CONFIG = 3; //1:TX_DATA0
 
Back
Top