Forum Rule: Always post complete source code & details to reproduce any issue!
-
sgtl5000 ADC lineInLevel() Gain Control
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:

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.
-
Senior Member+
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.
-
Senior Member+
-
Thanks for taking care of that. Good solution.
-
Senior Member+
No, thank YOU for posting it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules