LCD
Introduction
ESP chips can generate various kinds of timings needed by common LCDs on the market, like SPI LCD, I2C LCD, Parallel LCD (Intel 8080), RGB/SRGB LCD, MIPI DSI LCD and etc. The esp_lcd
component offers an abstracted driver framework to support them in a unified way.
An LCD typically consists of two main planes:
Control Plane: This plane allows us to read and write to the internal registers of the LCD device controller. Host typically uses this plane for tasks such as initializing the LCD power supply and performing gamma calibration.
Data Plane: The data plane is responsible for transmitting pixel data to the LCD device.
Functional Overview
In the context of esp_lcd
, both the data plane and the control plane are represented by the esp_lcd_panel_handle_t
type.
On some LCDs, these two planes may be combined into a single plane. In this configuration, pixel data is transmitted through the control plane, achieving functionality similar to that of the data plane. This merging is common in SPI LCDs and I2C LCDs. Additionally, there are LCDs that do not require a separate control plane. For instance, certain RGB LCDs automatically execute necessary initialization procedures after power-up. Host devices only need to continuously refresh pixel data through the data plane. However, it's essential to note that not all RGB LCDs eliminate the control plane entirely. Some LCD devices can simultaneously support multiple interfaces, requiring the host to send specific commands via the control plane (such as those based on the SPI interface) to enable the RGB mode.
This document will discuss how to create the control plane and data plane, as mentioned earlier, based on different types of LCDs.
备注
ESP-IDF provides only a limited number of LCD device controller drivers out of the box (e.g., ST7789), more drivers are available in the Espressif Component Registry.
LCD Control Panel Operations
esp_lcd_panel_reset()
can reset the LCD control panel.esp_lcd_panel_init()
performs a basic initialization of the control panel. To perform more manufacture specific initialization, please refer to Steps to Add Manufacture Specific Initialization.By combining using
esp_lcd_panel_swap_xy()
andesp_lcd_panel_mirror()
, you can achieve the functionality of rotating or mirroring the LCD screen.esp_lcd_panel_disp_on_off()
can turn on or off the LCD screen by cutting down the output path from the frame buffer to the LCD screen. Please note, this is not controlling the LCD backlight. Backlight control is not covered by theesp_lcd
driver.esp_lcd_panel_disp_sleep()
can reduce the power consumption of the LCD screen by entering the sleep mode. The internal frame buffer is still retained.
LCD Data Panel Operations
esp_lcd_panel_reset()
can reset the LCD data panel.esp_lcd_panel_init()
performs a basic initialization of the data panel.esp_lcd_panel_draw_bitmap()
is the function which does the magic to flush the user draw buffer to the LCD screen, where the target draw window is configurable. Please note, this function expects the draw buffer is a 1-D array and there's no stride in between each lines.
Steps to Add Manufacture Specific Initialization
The LCD controller drivers (e.g., st7789) in ESP-IDF only provide basic initialization in the esp_lcd_panel_init()
, leaving the vast majority of settings to the default values. Some LCD modules needs to set a bunch of manufacture specific configurations before it can display normally. These configurations usually include gamma, power voltage and so on. If you want to add manufacture specific initialization, please follow the steps below:
esp_lcd_panel_reset(panel_handle);
esp_lcd_panel_init(panel_handle);
// set extra configurations e.g., gamma control
// with the underlying IO handle
// please consult your manufacture for special commands and corresponding values
esp_lcd_panel_io_tx_param(io_handle, GAMMA_CMD, (uint8_t[]) {
GAMMA_ARRAY
}, N);
// turn on the display
esp_lcd_panel_disp_on_off(panel_handle, true);
Application Example
Software JPEG decoding and display - peripherals/lcd/tjpgd
Universal SPI LCD example with SPI touch - peripherals/lcd/spi_lcd_touch
i80 controller based LCD and LVGL animation UI - peripherals/lcd/i80_controller
I2C interfaced OLED display scrolling text - peripherals/lcd/i2c_oled
API Reference
Header File
This header file can be included with:
#include "hal/lcd_types.h"
Type Definitions
-
typedef soc_periph_lcd_clk_src_t lcd_clock_source_t
LCD clock source.
Enumerations
-
enum lcd_rgb_data_endian_t
RGB data endian.
Values:
-
enumerator LCD_RGB_DATA_ENDIAN_BIG
RGB data endian: MSB first
-
enumerator LCD_RGB_DATA_ENDIAN_LITTLE
RGB data endian: LSB first
-
enumerator LCD_RGB_DATA_ENDIAN_BIG
-
enum lcd_color_space_t
LCD color space.
Values:
-
enumerator LCD_COLOR_SPACE_RGB
Color space: RGB
-
enumerator LCD_COLOR_SPACE_YUV
Color space: YUV
-
enumerator LCD_COLOR_SPACE_RGB
-
enum lcd_color_rgb_pixel_format_t
LCD color pixel format in RGB color space.
Values:
-
enumerator LCD_COLOR_PIXEL_FORMAT_RGB565
16 bits, 5 bits per R/B value, 6 bits for G value
-
enumerator LCD_COLOR_PIXEL_FORMAT_RGB666
18 bits, 6 bits per R/G/B value
-
enumerator LCD_COLOR_PIXEL_FORMAT_RGB888
24 bits, 8 bits per R/G/B value
-
enumerator LCD_COLOR_PIXEL_FORMAT_RGB565
-
enum lcd_color_range_t
LCD color range.
Values:
-
enumerator LCD_COLOR_RANGE_LIMIT
Limited color range
-
enumerator LCD_COLOR_RANGE_FULL
Full color range
-
enumerator LCD_COLOR_RANGE_LIMIT
Header File
This header file can be included with:
#include "esp_lcd_types.h"
This header file is a part of the API provided by the
esp_lcd
component. To declare that your component depends onesp_lcd
, add the following to your CMakeLists.txt:REQUIRES esp_lcd
or
PRIV_REQUIRES esp_lcd
Structures
-
struct esp_lcd_video_timing_t
Timing parameters for the video data transmission.
Public Members
-
uint32_t h_size
Horizontal resolution, i.e. the number of pixels in a line
-
uint32_t v_size
Vertical resolution, i.e. the number of lines in the frame
-
uint32_t hsync_pulse_width
Horizontal sync width, in pixel clock
-
uint32_t hsync_back_porch
Horizontal back porch, number of pixel clock between hsync and start of line active data
-
uint32_t hsync_front_porch
Horizontal front porch, number of pixel clock between the end of active data and the next hsync
-
uint32_t vsync_pulse_width
Vertical sync width, in number of lines
-
uint32_t vsync_back_porch
Vertical back porch, number of invalid lines between vsync and start of frame
-
uint32_t vsync_front_porch
Vertical front porch, number of invalid lines between the end of frame and the next vsync
-
uint32_t h_size
Type Definitions
-
typedef struct esp_lcd_panel_io_t *esp_lcd_panel_io_handle_t
Type of LCD panel IO handle
-
typedef struct esp_lcd_panel_t *esp_lcd_panel_handle_t
Type of LCD panel handle
Enumerations
Header File
This header file can be included with:
#include "esp_lcd_panel_io.h"
This header file is a part of the API provided by the
esp_lcd
component. To declare that your component depends onesp_lcd
, add the following to your CMakeLists.txt:REQUIRES esp_lcd
or
PRIV_REQUIRES esp_lcd
Functions
-
esp_err_t esp_lcd_panel_io_rx_param(esp_lcd_panel_io_handle_t io, int lcd_cmd, void *param, size_t param_size)
Transmit LCD command and receive corresponding parameters.
备注
Commands sent by this function are short, so they are sent using polling transactions. The function does not return before the command transfer is completed. If any queued transactions sent by
esp_lcd_panel_io_tx_color()
are still pending when this function is called, this function will wait until they are finished and the queue is empty before sending the command(s).- 参数
io -- [in] LCD panel IO handle, which is created by other factory API like
esp_lcd_new_panel_io_spi()
lcd_cmd -- [in] The specific LCD command, set to -1 if no command needed
param -- [out] Buffer for the command data
param_size -- [in] Size of
param
buffer
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_ERR_NOT_SUPPORTED if read is not supported by transport
ESP_OK on success
-
esp_err_t esp_lcd_panel_io_tx_param(esp_lcd_panel_io_handle_t io, int lcd_cmd, const void *param, size_t param_size)
Transmit LCD command and corresponding parameters.
备注
Commands sent by this function are short, so they are sent using polling transactions. The function does not return before the command transfer is completed. If any queued transactions sent by
esp_lcd_panel_io_tx_color()
are still pending when this function is called, this function will wait until they are finished and the queue is empty before sending the command(s).- 参数
io -- [in] LCD panel IO handle, which is created by other factory API like
esp_lcd_new_panel_io_spi()
lcd_cmd -- [in] The specific LCD command, set to -1 if no command needed
param -- [in] Buffer that holds the command specific parameters, set to NULL if no parameter is needed for the command
param_size -- [in] Size of
param
in memory, in bytes, set to zero if no parameter is needed for the command
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_OK on success
-
esp_err_t esp_lcd_panel_io_tx_color(esp_lcd_panel_io_handle_t io, int lcd_cmd, const void *color, size_t color_size)
Transmit LCD RGB data.
备注
This function will package the command and RGB data into a transaction, and push into a queue. The real transmission is performed in the background (DMA+interrupt). The caller should take care of the lifecycle of the
color
buffer. Recycling of color buffer should be done in the callbackon_color_trans_done()
.- 参数
io -- [in] LCD panel IO handle, which is created by factory API like
esp_lcd_new_panel_io_spi()
lcd_cmd -- [in] The specific LCD command, set to -1 if no command needed
color -- [in] Buffer that holds the RGB color data
color_size -- [in] Size of
color
in memory, in bytes
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_OK on success
-
esp_err_t esp_lcd_panel_io_del(esp_lcd_panel_io_handle_t io)
Destroy LCD panel IO handle (deinitialize panel and free all corresponding resource)
- 参数
io -- [in] LCD panel IO handle, which is created by factory API like
esp_lcd_new_panel_io_spi()
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_OK on success
-
esp_err_t esp_lcd_panel_io_register_event_callbacks(esp_lcd_panel_io_handle_t io, const esp_lcd_panel_io_callbacks_t *cbs, void *user_ctx)
Register LCD panel IO callbacks.
- 参数
io -- [in] LCD panel IO handle, which is created by factory API like
esp_lcd_new_panel_io_spi()
cbs -- [in] structure with all LCD panel IO callbacks
user_ctx -- [in] User private data, passed directly to callback's user_ctx
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_OK on success
-
esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_panel_io_spi_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io)
Create LCD panel IO handle, for SPI interface.
- 参数
bus -- [in] SPI bus handle
io_config -- [in] IO configuration, for SPI interface
ret_io -- [out] Returned IO handle
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_ERR_NO_MEM if out of memory
ESP_OK on success
-
esp_err_t esp_lcd_new_panel_io_i2c_v1(uint32_t bus, const esp_lcd_panel_io_i2c_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io)
Create LCD panel IO handle, for I2C interface in legacy implementation.
备注
Please don't call this function in your project directly. Please call
esp_lcd_new_panel_to_i2c
instead.- 参数
bus -- [in] I2C bus handle, (in uint32_t)
io_config -- [in] IO configuration, for I2C interface
ret_io -- [out] Returned IO handle
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_ERR_NO_MEM if out of memory
ESP_OK on success
-
esp_err_t esp_lcd_new_panel_io_i2c_v2(i2c_master_bus_handle_t bus, const esp_lcd_panel_io_i2c_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io)
Create LCD panel IO handle, for I2C interface in new implementation.
备注
Please don't call this function in your project directly. Please call
esp_lcd_new_panel_to_i2c
instead.- 参数
bus -- [in] I2C bus handle, (in i2c_master_dev_handle_t)
io_config -- [in] IO configuration, for I2C interface
ret_io -- [out] Returned IO handle
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_ERR_NO_MEM if out of memory
ESP_OK on success
-
esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lcd_i80_bus_handle_t *ret_bus)
Create Intel 8080 bus handle.
- 参数
bus_config -- [in] Bus configuration
ret_bus -- [out] Returned bus handle
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_ERR_NO_MEM if out of memory
ESP_ERR_NOT_FOUND if no free bus is available
ESP_OK on success
-
esp_err_t esp_lcd_del_i80_bus(esp_lcd_i80_bus_handle_t bus)
Destroy Intel 8080 bus handle.
- 参数
bus -- [in] Intel 8080 bus handle, created by
esp_lcd_new_i80_bus()
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_ERR_INVALID_STATE if there still be some device attached to the bus
ESP_OK on success
-
esp_err_t esp_lcd_new_panel_io_i80(esp_lcd_i80_bus_handle_t bus, const esp_lcd_panel_io_i80_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io)
Create LCD panel IO, for Intel 8080 interface.
- 参数
bus -- [in] Intel 8080 bus handle, created by
esp_lcd_new_i80_bus()
io_config -- [in] IO configuration, for i80 interface
ret_io -- [out] Returned panel IO handle
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_ERR_NOT_SUPPORTED if some configuration can't be satisfied, e.g. pixel clock out of the range
ESP_ERR_NO_MEM if out of memory
ESP_OK on success
Structures
-
struct esp_lcd_panel_io_event_data_t
Type of LCD panel IO event data.
-
struct esp_lcd_panel_io_callbacks_t
Type of LCD panel IO callbacks.
Public Members
-
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done
Callback invoked when color data transfer has finished
-
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done
-
struct esp_lcd_panel_io_spi_config_t
Panel IO configuration structure, for SPI interface.
Public Members
-
int cs_gpio_num
GPIO used for CS line
-
int dc_gpio_num
GPIO used to select the D/C line, set this to -1 if the D/C line is not used
-
int spi_mode
Traditional SPI mode (0~3)
-
unsigned int pclk_hz
Frequency of pixel clock
-
size_t trans_queue_depth
Size of internal transaction queue
-
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done
Callback invoked when color data transfer has finished
-
void *user_ctx
User private data, passed directly to on_color_trans_done's user_ctx
-
int lcd_cmd_bits
Bit-width of LCD command
-
int lcd_param_bits
Bit-width of LCD parameter
-
unsigned int dc_high_on_cmd
If enabled, DC level = 1 indicates command transfer
-
unsigned int dc_low_on_data
If enabled, DC level = 0 indicates color data transfer
-
unsigned int dc_low_on_param
If enabled, DC level = 0 indicates parameter transfer
-
unsigned int octal_mode
transmit with octal mode (8 data lines), this mode is used to simulate Intel 8080 timing
-
unsigned int quad_mode
transmit with quad mode (4 data lines), this mode is useful when transmitting LCD parameters (Only use one line for command)
-
unsigned int sio_mode
Read and write through a single data line (MOSI)
-
unsigned int lsb_first
transmit LSB bit first
-
unsigned int cs_high_active
CS line is high active
-
struct esp_lcd_panel_io_spi_config_t::[anonymous] flags
Extra flags to fine-tune the SPI device
-
int cs_gpio_num
-
struct esp_lcd_panel_io_i2c_config_t
Panel IO configuration structure, for I2C interface.
Public Members
-
uint32_t dev_addr
I2C device address
-
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done
Callback invoked when color data transfer has finished
-
void *user_ctx
User private data, passed directly to on_color_trans_done's user_ctx
-
size_t control_phase_bytes
I2C LCD panel will encode control information (e.g. D/C selection) into control phase, in several bytes
-
unsigned int dc_bit_offset
Offset of the D/C selection bit in control phase
-
int lcd_cmd_bits
Bit-width of LCD command
-
int lcd_param_bits
Bit-width of LCD parameter
-
unsigned int dc_low_on_data
If this flag is enabled, DC line = 0 means transfer data, DC line = 1 means transfer command; vice versa
-
unsigned int disable_control_phase
If this flag is enabled, the control phase isn't used
-
struct esp_lcd_panel_io_i2c_config_t::[anonymous] flags
Extra flags to fine-tune the I2C device
-
uint32_t scl_speed_hz
I2C LCD SCL frequency (hz)
-
uint32_t dev_addr
-
struct esp_lcd_i80_bus_config_t
LCD Intel 8080 bus configuration structure.
Public Members
-
int dc_gpio_num
GPIO used for D/C line
-
int wr_gpio_num
GPIO used for WR line
-
lcd_clock_source_t clk_src
Clock source for the I80 LCD peripheral
-
int data_gpio_nums[ESP_LCD_I80_BUS_WIDTH_MAX]
GPIOs used for data lines
-
size_t bus_width
Number of data lines, 8 or 16
-
size_t max_transfer_bytes
Maximum transfer size, this determines the length of internal DMA link
-
size_t psram_trans_align
DMA transfer alignment for data allocated from PSRAM
-
size_t sram_trans_align
DMA transfer alignment for data allocated from SRAM
-
int dc_gpio_num
-
struct esp_lcd_panel_io_i80_config_t
Panel IO configuration structure, for intel 8080 interface.
Public Members
-
int cs_gpio_num
GPIO used for CS line, set to -1 will declaim exclusively use of I80 bus
-
uint32_t pclk_hz
Frequency of pixel clock
-
size_t trans_queue_depth
Transaction queue size, larger queue, higher throughput
-
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done
Callback invoked when color data was transferred done
-
void *user_ctx
User private data, passed directly to on_color_trans_done's user_ctx
-
int lcd_cmd_bits
Bit-width of LCD command
-
int lcd_param_bits
Bit-width of LCD parameter
-
unsigned int dc_idle_level
Level of DC line in IDLE phase
-
unsigned int dc_cmd_level
Level of DC line in CMD phase
-
unsigned int dc_dummy_level
Level of DC line in DUMMY phase
-
unsigned int dc_data_level
Level of DC line in DATA phase
-
struct esp_lcd_panel_io_i80_config_t::[anonymous] dc_levels
Each i80 device might have its own D/C control logic
-
unsigned int cs_active_high
If set, a high level of CS line will select the device, otherwise, CS line is low level active
-
unsigned int reverse_color_bits
Reverse the data bits, D[N:0] -> D[0:N]
-
unsigned int swap_color_bytes
Swap adjacent two color bytes
-
unsigned int pclk_active_neg
The display will write data lines when there's a falling edge on WR signal (a.k.a the PCLK)
-
unsigned int pclk_idle_low
The WR signal (a.k.a the PCLK) stays at low level in IDLE phase
-
struct esp_lcd_panel_io_i80_config_t::[anonymous] flags
Panel IO config flags
-
int cs_gpio_num
Macros
-
ESP_LCD_I80_BUS_WIDTH_MAX
Maximum width of I80 bus
-
esp_lcd_new_panel_io_i2c(bus, io_config, ret_io)
Create LCD panel IO handle.
- 参数
bus -- [in] I2C bus handle
io_config -- [in] IO configuration, for I2C interface
ret_io -- [out] Returned IO handle
- 返回
ESP_ERR_INVALID_ARG if parameter is invalid
ESP_ERR_NO_MEM if out of memory
ESP_OK on success
Type Definitions
-
typedef void *esp_lcd_spi_bus_handle_t
Type of LCD SPI bus handle
-
typedef uint32_t esp_lcd_i2c_bus_handle_t
Type of LCD I2C bus handle
-
typedef struct esp_lcd_i80_bus_t *esp_lcd_i80_bus_handle_t
Type of LCD intel 8080 bus handle
-
typedef bool (*esp_lcd_panel_io_color_trans_done_cb_t)(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
Declare the prototype of the function that will be invoked when panel IO finishes transferring color data.
- Param panel_io
[in] LCD panel IO handle, which is created by factory API like
esp_lcd_new_panel_io_spi()
- Param edata
[in] Panel IO event data, fed by driver
- Param user_ctx
[in] User data, passed from
esp_lcd_panel_io_xxx_config_t
- Return
Whether a high priority task has been waken up by this function
Header File
This header file can be included with:
#include "esp_lcd_panel_ops.h"
This header file is a part of the API provided by the
esp_lcd
component. To declare that your component depends onesp_lcd
, add the following to your CMakeLists.txt:REQUIRES esp_lcd
or
PRIV_REQUIRES esp_lcd
Functions
-
esp_err_t esp_lcd_panel_reset(esp_lcd_panel_handle_t panel)
Reset LCD panel.
备注
Panel reset must be called before attempting to initialize the panel using
esp_lcd_panel_init()
.- 参数
panel -- [in] LCD panel handle, which is created by other factory API like
esp_lcd_new_panel_st7789()
- 返回
ESP_OK on success
-
esp_err_t esp_lcd_panel_init(esp_lcd_panel_handle_t panel)
Initialize LCD panel.
备注
Before calling this function, make sure the LCD panel has finished the
reset
stage byesp_lcd_panel_reset()
.- 参数
panel -- [in] LCD panel handle, which is created by other factory API like
esp_lcd_new_panel_st7789()
- 返回
ESP_OK on success
-
esp_err_t esp_lcd_panel_del(esp_lcd_panel_handle_t panel)
Deinitialize the LCD panel.
- 参数
panel -- [in] LCD panel handle, which is created by other factory API like
esp_lcd_new_panel_st7789()
- 返回
ESP_OK on success
-
esp_err_t esp_lcd_panel_draw_bitmap(esp_lcd_panel_handle_t panel, int x_start, int y_start, int x_end, int y_end, const void *color_data)
Draw bitmap on LCD panel.
- 参数
panel -- [in] LCD panel handle, which is created by other factory API like
esp_lcd_new_panel_st7789()
x_start -- [in] Start pixel index in the target frame buffer, on x-axis (x_start is included)
y_start -- [in] Start pixel index in the target frame buffer, on y-axis (y_start is included)
x_end -- [in] End pixel index in the target frame buffer, on x-axis (x_end is not included)
y_end -- [in] End pixel index in the target frame buffer, on y-axis (y_end is not included)
color_data -- [in] RGB color data that will be dumped to the specific window range
- 返回
ESP_OK on success
-
esp_err_t esp_lcd_panel_mirror(esp_lcd_panel_handle_t panel, bool mirror_x, bool mirror_y)
Mirror the LCD panel on specific axis.
备注
Combined with
esp_lcd_panel_swap_xy()
, one can realize screen rotation- 参数
panel -- [in] LCD panel handle, which is created by other factory API like
esp_lcd_new_panel_st7789()
mirror_x -- [in] Whether the panel will be mirrored about the x axis
mirror_y -- [in] Whether the panel will be mirrored about the y axis
- 返回
ESP_OK on success
ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
-
esp_err_t esp_lcd_panel_swap_xy(esp_lcd_panel_handle_t panel, bool swap_axes)
Swap/Exchange x and y axis.
备注
Combined with
esp_lcd_panel_mirror()
, one can realize screen rotation- 参数
panel -- [in] LCD panel handle, which is created by other factory API like
esp_lcd_new_panel_st7789()
swap_axes -- [in] Whether to swap the x and y axis
- 返回
ESP_OK on success
ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
-
esp_err_t esp_lcd_panel_set_gap(esp_lcd_panel_handle_t panel, int x_gap, int y_gap)
Set extra gap in x and y axis.
The gap is the space (in pixels) between the left/top sides of the LCD panel and the first row/column respectively of the actual contents displayed.
备注
Setting a gap is useful when positioning or centering a frame that is smaller than the LCD.
- 参数
panel -- [in] LCD panel handle, which is created by other factory API like
esp_lcd_new_panel_st7789()
x_gap -- [in] Extra gap on x axis, in pixels
y_gap -- [in] Extra gap on y axis, in pixels
- 返回
ESP_OK on success
-
esp_err_t esp_lcd_panel_invert_color(esp_lcd_panel_handle_t panel, bool invert_color_data)
Invert the color (bit-wise invert the color data line)
- 参数
panel -- [in] LCD panel handle, which is created by other factory API like
esp_lcd_new_panel_st7789()
invert_color_data -- [in] Whether to invert the color data
- 返回
ESP_OK on success
-
esp_err_t esp_lcd_panel_disp_on_off(esp_lcd_panel_handle_t panel, bool on_off)
Turn on or off the display.
- 参数
panel -- [in] LCD panel handle, which is created by other factory API like
esp_lcd_new_panel_st7789()
on_off -- [in] True to turns on display, False to turns off display
- 返回
ESP_OK on success
ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
-
esp_err_t esp_lcd_panel_disp_off(esp_lcd_panel_handle_t panel, bool off)
Turn off the display.
- 参数
panel -- [in] LCD panel handle, which is created by other factory API like
esp_lcd_new_panel_st7789()
off -- [in] Whether to turn off the screen
- 返回
ESP_OK on success
ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
-
esp_err_t esp_lcd_panel_disp_sleep(esp_lcd_panel_handle_t panel, bool sleep)
Enter or exit sleep mode.
- 参数
panel -- [in] LCD panel handle, which is created by other factory API like
esp_lcd_new_panel_st7789()
sleep -- [in] True to enter sleep mode, False to wake up
- 返回
ESP_OK on success
ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
Header File
This header file can be included with:
#include "esp_lcd_panel_vendor.h"
This header file is a part of the API provided by the
esp_lcd
component. To declare that your component depends onesp_lcd
, add the following to your CMakeLists.txt:REQUIRES esp_lcd
or
PRIV_REQUIRES esp_lcd