mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
test(esp_lcd): test lcd sleep function
This commit is contained in:
parent
b2972528c7
commit
b4bcb5cc5c
@ -90,14 +90,29 @@ static void lcd_panel_test(esp_lcd_panel_io_handle_t io_handle, esp_lcd_panel_ha
|
||||
// turn on backlight
|
||||
gpio_set_level(TEST_LCD_BK_LIGHT_GPIO, 1);
|
||||
|
||||
for (int i = 0; i < 200; i++) {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
uint8_t color_byte = rand() & 0xFF;
|
||||
int x_start = rand() % (TEST_LCD_H_RES - 200);
|
||||
int y_start = rand() % (TEST_LCD_V_RES - 200);
|
||||
memset(img, color_byte, TEST_IMG_SIZE);
|
||||
esp_lcd_panel_draw_bitmap(panel_handle, x_start, y_start, x_start + 200, y_start + 200, img);
|
||||
}
|
||||
// turn off screen
|
||||
|
||||
printf("go into sleep mode\r\n");
|
||||
esp_lcd_panel_disp_sleep(panel_handle, true);
|
||||
vTaskDelay(pdMS_TO_TICKS(500));
|
||||
printf("exit sleep mode\r\n");
|
||||
esp_lcd_panel_disp_sleep(panel_handle, false);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
uint8_t color_byte = rand() & 0xFF;
|
||||
int x_start = rand() % (TEST_LCD_H_RES - 200);
|
||||
int y_start = rand() % (TEST_LCD_V_RES - 200);
|
||||
memset(img, color_byte, TEST_IMG_SIZE);
|
||||
esp_lcd_panel_draw_bitmap(panel_handle, x_start, y_start, x_start + 200, y_start + 200, img);
|
||||
}
|
||||
|
||||
printf("turn off the panel\r\n");
|
||||
esp_lcd_panel_disp_on_off(panel_handle, false);
|
||||
TEST_ESP_OK(esp_lcd_panel_del(panel_handle));
|
||||
TEST_ESP_OK(esp_lcd_panel_io_del(io_handle));
|
||||
@ -247,12 +262,14 @@ TEST_CASE("spi_lcd_send_colors_to_fixed_region", "[lcd]")
|
||||
TEST_ESP_OK(esp_lcd_panel_io_tx_color(io_handle, -1, color_data + i * color_size_per_step, color_size_per_step));
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
// change to another color
|
||||
|
||||
printf("change to another color\r\n");
|
||||
color_byte = rand() & 0xFF;
|
||||
memset(color_data, color_byte, color_size);
|
||||
for (int i = 0; i < steps; i++) {
|
||||
TEST_ESP_OK(esp_lcd_panel_io_tx_color(io_handle, -1, color_data + i * color_size_per_step, color_size_per_step));
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
|
||||
TEST_ESP_OK(esp_lcd_panel_del(panel_handle));
|
||||
TEST_ESP_OK(esp_lcd_panel_io_del(io_handle));
|
||||
|
@ -454,7 +454,8 @@ LCD Panel IO Operations
|
||||
* :cpp:func:`esp_lcd_panel_reset` can reset the LCD panel.
|
||||
* :cpp:func:`esp_lcd_panel_init` performs a basic initialization of the panel. To perform more manufacture specific initialization, please go to :ref:`steps_add_manufacture_init`.
|
||||
* Through combined use of :cpp:func:`esp_lcd_panel_swap_xy` and :cpp:func:`esp_lcd_panel_mirror`, you can rotate the LCD screen.
|
||||
* :cpp:func:`esp_lcd_panel_disp_on_off` can turn on or off the LCD screen (different from LCD backlight).
|
||||
* :cpp:func:`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.
|
||||
* :cpp:func:`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.
|
||||
* :cpp:func:`esp_lcd_panel_draw_bitmap` is the most significant function, which does the magic to draw the user provided color buffer to the LCD screen, where the draw window is also configurable.
|
||||
|
||||
.. _steps_add_manufacture_init:
|
||||
|
Loading…
x
Reference in New Issue
Block a user