1.官方文档快速上手,安装驱动,下载QPYcom
QuecPython 快速入门 - QuecPython (quectel.com)https://python.quectel.com/doc/Getting_started/zh/index.html
注意:
(1)打开开发板步骤
成功打开之后就可以连接开发板了
(2)选择正确的串口
2.体验出厂固件
(1)下载固件以及脚本
链接:https://pan.baidu.com/s/1p3r3EglmYc1qoOAypOBltA?pwd=b4mz
提取码:b4mz
(2)烧录固件
(3)成功显示
1)无法触摸问题
这里我遇到了触摸失灵的问题,经过查看文档, 首先确保触摸开启
开启后便可以进行触摸点击,但重启开发板后,依然无法触摸,经过一番排查,只需要在QPYcom交互模式中输入
gpio40 = Pin(Pin.GPIO40, Pin.OUT, Pin.PULL_PD, 0)
引脚号 引脚号 输出模式 下拉模式 低电平
便可以正常触摸,但是main.py中已经执行过这句,所以不能确定问题出在哪里
3.初试QPython
本次研究方向主要是偏向LCD屏开发,下载vscode工具(方便些py脚本)
(1)点亮LCD屏幕
以下代码参考自出厂脚本demo及官方文档
1)lcd_init初始化
from machine import LCD
from machine import Pin
lcd = LCD() #创建lcd对象
lcd.lcd_init(type=3,width=480,hight=854) #初始化LCD
gpio1 = Pin(Pin.GPIO27, Pin.OUT, Pin.PULL_PU, 1) #引脚开启
gpio2 = Pin(Pin.GPIO8, Pin.OUT, Pin.PULL_PU, 1)
lcd.lcd_clear(0xffff) #刷新屏幕为白色
2)mipi_init初始化
from machine import LCD
from machine import Pin
init_480X854 = (
0x11,0,0, #命令为0x11, 延时0ms, 命令所接参数无
0xFF,120,5,0x77,0x01,0x00,0x00,0x10, #命令为0xFF,延时120ms, 命令对应5个参数数据,分别为 #0x77,0x01,0x00,0x00,0x10
0xC0,0,2,0xE9,0x03, #命令为0xC0, 延时0ms, 命令对应2个参数数据,分别为 #0xE9,0x03
0xC1,0,2,0x11,0x02, # ... 下面依此类推
0xC2,0,2,0x31,0x08,
0xCC,0,1,0x10,
0xB0,0,16,0x00,0x0D,0x14,0x0D,0x10,0x05,0x02,0x08,0x08,0x1E,0x05,0x13,0x11,0xA3,0x29,0x18,
0xB1,0,16,0x00,0x0C,0x14,0x0C,0x10,0x05,0x03,0x08,0x07,0x20,0x05,0x13,0x11,0xA4,0x29,0x18,
0xFF,0,5,0x77,0x01,0x00,0x00,0x11,
0xB0,0,1,0x6C,
0xB1,0,1,0x43,
0xB2,0,1,0x07,
0xB3,0,1,0x80,
0xB5,0,1,0x47,
0xB7,0,1,0x85,
0xB8,0,1,0x20,
0xB9,0,1,0x10,
0xC1,0,1,0x78,
0xC2,0,1,0x78,
0xD0,0,1,0x88,
0xE0,100,3,0x00,0x00,0x02,
0xE1,0,11,0x08,0x00,0x0A,0x00,0x07,0x00,0x09,0x00,0x00,0x33,0x33,
0xE2,0,13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xE3,0,4,0x00,0x00,0x33,0x33,
0xE4,0,2,0x44,0x44,
0xE5,0,16,0x0E,0x60,0xA0,0xA0,0x10,0x60,0xA0,0xA0,0x0A,0x60,0xA0,0xA0,0x0C,0x60,0xA0,0xA0,
0xE6,0,4,0x00,0x00,0x33,0x33,
0xE7,0,2,0x44,0x44,
0xE8,0,16,0x0D,0x60,0xA0,0xA0,0x0F,0x60,0xA0,0xA0,0x09,0x60,0xA0,0xA0,0x0B,0x60,0xA0,0xA0,
0xEB,0,7,0x02,0x01,0xE4,0xE4,0x44,0x00,0x40,
0xEC,0,2,0x02,0x01,
0xED,0,16,0xAB,0x89,0x76,0x54,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x10,0x45,0x67,0x98,0xBA,
0xFF,0,5,0x77,0x01,0x00,0x00,0x00,
0x3A,0,1,0x77,
0x36,0,1,0x00,
0x35,0,1,0x00,
0x29,0,0)
mipilcd = LCD()
mipilcd.mipi_init(initbuf=bytearray(init_480X854), TransMode=1)
gpio1 = Pin(Pin.GPIO27, Pin.OUT, Pin.PULL_PU, 1) #引脚开启
gpio2 = Pin(Pin.GPIO8, Pin.OUT, Pin.PULL_PU, 1)
lcd.lcd_clear(0xffff) #刷新屏幕为白色
(2) LCD函数及问题
在命令行中查看LCD类,并未发现提供 lcd_show_jpg 函数,官方文档却提供了这个函数,可能是使用的固件未包含,官方的固件我都下载测试过,都没有这个函数,有思路的朋友可以提供一下
其他函数均可使用,有需要的朋友自行尝试
注意:
1)py测试文件不要以main.py命名,开发板启动会自动运行main文件
2)不要重复初始化操作,会报错