mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-02 16:11:41 +01:00
test(esp_lcd): test lcd sleep function
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user