Tab5: disable speaker when headphones are plugged in
-
Dear all,
I noticed that the hardware demo which comes preloaded on the Tab5 doesn't disable the speaker as soon as headphones are plugged in. Sound plays on both, speaker and headphones.
However, the pop up telling me that I connected or disconnected headphones works flawlessly, so the headphones are recognized by the software.
For my upcoming project I need the speaker to be silent while sound plays on the headphones.
Is there a way do disable the speaker but keep the headphones activated? I couldn't find something in the libraries and examples on GitHub...Thanks and kind regards!
-
@milaidin :
Poking around in the schematic shows that the Audio jack has a switch pin connected to a line labelledHP_DETon the board. As far as I can tell this line is pulled low viaR47&R48unless there is a plug inserted. when it is pulled high viaR49instead.
ThisHP_DETline does not go directly to the P4 chip, instead it goes toU6, which is a I2C I/O expander chip on the system I2C bus.If the source for the demo is available look for how this line is read, then turn the amplifier on/off as needed. The code for that should also be in the demo.
-
Thank you!
I was not precise enough in my earlier post:
I had already found the code to detect the connected headphones, the part that I was missing was how to turn off the speaker as soon as the headphones are detected (and if it was possible to turn it off independently from the speaker).Thanks to your comment and some poking around on GitHub I realized that I overlooked the GPIO extension. There is a SPK_EN pin there (Pin 1 on the first extension) that connects to the onboard amplifier and, according to its datasheet, can be used to turn the amplifier off.
Since the headphones are not connected to the amplifier, this should mute the speaker without influencing the headphones - I haven't tried it yet, but that's my guess based on the schematics.