admin管理员组

文章数量:1570425

HDMI屏:

1、显示旋转:

 这样屏幕显示就旋转过来了,但点击屏幕会发现,我们手指往左或往右滑时,屏幕指针却实际上是往上或往上动的,这是因为触摸方向并没有旋转过来

2、触摸方向旋转

sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf

找到touchscreen这个section,添加如下一行:

Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1"

备注:

90度:Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"

180度:Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1"

270度:Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1"

LCD屏:

在config.txt文件最后,加入以下对应旋转角度的命令(config文件位于TF卡根目录,也可以通过命令访问:sudo nano /boot/config.txt):

  1. #旋转90度
  2. display_lcd_rotate=1
  3. dtoverlay=rpi-ft5406,touchscreen-swapped-x-y=1,touchscreen-inverted-x=1
  4. #旋转180度
  5. display_lcd_rotate=2
  6. dtoverlay=rpi-ft5406,touchscreen-inverted-x=1,touchscreen-inverted-y=1
  7. #旋转270度
  8. display_lcd_rotate=3
  9. dtoverlay=rpi-ft5406,touchscreen-swapped-x-y=1,touchscreen-inverted-y=1

注:如果是Raspberry Pi 4,还需要把dtoverlay=vc4-fkms-V3D注释掉

sudo reboot

就好了

本文标签: 触摸屏树莓派