树莓派上安装2.8寸TFT触摸屏
作者:互联网
在某宝的这里买了一个2.8寸的TFT触摸屏,其实就是中国版的ADAFRUIT
结合店家的帮助文档做了一下,一次点亮,这里也记录一下自己的安装过程(话说会硬件是会比会软件有不同的乐趣~~~)
由于店家推荐使用Raspbian的2013-09-25版本,所以我也换了一块SD卡重新安装了一遍
安装店家提供的2013-09-25版系统(参考树莓派的官网安装方法),更新系统
sudo apt-get update sudo apt-get upgrade
//// 内核补丁 cd ~ // 下载内核补丁 wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-bin-adafruit.deb wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-dev-adafruit.deb wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-doc-adafruit.deb wget http://adafruit-download.s3.amazonaws.com/libraspberrypi0-adafruit.deb wget http://adafruit-download.s3.amazonaws.com/raspberrypi-bootloader-adafruit-112613.deb // 安装内核补丁 sudo dpkg -i -B *.deb // 重启 sudo reboot
//// 安装、测试TFT驱动 sudo modprobe spi-bcm2708 sudo modprobe fbtft_device name=adafruitts rotate=90 export FRAMEBUFFER=/dev/fb1 startx
//// 显示驱动自动加载 sudo nano /etc/modules //增加以下两行 spi-bcm2708 fbtft_device sudo nano /etc/modprobe.d/adafruit.conf // 添加一行 options fbtft_device name=adafruitts rotate=90 frequency=32000000 sudo mkdir /etc/X11/xorg.conf.d sudo nano /etc/X11/xorg.conf.d/99-calibration.conf // 写入如下内容
Section "InputClass"
FRAMEBUFFER=/dev/fb1 startx sudo nano ~/.profile //在文件最后添加 export FRAMEBUFFER=/dev/fb1 // 重启 sudo reboot
// 矫正触摸 sudo nano /etc/udev/rules.d/95-stmpe.rules //新加入如下内容 SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen" //重新加载驱动 sudo rmmod stmpe_ts; sudo modprobe stmpe_ts //查看会出现event(x)的事件(这步可做可不做) ls -l /dev/input/touchscreen //安装矫正的程序 sudo apt-get install evtest tslib libts-bin //这里直接直接测试触摸硬件,系统打印坐标,ctrl+c结束(这步可做可不做) sudo evtest /dev/input/touchscreen //矫正开始 sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_calibrate //矫正测试,可以当画图板,画图形:) ctrl+c结束 sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_test
//// 当终端显示器 sudo nano /boot/cmdline.txt //在rootwait 后面添加如下内容 fbcon=map:10 fbcon=font:VGA8x8 sudo dpkg-reconfigure console-setup UTF-8 -》Guess optimal character set -》Terminus-》6x12(framebuffer only) 以上字体比较适合2.8的tft
//// 显示图像 sudo apt-get install fbi wget http://adafruit-download.s3.amazonaws.com/adapiluv320x240.jpg sudo fbi -T 2 -d /dev/fb1 -noverbose -a adapiluv320x240.jpg
//// 控制背光 sudo sh -c "echo 252 > /sys/class/gpio/export" sudo ls -l /sys/class/gpio sudo sh -c "echo 'out' > /sys/class/gpio/gpio252/direction" // 关闭背光 sudo sh -c "echo '0' > /sys/class/gpio/gpio252/value" // 开启背光 sudo sh -c "echo '1' > /sys/class/gpio/gpio252/value"
//// 开关机按钮控制 sudo nano /etc/modules // 添加下行 rpi_power_switch sudo nano /etc/modprobe.d/adafruit.conf //增加下面内容,23号开关键就是最左侧的按钮 options rpi_power_switch gpio_pin=23 mode=0 sudo modprobe rpi_power_switch
//// 播放动画 sudo apt-get install mplayer wget http://adafruit-download.s3.amazonaws.com/bigbuckbunny320p.mp4 mplayer -vo fbdev2:/dev/fb1 -x 240 -y 320 -framedrop bigbuckbunny320p.mp4 |
效果图
参考文档
http://www.arduinoking.com/forum.php?mod=viewthread&tid=1&extra=page%3D1
http://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi?view=all
Andy Yang
2014.06.24
转载于:https://www.cnblogs.com/zygoses2gether/p/3805644.html
标签:树莓,http,nano,sudo,adafruit,dev,2.8,TFT,com 来源: https://blog.csdn.net/weixin_30399797/article/details/96824694