sgtl5000 ADC lineInLevel() Gain Control

Status
Not open for further replies.

Neal

Well-known member
FYI-Here is a very small item that caused me some confusion while using the sgtl5000 Audio Library routines. I did not find it mentioned anywhere in the forum so I thought I would document it for reference.

The Audio Library method for adjusting the line in gains on the sgtl5000 ADCs is:

bool AudioControlSGTL5000::lineInLevel(uint8_t left, uint8_t right)
{
if (left > 15) left = 15;
if (right > 15) right = 15;
return write(CHIP_ANA_ADC_CTRL, (left << 4) | right);
}

But the sgtl5000 data sheet details the CHIP_ANA_ADC_CTRL register as:

ADC_CTRL_reg.jpg

So the method has the left/right reversed.

As I said, very small issue, but it took me a bit to figure out why my code wasn't controlling the left/right ADC gains correctly.
 
The question is, how to fix that.
Fix the documentation only?
+fix the names in the sourcecode, but with the current behaviour?

Or fix the bug - that would mean to break old things.
 
I don't think it is necessary to change any source code. It would be nice to include it in errata documentation somewhere if an errata exists.

I just reversed things in my project code. I pointed it out so it might come up if someone having a similar problem searched the forum for help.
 
Status
Not open for further replies.
Back
Top