Raspberry PI touchscreen

I got a nice case with an embedded 3.5" touchscreen from a chinese supplier, it comes even with a small pen for only a few euros and no shipping, it is incredible. The Display is run from the GPIO pins and has the XPT20It works with jessie more or less out of the box. I wanted to use it in portrait mode and that was a little more complex. So with some Google Fu and trial and error I got it to work with X.

This is what I did:

```shell
# to rotate the display 90 is the default landscape

pi@raspifi:~ $ DISPLAY=:0 xinput list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ADS7846 Touchscreen                       id=6    [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ CHICONY HP Basic USB Keyboard             id=7    [slave  keyboard (3)]
pi@raspifi:~ $ sudo su -
root@raspifi:~ # cat /boot/config.txt
root@raspifi:~ # vi /boot/config.txt
root@raspifi:~ # cat /boot/config.txt

<snip>
dtoverlay=tft35a:rotate=180
<snip>
    
root@raspifi # reboot
# and it will come up with a rotated screen (portrait mode)

# to rotate the touchscreen after the reboot

pi@raspifi $ DISPLAY=:0.0 xinput --set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1in=200,ymax=39

```