You cannot use I2S audio and control the backlight at the same time. They both use GPIO #18!
Unlike the resistive 2.8" PiTFT, this little PiTFT does not have a resistive touch controller chip that we can take advantage of as an extra backlight control pin. Instead, you can set use GPIO #18 as an on/off or PWM control.
Note that if you are playing audio out the headphone jack, you can't use the PWM capabilities of GPIO #18 at the same time, the PWM function is reassigned to do audio. However, you can use it as a simple on/off pin
There's python code available for controlling the PWM on #18 but you can also just use the kernel module and shell commands.
With these basic shell commands, you can set the GPIO #18 pin to PWM mode, set the output to 100 (out of 1023, so dim!), set the output to 1000 (out of 1023, nearly all the way on) and 0 (off)
sudo apt-get install wiringpi gpio -g mode 18 pwm gpio -g pwm 18 100 gpio -g pwm 18 1000 gpio -g pwm 18 0
Try other numbers, from 0 (off) to 1023 (all the way on)!
Page last edited April 02, 2024
Text editor powered by tinymce.