树莓派驱动1.44寸TFT液晶并实时显示摄像头图像

**

需要什么

**
一块lcd ,市面上大多数为spi ,i2c驱动的lcd,我这块是比赛剩下的模拟8080端口驱动。区别不大,仅需改动发送数据的函数
一个摄像头,我这里使用的是某宝17块钱买来的ovxx具体多少忘了,树莓派自带驱动。
opencv,仅用来把摄像头传来的图片转为lcd可显示的bgr565格式,也可不使用自行编写转化函数(百度一下马上知道)。
picamera,树莓派自带的摄像头驱动库,import即可使用

端口定义

树莓派驱动1.44寸TFT液晶并实时显示摄像头图像_第1张图片
驱动芯片为ST7735,8080并口发送数据
RST(复位线)
DB0~DB7(数据线)
RS(数据/指令选择线,1:数据读写,0:命令读写
CS(片选信号线)

下面是最终的成品,效率有待提升,可以看见屏幕刷新的条纹
树莓派驱动1.44寸TFT液晶并实时显示摄像头图像_第2张图片
下面上代码
**

底层代码

**

端口及一些参数定义

import RPi.GPIO as GPIO
import time
# 引脚定义
LCD__CS = 5
LCD_RST = 6
LCD_WR = 13
LCD_RS = 19
LCD_RD = 26
LCD_SIGN = [LCD__CS, LCD_RST, LCD_WR, LCD_RS, LCD_RD]
LCD_D0 = 21
LCD_D1 = 20
LCD_D2 = 16
LCD_D3 = 12
LCD_D4 = 7
LCD_D5 = 8
LCD_D6 = 25
LCD_D7 = 24
LCD_DATA = [LCD_D7, LCD_D6, LCD_D5, LCD_D4, LCD_D3, LCD_D2, LCD_D1, LCD_D0]
#液晶大小
X_ORIGIN = 0
Y_ORIGIN = 0
X_MAX_PIXEL = 128
Y_MAX_PIXEL = 128
 
#存储颜色
COLORLIST = []
# 颜色代码
RED = 0xf800
GREEN = 0x07e0
BLUE = 0x001f
WHITE = 0xffff
BLACK = 0x0000
YELLOW = 0xFFE0
GRAY0 = 0xEF7D
GRAY1 = 0x8410
GRAY2 = 0x4208

**

gpio端口的初始化,使用BCM模式

**

# gpio初始化
def gpio_init():
    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(LCD_WR, GPIO.OUT, initial=GPIO.LOW)
    GPIO.setup(LCD_RD, GPIO.OUT, initial=GPIO.HIGH)
    GPIO.setup(LCD__CS, GPIO.OUT, initial=GPIO.HIGH)
    GPIO.setup(LCD_RS, GPIO.OUT, initial=GPIO.LOW)
    GPIO.setup(LCD_RST, GPIO.OUT, initial=GPIO.LOW)
    GPIO.setup(LCD_DATA, GPIO.OUT, initial=GPIO.LOW)  # data
    time.sleep(0.1)

为提高效率提前对颜色代码进行转化,如COLORLIST[1]=[False,False,False,False,False,False,False,True]

def bit_to_list(t):
    s = [False for i in range(8)]
    i = -1
    while t != 0:
        if t % 2 == 1:
            s[i] = True
        else:
            s[i] = False
        t = t >> 1
        i -= 1
    return s
# 提前生成颜色列表
def generate_colorlist():
    for i in range(0xff + 1):
        COLORLIST.append(bit_to_list(i))

数据和指令发送函数

# 发送数据
def send(bits):
    GPIO.output(LCD_DATA, COLORLIST[bits])
# 发送8位数据
def Lcd_WriteData(data):
    GPIO.output(LCD__CS, False)
    GPIO.output(LCD_RS, True)
    send(data)
    GPIO.output(LCD__CS, True)
# 发送8位命令
def Lcd_WriteIndex(cmd):
    GPIO.output(LCD__CS, False)
    GPIO.output(LCD_RS, False)
    send(cmd)
    GPIO.output(LCD__CS, True)
# 发送16位数据,颜色
def Lcd_WriteData_16(cmd):
    GPIO.output(LCD__CS, False)
    GPIO.output(LCD_RS, True)
    send(cmd >> 8)
    GPIO.output(LCD__CS, True)
    GPIO.output(LCD__CS, False)
    send(cmd % 256)
    GPIO.output(LCD__CS, True)
# 发送16位数据,少两步
def Lcd_WriteColor_16(cmd1, cmd2):
    GPIO.output(LCD__CS, False)
    GPIO.output(LCD_RS, True)
    send(cmd1)
    GPIO.output(LCD__CS, True)
    GPIO.output(LCD__CS, False)
    send(cmd2)
    GPIO.output(LCD__CS, True)

液晶初始化,主要设置液晶的显示模式,copy别人的,具体设置可参考芯片手册

# 复位
def reset():
    GPIO.output(LCD_RST, False)
    time.sleep(0.1)
    GPIO.output(LCD_RST, True)
    time.sleep(0.1)
# 初始化
def LCD_init():
    generate_colorlist()
    gpio_init()
    reset()
    Lcd_WriteIndex(0x11)
    time.sleep(0.12)
    Lcd_WriteIndex(0xB1)
    Lcd_WriteData(0x01)
    Lcd_WriteData(0x2C)
    Lcd_WriteData(0x2D)
    Lcd_WriteIndex(0xB2)
    Lcd_WriteData(0x01)
    Lcd_WriteData(0x2C)
    Lcd_WriteData(0x2D)
    Lcd_WriteIndex(0xB3)
    Lcd_WriteData(0x01)
    Lcd_WriteData(0x2C)
    Lcd_WriteData(0x2D)
    Lcd_WriteData(0x01)
    Lcd_WriteData(0x2C)
    Lcd_WriteData(0x2D)
    Lcd_WriteIndex(0xB4)
    Lcd_WriteData(0x07)
    Lcd_WriteIndex(0xC0)
    Lcd_WriteData(0xA2)
    Lcd_WriteData(0x02)
    Lcd_WriteData(0x84)
    Lcd_WriteIndex(0xC1)
    Lcd_WriteData(0xC5)
    Lcd_WriteIndex(0xC2)
    Lcd_WriteData(0x0A)
    Lcd_WriteData(0x00)
    Lcd_WriteIndex(0xC3)
    Lcd_WriteData(0x8A)
    Lcd_WriteData(0x2A)
    Lcd_WriteIndex(0xC4)
    Lcd_WriteData(0x8A)
    Lcd_WriteData(0xEE)
    Lcd_WriteIndex(0xC5)
    Lcd_WriteData(0x0E)
    Lcd_WriteIndex(0x36)
    Lcd_WriteData(0xC8)
    Lcd_WriteIndex(0xe0)
    Lcd_WriteData(0x0f)
    Lcd_WriteData(0x1a)
    Lcd_WriteData(0x0f)
    Lcd_WriteData(0x18)
    Lcd_WriteData(0x2f)
    Lcd_WriteData(0x28)
    Lcd_WriteData(0x20)
    Lcd_WriteData(0x22)
    Lcd_WriteData(0x1f)
    Lcd_WriteData(0x1b)
    Lcd_WriteData(0x23)
    Lcd_WriteData(0x37)
    Lcd_WriteData(0x00)
    Lcd_WriteData(0x07)
    Lcd_WriteData(0x02)
    Lcd_WriteData(0x10)
    Lcd_WriteIndex(0xe1)
    Lcd_WriteData(0x0f)
    Lcd_WriteData(0x1b)
    Lcd_WriteData(0x0f)
    Lcd_WriteData(0x17)
    Lcd_WriteData(0x33)
    Lcd_WriteData(0x2c)
    Lcd_WriteData(0x29)
    Lcd_WriteData(0x2e)
    Lcd_WriteData(0x30)
    Lcd_WriteData(0x30)
    Lcd_WriteData(0x39)
    Lcd_WriteData(0x3f)
    Lcd_WriteData(0x00)
    Lcd_WriteData(0x07)
    Lcd_WriteData(0x03)
    Lcd_WriteData(0x10)
    Lcd_WriteIndex(0x2a)
    Lcd_WriteData(0x00)
    Lcd_WriteData(0x00)
    Lcd_WriteData(0x00)
    Lcd_WriteData(0x7f)
    Lcd_WriteIndex(0x2b)
    Lcd_WriteData(0x00)
    Lcd_WriteData(0x00)
    Lcd_WriteData(0x00)
    Lcd_WriteData(0x9f)
    Lcd_WriteIndex(0xF0)
    Lcd_WriteData(0x01)
    Lcd_WriteIndex(0xF6)
    Lcd_WriteData(0x00)
    Lcd_WriteIndex(0x3A)
    Lcd_WriteData(0x05)
    Lcd_WriteIndex(0x29)

开窗,每次想刷新屏幕必须在要刷新的位置开窗。

# 设置显示区域
def LCD_ptlon(site_x, site_y, size_x, size_y):
    site_x = site_x + 2
    site_y = site_y + 3
    Lcd_WriteIndex(0x2a)
    Lcd_WriteData(0x00)
    Lcd_WriteData(site_x)
    Lcd_WriteData(0x00)
    Lcd_WriteData(site_x + size_x - 1)
    Lcd_WriteIndex(0x2B)
    Lcd_WriteData(0x00)
    Lcd_WriteData(site_y)
    Lcd_WriteData(0x00)
    Lcd_WriteData(site_y + size_y - 1)
    Lcd_WriteIndex(0x2c)
# 刷新屏幕,用颜色填满屏幕
def clear(color):
    LCD_ptlon(X_ORIGIN, Y_ORIGIN, X_MAX_PIXEL, Y_MAX_PIXEL)
    for i in range(X_MAX_PIXEL - X_ORIGIN):
        for k in range((Y_MAX_PIXEL - Y_ORIGIN)):
            Lcd_WriteData_16(color)

**

显示代码 能驱动屏幕剩下的都好办了

**

import lcd144 as LCD
import ASII as CHAR
# 画矩形
def LCD_rectangle(site_x, site_y, size_x, size_y, rgb565):
    LCD.LCD_ptlon(site_x, site_y, size_x, size_y)
    for i in range((size_x) * (size_y)):
        LCD.Lcd_WriteData_16(rgb565)
# 写字符
def LCD_char(site_x, site_y, ascii, Color, bkColor):
    l = 0
    LCD.LCD_ptlon(site_x, site_y, 8, 16)
    for i in range(16):
        if ascii < 0x20:
            ascii = ' '
        temp = CHAR.CHARASII[((ascii - 0x20) * CHAR.LED_EN_SIZE) + i]
        for t in range(8):
            if (temp & 0x80):
                LCD.Lcd_WriteData_16(Color)
            else:
                LCD.Lcd_WriteData_16(bkColor)
            temp <<= 1
            l = l + 1
            if l >= CHAR.LCD_EN_W:
                l = 0;
                break;
# 写字符串
def LCD_str(site_x, site_y, str, Color, bkColor):
    len1 = len(str)
    for i in range(len1):
        if site_x + i * 8 < 128:
            LCD_char(site_x + 8 * i, site_y, ord(str[i:i + 1]), Color, bkColor)
#刷新图片
def LCD_pic(size_x,size_y,dst):
    for i in range(size_y):
        for j in range(size_x):
            bgr = dst[i, j]
            LCD.Lcd_WriteColor_16(bgr[1], bgr[0])

**

字符显示所需要的ASII表

**

LCD_EN_H = 16
LCD_EN_W = 8
LED_EN_SIZE = (((LCD_EN_W + 7) // 8) * LCD_EN_H)
CHARASII = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x18, 0x3C, 0x3C, 0x3C, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00,
            0x18, 0x18, 0x7C, 0xC6, 0xC2, 0xC0, 0x7C, 0x06, 0x86, 0xC6, 0x7C, 0x18, 0x18, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0xC2, 0xC6, 0x0C, 0x18, 0x30, 0x60, 0xC6, 0x86, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xCE, 0xD6, 0xD6, 0xE6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x7C, 0xC6, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x7C, 0xC6, 0x06, 0x06, 0x3C, 0x06, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x0C, 0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x0C, 0x0C, 0x1E, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xFE, 0xC0, 0xC0, 0xC0, 0xFC, 0x0E, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x38, 0x60, 0xC0, 0xC0, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xFE, 0xC6, 0x06, 0x06, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x06, 0x0C, 0x78, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x7C, 0xC6, 0xC6, 0x0C, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xDE, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xC0, 0xC0, 0xC2, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xDE, 0xC6, 0xC6, 0x66, 0x3A, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xE6, 0x66, 0x6C, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xF0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xC6, 0xE6, 0xF6, 0xFE, 0xDE, 0xCE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xDE, 0x7C, 0x0C, 0x0E, 0x00, 0x00,
            0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x7C, 0xC6, 0xC6, 0x60, 0x38, 0x0C, 0x06, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x7E, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xC6, 0xC6, 0x6C, 0x6C, 0x38, 0x38, 0x6C, 0x6C, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xFE, 0xC6, 0x86, 0x0C, 0x18, 0x30, 0x60, 0xC2, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C, 0x00, 0x00, 0x00, 0x00,
            0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00,
            0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xE0, 0x60, 0x60, 0x78, 0x6C, 0x66, 0x66, 0x66, 0x66, 0xDC, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x1C, 0x0C, 0x0C, 0x3C, 0x6C, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x38, 0x6C, 0x64, 0x60, 0xF0, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xCC, 0x78, 0x00,
            0x00, 0x00, 0xE0, 0x60, 0x60, 0x6C, 0x76, 0x66, 0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x06, 0x06, 0x00, 0x0E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3C, 0x00,
            0x00, 0x00, 0xE0, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xFE, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0x0C, 0x1E, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x76, 0x62, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0x60, 0x38, 0x0C, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x10, 0x30, 0x30, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x38, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0xF8, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xCC, 0x18, 0x30, 0x60, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x0E, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0E, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00]

**

最后当然是调用这些函数来达到开头的显示效果,这里使用了opencv来把摄像头采集的24位全彩图转化为液晶可显示的16位真彩图。 当然也可以不使用opencv,自己进行转化。`

**

你可能感兴趣的:(树莓派)