diff --git a/en-us/api/QuecPythonClasslib.md b/en-us/api/QuecPythonClasslib.md index f9e695c..a43db03 100644 --- a/en-us/api/QuecPythonClasslib.md +++ b/en-us/api/QuecPythonClasslib.md @@ -6685,7 +6685,7 @@ lcd = LCD() # Create lcd object -###### LCD Initialization +###### LCD Initialization (interface 1:LCM interface of the module) > **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)** @@ -6717,6 +6717,44 @@ It initializes LCD. +###### LCD Initialization(interface 2:SPI interface of the module) + +> **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)** + +It initializes LCD. + +- Parameter + +| Parameter | Type | Description | +| ------------------ | --------- | ------------------------------------------------------------ | +| lcd_init_data | bytearray | Inputting configuration commands for LCD. | +| lcd_width | int | The width of LCD screen, not more than 500. | +| lcd_hight | int | The height of LCD screen, not more than 500. | +| lcd_clk | int | SPI clock. refer to the parameter description of Create SPI Object in machine SPI. | +| data_line | int | Number of data lines, the parameter values are 1 and 2. | +| line_num | int | The number of lines, the parameter values are 3 and 4. | +| lcd_type | int | Screen type. 0: rgb; 1: fstn. | +| lcd_invalid | bytearray | Inputting configuration commands for LCD area settings. | +| lcd_display_on | bytearray | Inputting configuration commands for LCD screen light. | +| lcd_display_off | bytearray | Inputting configuration commands for LCD screen off. | +| 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) | +| lcd_interface | int | type of LCD interface. 0:LCM interface;1:SPI interface | +| spi_port | int | Channel selection[0,1],refer to SPI description in machine. | +| spi_mode | int | SPI working mode (ususally mode 0):
Clock polarity CPOL: When SPI is idle, the level of the clock signal SCLK (0: Low level when idle; 1: High level when idle)
0 : CPOL=0, CPHA=0
1 : CPOL=0, CPHA=1
2: CPOL=1, CPHA=0
3: CPOL=1, CPHA=1 | +| cs_pin | int | CS PIN,refer to Pin Constant Description | +| dc_pin | int | DC PIN,refer to Pin Constant Description | +| rst_pin | int | RST PIN,refer to Pin Constant Description | + +* Return Value + + * 0 Successful execution. + * -1 Initialized. + * -2 Parameter error (empty or too large (bigger than 1000 pixels)) . + * -3 Failed cache request. + * -5 Configuration parameter error. + + + ###### Clear LCD. diff --git a/zh-cn/api/QuecPythonClasslib.md b/zh-cn/api/QuecPythonClasslib.md index 5a14391..00566dc 100644 --- a/zh-cn/api/QuecPythonClasslib.md +++ b/zh-cn/api/QuecPythonClasslib.md @@ -7138,7 +7138,7 @@ lcd = LCD() # 创建lcd对象 -###### LCD初始化 +###### LCD初始化(接口1:设备接模块LCM接口) > **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)** @@ -7175,6 +7175,49 @@ lcd = LCD() # 创建lcd对象 +###### LCD初始化(接口2:设备接模块SPI接口) + +> **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)** + +初始化LCD + +- 参数 + +| 参数 | 类型 | 说明 | +| ------------------ | --------- | ------------------------------------------------------------ | +| lcd_init_data | bytearray | 传入 LCD 的配置命令 | +| lcd_width | int | LCD 屏幕的宽度。宽度不超过 500 | +| lcd_hight | int | LCD 屏幕的高度。高度不超过 500 | +| lcd_clk | int | SPI 时钟。见machine SPI 创建SPI对象参数说明clk | +| data_line | int | 数据线数。参数值为 1 和 2。 | +| line_num | int | 线的数量。参数值为 3 和 4。 | +| lcd_type | int | 屏幕类型。0:rgb;1:fstn | +| lcd_invalid | bytearray | 传入LCD 区域设置的配置命令 | +| lcd_display_on | bytearray | 传入LCD 屏亮的配置命令 | +| lcd_display_off | bytearray | 传入LCD 屏灭的配置命令 | +| lcd_set_brightness | bytearray | 传入LCD屏亮度的配置命令。设置为 None表示由 LCD_BL_K 控制亮度(有些屏幕是由寄存器控制屏幕亮度,有 些是通过 LCD_BL_K 控制屏幕亮度) | +| lcd_interface | int | LCD接口类型。0:LCM接口;1:SPI接口 | +| spi_port | int | 通道选择[0,1],参照SPI部分 | +| spi_mode | int | SPI 的工作模式(模式0最常用):
时钟极性CPOL: 即SPI空闲时,时钟信号SCLK的电平(0:空闲时低电平; 1:空闲时高电平)
0 : CPOL=0, CPHA=0
1 : CPOL=0, CPHA=1
2: CPOL=1, CPHA=0
3: CPOL=1, CPHA=1 | +| cs_pin | int | CS引脚,见machine Pin常量说明 | +| dc_pin | int | DC引脚,见machinePin常量说明 | +| rst_pin | int | RST引脚,见machinePin常量说明 | + +* 返回值 + + + 0 成功 + + -1 已经初始化 + + -2 参数错误(为空或过大(大于 1000 像素点)) + + -3 缓存申请失败 + + -5 配置参数错误 + + + ###### 清屏