]> git.plutz.net Git - blast/blob - modules/display_ws5inch.mk
introduce touchscreen rotation as variable
[blast] / modules / display_ws5inch.mk
1 ifndef display_rotate
2   display_rotate := 0
3 endif
4
5 ifeq "${display_rotate}" "0"
6   display_touch_calibration := 200 3950 250 4000
7 else ifeq "${display_rotate}" "2"
8   display_touch_calibration := 3950 200 4000 250
9 endif
10
11 define RPICONFIG +=
12
13 ### Waveshare 5 Inch Display ###
14 hdmi_group=2
15 hdmi_mode=87
16 hdmi_cvt=800 480 60 6 0 0 0
17 hdmi_drive=1
18 dtparam=i2c_arm=on
19 dtparam=spi=on
20 enable_uart=1
21 dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
22 # Display is better readable from top direction
23 display_rotate=${display_rotate}
24 endef
25
26 define display_ws5inch_cfg :=
27 Section "InputClass"
28         Identifier "evdev touchscreen catchall"
29         MatchIsTouchscreen "on"
30         Option  "Calibration"   "${display_touch_calibration}"
31         MatchDevicePath "/dev/input/event*"
32         Driver "evdev"
33 EndSection
34 endef
35
36 export display_ws5inch_cfg
37
38 PACKAGES += xserver-xorg-input-evdev xinput xinput-calibrator
39
40 .PHONY: _display_ws5inch
41 _config: _display_ws5inch
42 _display_ws5inch: ${CFGROOT} _copy _mount
43         mkdir -p "$${CFGROOT}/usr/share/X11/xorg.conf.d/"
44         printf '%s\n' "$${display_ws5inch_cfg}" >"$${CFGROOT}/usr/share/X11/xorg.conf.d/45-evdev.conf"
45         mkdir -p "$${CFGROOT}/etc/X11/Xsession.d/"
46         printf 'xrandr --size 800x480\n' >"$${CFGROOT}/etc/X11/Xsession.d/10display_resolution"