惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Last Watchdog
The Last Watchdog
博客园_首页
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
美团技术团队
小众软件
小众软件
V
V2EX
博客园 - Franky
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
Attack and Defense Labs
Attack and Defense Labs
S
Security Affairs
Simon Willison's Weblog
Simon Willison's Weblog
I
Intezer
T
The Exploit Database - CXSecurity.com
有赞技术团队
有赞技术团队
S
Schneier on Security
人人都是产品经理
人人都是产品经理
Security Archives - TechRepublic
Security Archives - TechRepublic
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
K
Kaspersky official blog
PCI Perspectives
PCI Perspectives
AI
AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
罗磊的独立博客
O
OpenAI News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The Register - Security
The Register - Security
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
博客园 - 【当耐特】
C
Cisco Blogs
大猫的无限游戏
大猫的无限游戏
Help Net Security
Help Net Security
Google DeepMind News
Google DeepMind News
S
Securelist
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Proofpoint News Feed
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
L
LangChain Blog
SecWiki News
SecWiki News
博客园 - 叶小钗
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V2EX - 技术
V2EX - 技术
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
L
LINUX DO - 热门话题
Cisco Talos Blog
Cisco Talos Blog

博客园 - Andy Yang

SharePoint中Event Handler的触发 扩展SharePoint链接字段 树莓派的连接 树莓派版的家用NAS服务器 修改树莓派更新源及设置代理配置 开启树莓派的硬件看门狗功能 树莓派上使用蚂蚁矿机挖矿 如何编译树莓派内核 代码导出Reporting Services报表文件 Bit-Coin收入的一分钱 如何在树莓派上运行雷神之锤III 新树莓派入手 如何通过PowerShell在Visual Studio的Post-build中预热SharePoint站点 将SharePoint 2010的快速启动改成弹出菜单样式 在SharePoint 2010的Team Site首页上显示Flash文件 SharePoint 2010搜索起步(下) SharePoint 2010搜索起步(上) 2009上班第一天 软件开发与心理张力
树莓派上安装2.8寸TFT触摸屏
Andy Yang · 2014-06-24 · via 博客园 - Andy Yang

在某宝的这里买了一个2.8寸的TFT触摸屏,其实就是中国版的ADAFRUIT

结合店家的帮助文档做了一下,一次点亮,这里也记录一下自己的安装过程(话说会硬件是会比会软件有不同的乐趣~~~

由于店家推荐使用Raspbian2013-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"
   Identifier      "calibration"
   MatchProduct    "stmpe-ts"
   Option  "Calibration"   "3800 120 200 3900"
   Option  "SwapAxes"      "1"
   Option "EmulateThirdButton" "1"
   Option "EmulateThirdButtonTimeout" "750"
   Option "EmulateThirdButtonMoveThreshold" "30"
EndSection

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

//查看会出现eventx)的事件(这步可做可不做)

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-6x12framebuffer only

以上字体比较适合2.8tft

//// 显示图像

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