环境:树莓派3B
镜像:raspbian buster
屏:避免做广告嫌疑,请自行淘宝,3.5的HDMI触摸屏,480×320的分辨率,90块左右吧
这是屏反面的图片:
安装完成后:
- 安装软件
sudo apt install xserver-xorg-input-evdev
- 修改树莓派的配置文件/boot/config.txt
加入如下语句:
hdimi_force_hotplug=1
dmi_force_edid_auto=1
dtparam=spi=on
display_rotate=0
max_usb_current=1
config_hdmi_boost=7
hdmi_group=2
hdmi_mode=87
hdmi_drive=2
hdmi_cvt 480 320 60 6 0 0 0
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
hdmi_timings=600 0 20 28 48 400 0 13 3 32 0 0 0 30 0 25000000 5
- 加入触屏校准并修改初始化顺序
sudo mkdir /etc/X11/xorg.conf.d/ -p
sudo cp 99-calibration.conf-3508-0 /etc/X11/xorg.conf.d/99-calibration.conf
sudo cp /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.con
- 加入长按右击的功能
在/etc/X11/xorg.conf.d/99-calibration.conf文件中加入
Option "EmulateThirdButton" "1"
Option "EmulateThirdButtonTimeout" "1000"
Option "EmulateThirdButtonMoveThreshold" "300"
- 重启
sudo reboot
99-calibration.conf-3508-0可以在这里下载。
有什么问题,欢迎留言。