Skip to content

Commit 611c5bf

Browse files
committed
add lcd init interface
1 parent 4fd7362 commit 611c5bf

File tree

2 files changed

+83
-2
lines changed

2 files changed

+83
-2
lines changed

en-us/api/QuecPythonClasslib.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6685,7 +6685,7 @@ lcd = LCD() # Create lcd object
66856685

66866686

66876687

6688-
###### LCD Initialization
6688+
###### LCD Initialization (interface 1:LCM interface of the module)
66896689

66906690
> **lcd.lcd_init(lcd_init_data, lcd_width, lcd_hight, lcd_clk, data_line, line_num, lcd_type, lcd_invalid, lcd_display_on, lcd_display_off, lcd_set_brightness)**
66916691

@@ -6717,6 +6717,44 @@ It initializes LCD.
67176717

67186718

67196719

6720+
###### LCD Initialization(interface 2:SPI interface of the module)
6721+
6722+
> **lcd.lcd_init(lcd_init_data, lcd_width, lcd_hight, lcd_clk, data_line, line_num, lcd_type, lcd_invalid, lcd_display_on, lcd_display_off, lcd_set_brightness, lcd_interface, spi_port, spi_mode, cs_pin, dc_pin, rst_pin)**
6723+
6724+
It initializes LCD.
6725+
6726+
- Parameter
6727+
6728+
| Parameter | Type | Description |
6729+
| ------------------ | --------- | ------------------------------------------------------------ |
6730+
| lcd_init_data | bytearray | Inputting configuration commands for LCD. |
6731+
| lcd_width | int | The width of LCD screen, not more than 500. |
6732+
| lcd_hight | int | The height of LCD screen, not more than 500. |
6733+
| lcd_clk | int | SPI clock. refer to the parameter description of Create SPI Object in machine SPI. |
6734+
| data_line | int | Number of data lines, the parameter values are 1 and 2. |
6735+
| line_num | int | The number of lines, the parameter values are 3 and 4. |
6736+
| lcd_type | int | Screen type. 0: rgb; 1: fstn. |
6737+
| lcd_invalid | bytearray | Inputting configuration commands for LCD area settings. |
6738+
| lcd_display_on | bytearray | Inputting configuration commands for LCD screen light. |
6739+
| lcd_display_off | bytearray | Inputting configuration commands for LCD screen off. |
6740+
| lcd_set_brightness | bytearray | Inputting the configuration command of LCD screen brightness. Setting to None indicates that the brightness is controlled by LCD_BL_K (some screens are controlled by registers, and some are controlled by LCD_BL_K) |
6741+
| lcd_interface | int | type of LCD interface. 0:LCM interface;1SPI interface |
6742+
| spi_port | int | Channel selection[0,1],refer to SPI description in machine. |
6743+
| spi_mode | int | SPI working mode (ususally mode 0): <br />Clock polarity CPOL: When SPI is idle, the level of the clock signal SCLK (0: Low level when idle; 1: High level when idle)<br /> 0 : CPOL=0, CPHA=0<br /> 1 : CPOL=0, CPHA=1<br /> 2: CPOL=1, CPHA=0<br /> 3: CPOL=1, CPHA=1 |
6744+
| cs_pin | int | CS PIN,refer to Pin Constant Description |
6745+
| dc_pin | int | DC PIN,refer to Pin Constant Description |
6746+
| rst_pin | int | RST PIN,refer to Pin Constant Description |
6747+
6748+
* Return Value
6749+
6750+
* 0 Successful execution.
6751+
* -1 Initialized.
6752+
* -2 Parameter error (empty or too large (bigger than 1000 pixels)) .
6753+
* -3 Failed cache request.
6754+
* -5 Configuration parameter error.
6755+
6756+
6757+
67206758
###### Clear LCD.
67216759

67226760

zh-cn/api/QuecPythonClasslib.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7138,7 +7138,7 @@ lcd = LCD() # 创建lcd对象
71387138

71397139

71407140

7141-
###### LCD初始化
7141+
###### LCD初始化(接口1:设备接模块LCM接口)
71427142

71437143
> **lcd.lcd_init(lcd_init_data, lcd_width, lcd_hight, lcd_clk, data_line, line_num, lcd_type, lcd_invalid, lcd_display_on, lcd_display_off, lcd_set_brightness)**
71447144

@@ -7175,6 +7175,49 @@ lcd = LCD() # 创建lcd对象
71757175

71767176

71777177

7178+
###### LCD初始化(接口2:设备接模块SPI接口)
7179+
7180+
> **lcd.lcd_init(lcd_init_data, lcd_width, lcd_hight, lcd_clk, data_line, line_num, lcd_type, lcd_invalid, lcd_display_on, lcd_display_off, lcd_set_brightness, lcd_interface, spi_port, spi_mode, cs_pin, dc_pin, rst_pin)**
7181+
7182+
初始化LCD
7183+
7184+
- 参数
7185+
7186+
| 参数 | 类型 | 说明 |
7187+
| ------------------ | --------- | ------------------------------------------------------------ |
7188+
| lcd_init_data | bytearray | 传入 LCD 的配置命令 |
7189+
| lcd_width | int | LCD 屏幕的宽度。宽度不超过 500 |
7190+
| lcd_hight | int | LCD 屏幕的高度。高度不超过 500 |
7191+
| lcd_clk | int | SPI 时钟。见machine SPI 创建SPI对象参数说明clk |
7192+
| data_line | int | 数据线数。参数值为 12|
7193+
| line_num | int | 线的数量。参数值为 34|
7194+
| lcd_type | int | 屏幕类型。0:rgb;1:fstn |
7195+
| lcd_invalid | bytearray | 传入LCD 区域设置的配置命令 |
7196+
| lcd_display_on | bytearray | 传入LCD 屏亮的配置命令 |
7197+
| lcd_display_off | bytearray | 传入LCD 屏灭的配置命令 |
7198+
| lcd_set_brightness | bytearray | 传入LCD屏亮度的配置命令。设置为 None表示由 LCD_BL_K 控制亮度(有些屏幕是由寄存器控制屏幕亮度,有 些是通过 LCD_BL_K 控制屏幕亮度) |
7199+
| lcd_interface | int | LCD接口类型。0LCM接口;1SPI接口 |
7200+
| spi_port | int | 通道选择[0,1],参照SPI部分 |
7201+
| spi_mode | int | SPI 的工作模式(模式0最常用):<br />时钟极性CPOL: 即SPI空闲时,时钟信号SCLK的电平(0:空闲时低电平; 1:空闲时高电平)<br /> 0 : CPOL=0, CPHA=0<br /> 1 : CPOL=0, CPHA=1<br /> 2: CPOL=1, CPHA=0<br /> 3: CPOL=1, CPHA=1 |
7202+
| cs_pin | int | CS引脚,见machine Pin常量说明 |
7203+
| dc_pin | int | DC引脚,见machinePin常量说明 |
7204+
| rst_pin | int | RST引脚,见machinePin常量说明 |
7205+
7206+
* 返回值
7207+
7208+
7209+
0 成功
7210+
7211+
-1 已经初始化
7212+
7213+
-2 参数错误(为空或过大(大于 1000 像素点))
7214+
7215+
-3 缓存申请失败
7216+
7217+
-5 配置参数错误
7218+
7219+
7220+
71787221
###### 清屏
71797222

71807223

0 commit comments

Comments
 (0)