In the datasheet of a PAM8302A, which is a class-D amplifier, the recommended circuit is as follows:
I have seen many people also use a variable resistor (potentiometer) at the input. I do not understand the role of the variable resistor as the signal is just on-off and not analog.
Can I connect IN-
to the ground and get IN+
right from a PWM GPIO pin of a STM32 microcontroller (3.3 V) without any resistor and capacitor?
Clarification:
I am using PWM pin from the microcontroller to control the speaker signal via its duty cycle. I do not use analog output from my microcontroller, so the input to the PAM8302A is an ON/OFF signal rather than the wave form of the sound.