RASP-PiTFT-PLUS-Touch
Introduction
If you've grabbed our Easy Install image, or use the script, this step is not required, it's already done! This is just for advanced users who are curious on how to configure and customize the touchscreen |
Crédit: AdaFruit Industries www.adafruit.com
Configurer l'écran tactile
Now that the screen is working nicely, we'll take care of the touchscreen. There's just a bit of calibration to do, but it isn't hard at all.
Before we start, we'll make a udev rule for the touchscreen. That's because the eventX name of the device will change a lot and its annoying to figure out what its called depending on whether you have a keyboard or other mouse installed.
Run
sudo nano /etc/udev/rules.d/95-stmpe.rules
to create a new udev file and copy & paste the following line in:
SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen"
Crédit: AdaFruit Industries www.adafruit.com
Remove and re-install the touchscreen with
sudo rmmod stmpe_ts; sudo modprobe stmpe_ts
Then type ls -l /dev/input/touchscreen It should point to eventX where X is some number, that number will be different on different setups since other keyboards/mice/USB devices will take up an event slot
Crédit: AdaFruit Industries www.adafruit.com
There are some tools we can use to calibrate & debug the touchscreen. Install the "event test" and "touchscreen library" packages with
sudo apt-get install evtest tslib libts-bin
Crédit: AdaFruit Industries www.adafruit.com
Now you can use some tools such as sudo evtest /dev/input/touchscreen which will let you see touchscreen events in real time, press on the touchscreen to see the reports.
Crédit: AdaFruit Industries www.adafruit.com
Crédit: AdaFruit Industries www.adafruit.com
Script de calibration automatique
If you rotate the display you need to recalibrate the touchscreen to work with the new screen orientation. You can manually run the calibration processes in the next section, or you can run a small Python script which will automatically set a default touchscreen calibration based on the screen orientation.
This helper is automatically installed for you but if you'd like you can check it out here on github
Run it at the command line with sudo adafruit-pitft-touch-cal
it will try to figure out what display you have installed and the rotation it's set up for
Crédit: AdaFruit Industries www.adafruit.com
Source: Adafruit PiTFT 3.5" Touch Screen for Raspberry Pi
Créé par LadyAda pour AdaFruit Industries.
Traduction réalisée par Meurisse D pour MCHobby.be.
Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : « Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.
L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.
Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com