Teensy Audio Library: sgtl5000 headphoneSelect is inverted?

elgiano

Member
Hi!
I'm using the Audio shield and library for a project, and I noticed what seems to be a bug. Using the function headphoneSelect I should be able to select the input for the headphones amplifier: either audio from the DAC or directly from LINEIN, bypassing the DAC. The behavior I observe looks inverted: if I select the DAC I get the LINEIN on the output, and vice-versa. Looking at the function in sgtl5000.h, if I understand correctly, we are writing 0x1 when selecting DAC and 0x0 when selecting LINEIN:
C:
bool headphoneSelect(int n) {
        if (n == AUDIO_HEADPHONE_DAC) {
            return write(0x0024, ana_ctrl | (1<<6)); // route DAC to headphones out
        } else if (n == AUDIO_HEADPHONE_LINEIN) {
            return write(0x0024, ana_ctrl & ~(1<<6)); // route linein to headphones out
        } else {
            return false;
        }
}
However, the datasheet (page 39) says:
Select the headphone input.
0x0 = DAC
0x1 = LINEIN
So, this looks like a bug to me, am I wrong?

EDIT: @Paul I've submitted a PR: https://github.com/PaulStoffregen/Audio/pull/468
 
Last edited:
Back
Top