“如何旋转显示和触摸(电容触摸)”的版本间的差异
来自LCD wiki
(未显示2个用户的8个中间版本) | |||
第1行: | 第1行: | ||
− | { | + | |
− | | | + | {{lan |
− | + | | | |
− | + | cn=http://www.lcdwiki.com/zh/%E5%A6%82%E4%BD%95%E6%97%8B%E8%BD%AC%E6%98%BE%E7%A4%BA%E5%92%8C%E8%A7%A6%E6%91%B8(%E7%94%B5%E5%AE%B9%E8%A7%A6%E6%91%B8) | |
− | | | + | | |
− | + | en=http://www.lcdwiki.com/How_to_modify_the_display_orientation-CTP(En) | |
+ | }} | ||
<font color="red">'''本文操作只适用于树莓派HDMI电容触摸显示器,不适用于GPIO电阻屏'''</font> | <font color="red">'''本文操作只适用于树莓派HDMI电容触摸显示器,不适用于GPIO电阻屏'''</font> | ||
− | == <font color="blue">如何旋转显示:</font> == | + | == <font color="blue">'''如何旋转显示:'''</font> == |
+ | |||
1. 打开'''config.txt文件'''(config.txt文件位于Micro SD卡根目录,即/boot中): | 1. 打开'''config.txt文件'''(config.txt文件位于Micro SD卡根目录,即/boot中): | ||
− | + | {{code|1= | |
sudo nano /boot/config.txt | sudo nano /boot/config.txt | ||
− | + | }} | |
− | 2. 在'''config.txt''' | + | 2. 在'''config.txt'''文件中加入下面语句, 然后按Ctrl+X键退出, 按Y键确定保存即可 |
− | + | {{code|1=display_rotate=1 #0: 0; 1: 90; 2: 180; 3: 270}} | |
3. 保存后重启树莓派即可 | 3. 保存后重启树莓派即可 | ||
− | + | {{code|1=sudo reboot}} | |
== <font color="blue">'''如何旋转触摸:'''</font> == | == <font color="blue">'''如何旋转触摸:'''</font> == | ||
在进行显示旋转后,需要对触摸做出修改,否则不能与显示对应。 | 在进行显示旋转后,需要对触摸做出修改,否则不能与显示对应。 | ||
− | 1. | + | 1. 安装libinput |
− | + | {{code|1= | |
sudo apt-get install xserver-xorg-input-libinput | sudo apt-get install xserver-xorg-input-libinput | ||
− | + | }} | |
− | 2. | + | 2. 在/etc/X11/下创建xorg.conf.d目录 (如果该目录已存在,则直接进行第3步) |
− | + | {{code|1= | |
sudo mkdir /etc/X11/xorg.conf.d | sudo mkdir /etc/X11/xorg.conf.d | ||
− | + | }} | |
− | 3. | + | 3. 复制40-libinput-conf 文件到刚刚创建的目录下 |
− | + | {{code|1= | |
sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/ | sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/ | ||
− | + | }} | |
− | 4. | + | 4. 编辑/etc/X11/xorg.conf.d/40-libinput.conf |
− | + | {{code|1= | |
sudo nano /etc/X11/xorg.conf.d/40-libinput.conf | sudo nano /etc/X11/xorg.conf.d/40-libinput.conf | ||
− | + | }} | |
找到 touchscreen的部分,在里面添加以下语句,然后按Ctrl+X键退出, 按Y键确定保存即可 | 找到 touchscreen的部分,在里面添加以下语句,然后按Ctrl+X键退出, 按Y键确定保存即可 | ||
+ | {{code|1= | ||
+ | Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1" | ||
+ | }} | ||
+ | 例如: | ||
− | + | [[文件:MPI5001-Calibration.jpg|无框|706x706像素]] | |
− | |||
− | |||
5. 重启树莓派 | 5. 重启树莓派 | ||
− | + | {{code|1= | |
sudo reboot | sudo reboot | ||
− | + | }} | |
完成以上步骤即可进行90度旋转。 | 完成以上步骤即可进行90度旋转。 |
2018年7月13日 (五) 19:57的最新版本
本文操作只适用于树莓派HDMI电容触摸显示器,不适用于GPIO电阻屏
如何旋转显示:
1. 打开config.txt文件(config.txt文件位于Micro SD卡根目录,即/boot中):
sudo nano /boot/config.txt
2. 在config.txt文件中加入下面语句, 然后按Ctrl+X键退出, 按Y键确定保存即可
display_rotate=1 #0: 0; 1: 90; 2: 180; 3: 270
3. 保存后重启树莓派即可
sudo reboot
如何旋转触摸:
在进行显示旋转后,需要对触摸做出修改,否则不能与显示对应。
1. 安装libinput
sudo apt-get install xserver-xorg-input-libinput
2. 在/etc/X11/下创建xorg.conf.d目录 (如果该目录已存在,则直接进行第3步)
sudo mkdir /etc/X11/xorg.conf.d
3. 复制40-libinput-conf 文件到刚刚创建的目录下
sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
4. 编辑/etc/X11/xorg.conf.d/40-libinput.conf
sudo nano /etc/X11/xorg.conf.d/40-libinput.conf
找到 touchscreen的部分,在里面添加以下语句,然后按Ctrl+X键退出, 按Y键确定保存即可
Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
例如:
5. 重启树莓派
sudo reboot
完成以上步骤即可进行90度旋转。
注:
0 度旋转对应参数: Option "CalibrationMatrix" "1 0 0 0 1 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"