Edzelf / ESP32-Radio

Internet radio based on ESP32, VS1053 and a TFT screen.
GNU General Public License v3.0
987 stars 229 forks source link

Shutdown PIN not useful for amps with active LOW (i.e. PAM8403) #153

Open fletsche opened 6 years ago

fletsche commented 6 years ago

Hi Ed,

I guess the PAM8403 will be among the most commonly used amplifiers for your radio project. This chip has a mute pin (5) which is active low. Although this pin is not broken out on the board I got via amazon I could solder a wire to the isolated pin (after some amount of trying that is). However I noticed that the software drives the shutdown pin HIGH to shut the amp down which is reversed from how I (and probably all other users of the PAM8403) would need it.

I integrated an option to reverse the shutdown logic (shutdown_logic) into your program as a config-file option. Set this to -1 for the default active HIGH or to 0 for active LOW.

Greetings

David

Edzelf commented 6 years ago

Now you can use "pin_shutdownx" for inversed logic.

fletsche commented 6 years ago

Thank you very much! Your solution is even better than mine, as it allows for both logics to operate at the same time (might be useful to have a mute LED or something like that). However I also added the shutdown function to VS1053::setVolume when setting it to 0. This might not only help with noise, but also saves a bit power (I measured 15 mA with mute but no shutdown vs. 3 mA with shutdown pin active on my PAM8403 board). Don't you think that's useful too? And BTW thanks also for your thanks in the source file but I think I had nothing to do with the Touchpins?! Also it's fletsche not fletche.