1.44LCD fbtft移植
LCD为微雪电子的1.44寸LCD
http://www.waveshare.net/shop/1.44inch-LCD-HAT.htm
在不加任何东西的情况下,树莓派最新镜像显示如下:
pi@raspberrypi:~ $ ls /dev/f
fd/ full fuse
这里发现毛都没有,如果是显示的话,应该有个类似fb*/之类的设备
sudo nano /etc/modules
添加:
spi-bc m2835 fbtft_device
新建文件:
sudo nano /etc/modprobe.d/fbtft.conf
添加:(注意是一行语句)
options fbtft_device name=adafruit18_green gpios=reset:27,dc:25,cs:8,led:24 speed=40000000 bgr=1 fps=60 custom=1 height=128 width=128 rotate=180
重启
sudo reboot
此时屏幕会黑,运行:
dmesg | grep “fb”
pi@raspberrypi:~ $ dmesg | grep "fb"
[ 0.271845] pci_bus 0000:00: root bus resource [mem 0x600000000-0x603ffffff] (bus address [0xf8000000-0xfbffffff])
[ 2.349862] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[ 2.356511] fbtft_device: module is from the staging directory, the quality is unknown, you have been warned.
[ 2.358354] fbtft_device: GPIOS used by 'adafruit18_green':
[ 2.358365] fbtft_device: 'reset' = GPIO27
[ 2.358378] fbtft_device: 'dc' = GPIO25
[ 2.358392] fbtft_device: 'cs' = GPIO8
[ 2.358404] fbtft_device: 'led' = GPIO24
[ 2.358436] spi spi0.0: fb_st7735r spi0.0 40000kHz 8 bits mode=0x00
[ 3.312485] fb_st7735r: module is from the staging directory, the quality is unknown, you have been warned.
[ 4.224581] graphics fb0: fb_st7735r frame buffer, 128x128, 32 KiB video memory, 4 KiB buffer memory, fps=100, spi0.0 at 40 MHz
[ 4.902039] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Feb 27 2018 03:15:32 version 7.45.154 (r684107 CY) FWID 01-4fbe0b04
此时查看:
pi@raspberrypi:~ $ ls /dev/fb*
/dev/fb0
看到有这个出来我就知道成功了,并且如果接了屏幕的话,屏幕应该是黑了的
好了,继续执行
sudo apt-get install cmake git
cd ~
git clone https://github.com/tasanakorn/rpi-fbcp
cd rpi-fbcp/
mkdir build
cd build/
cmake ..
make
sudo cp fbcp /usr/bin
sudo chmod +x /usr/bin/fbcp
sudo nano /etc/rc.local
在"exit 0"前添加:
/usr/bin/fbcp &
在/boot/config.txt 文件中设置用户界面显示尺寸
sudo vi /boot/config.txt
添加:
hdmi_force_hotplug = 1
hdmi_cvt = 128 128 60 1 0 0 0
hdmi_group = 2
hdmi_mode = 1
hdmi_mode = 87
display_rotate = 1
重启:
sudo reboot
屏幕有光标在闪,输入用户名和密码,进入界面: