Modifications

Sauter à la navigation Sauter à la recherche
2 157 octets ajoutés ,  21 juillet 2015 à 10:25
Page créée avec « {{RASP-PiTFT-PLUS-NAV}} {{traduction}} == Le rétro-éclairage == {{bloc-etroit|text=The backlight of the 3.5" display has 6 LEDs in a row, and we use a boost converter to ... »
{{RASP-PiTFT-PLUS-NAV}}

{{traduction}}

== Le rétro-éclairage ==
{{bloc-etroit|text=The backlight of the 3.5" display has 6 LEDs in a row, and we use a boost converter to get the 5V from the Pi up to the ~20V needed to light up all the LEDs. By default, the backlight's on...but you can control it in two ways.}}

== GPIO du STMPE ==
First option is to just turn it on and off using the extra GPIO created by the touchscreen driver

Start by getting access to the GPIO by making a device link

<nowiki>sudo sh -c "echo 508 > /sys/class/gpio/export"
ls -l /sys/class/gpio</nowiki>

{{ADFImage|RASP-PiTFT-PLUS-retroeclairage-00.png|480px}}

Once you verify that you see GPIO #508, then you can set it to an output, this will turn off the display since it will output 0 by default

<nowiki>sudo sh -c "echo 'out' > /sys/class/gpio/gpio508/direction"</nowiki>

Then turn the display back on with

<nowiki>sudo sh -c "echo '1' > /sys/class/gpio/gpio508/value"</nowiki>

or back off

<nowiki>sudo sh -c "echo '0' > /sys/class/gpio/gpio508/value"</nowiki>

{{ADFImage|RASP-PiTFT-PLUS-retroeclairage-01.png|480px}}

== GPIO #18: Contrôler la luminosité ==
If you want more precise control, you can use the PWM output on GPIO 18. There's python code for controlling the PWM but you can also just use the kernel module and shell commands.


If you did the above commands, you'll need to turn off the STMPE GPIO which overrides the PWM output. You only have to run this if you set GPIO508 to an output in the previous option

<nowiki>sudo sh -c "echo 'in' > /sys/class/gpio/gpio508/direction"</nowiki>

OK now you can set the GPIO #18 pin to PWM mode using WiringPi's '''gpio''' command

With these basic shell commands, you can set the GPIO #18 pin to PWM mode with 1000 Hz frequency, set the output to 100 (out of 1023, so dim!), set the output to 1023 (out of 1023, nearly all the way on) and 0 (off)

<nowiki>gpio -g mode 18 pwm
gpio pwmc 1000
gpio -g pwm 18 100
gpio -g pwm 18 1023
gpio -g pwm 18 0</nowiki>

{{ADFImage|RASP-PiTFT-PLUS-retroeclairage-02.png|480px}}

Try other numbers, from 0 (off) to 1023 (all the way on)!
{{RASP-PiTFT-PLUS-TRAILER}}
29 918

modifications

Menu de navigation