『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 3563|回复: 0

[进阶教程] 给你的pi加一个3.5的触摸屏

[复制链接]

26

主题

176

帖子

726

积分

高级会员

Rank: 4

积分
726
金钱
550
HASS币
0
发表于 2018-4-23 09:27:18 | 显示全部楼层 |阅读模式
本帖最后由 hdcola 于 2018-4-23 15:24 编辑

前段时间有朋友给我寄来三台带触摸屏的pi,折腾半天。记要如下:

安装驱动

git clone https://github.com/hdcola/LCD-show.git
cd LCD-show
chmod +x *
sudo ./LCD35-show

如果一切都ok,你就可以用sudo reboot重启就ok了。

如果想切回HDMI

sudo ./LCD-hdmi

旋转屏幕

旋转显示

适用于 GPIO 接口型 LCD(2.4 寸,2.8 寸,3.2 寸,3.5 寸)

为了让电源冲上,立着看屏幕需要设置旋转

sudo vi /boot/config.txt

找到dtoverlay=tft35a,改为

dtoverlay=tft35a:rotate=270

270度是电源冲上的,到底是0、90、180合适,自己reboot后观察效果决定吧。

适用于HDMI接口型LCD
sudo nano /boot/config.txt

找到display_rotate改为

display_rotate=0

这里0为0度、1为90度、2为180度、3为270度、0x10000为水平翻转、0x20000为垂真翻转。

旋转触摸屏

sudo vi /etc/X11/xorg.conf.d/99-calibration.conf

默认的配置是这样(旋转0度,display_rotate=0):

Section "InputClass"
  Identifier "calibration"
  MatchProduct "ADS7846 Touchscreen"
  Option "Calibration" "140 3951 261 3998 "
  Option "SwapAxes" "0"
EndSection

如果旋转90度,display_rotate=1,则更改为

Section "InputClass"
  Identifier "calibration"
  MatchProduct "ADS7846 Touchscreen"
  Option "Calibration" "261 3998 3951 140"
  Option "SwapAxes" "1"
EndSection

如果旋转180度,display_rotate=2,则更改为

Section "InputClass"
  Identifier "calibration"
  MatchProduct "ADS7846 Touchscreen"
  Option "Calibration" "3951 140 3998 261"
  Option "SwapAxes" "0"
EndSection

如果旋转270度,display_rotate=3,则更改为

Section "InputClass"
  Identifier "calibration"
  MatchProduct "ADS7846 Touchscreen"
  Option "Calibration" "3998 261 140 3951"
  Option "SwapAxes" "1"
EndSection

如此麻烦的东西,反正我是没有想改的心了。


我自己的笔记记在: https://github.com/hdcola/hdhome/blob/master/hassbian.md#35寸lcd触摸屏 有变化还会持续更新。

注:原来github上的lcd-show脚本不兼容hassbian,我做了点小修改。

评分

参与人数 1金钱 +8 收起 理由
neroxps + 8 谢谢分享!

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-26 22:54 , Processed in 0.047440 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表