diff --git a/.github/workflows/build_and_run_examples.yml b/.github/workflows/build_and_run_examples.yml index 11f1f7b5bd..be8a28d352 100644 --- a/.github/workflows/build_and_run_examples.yml +++ b/.github/workflows/build_and_run_examples.yml @@ -61,7 +61,7 @@ jobs: - name: Install Python packages env: PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/" - run: pip install --only-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf + run: pip install --prefer-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf - name: Run examples run: pytest --target=${{ matrix.idf_target }} -m generic --build-dir=build_${{ matrix.idf_target }} --ignore=usb --ignore=test_app diff --git a/esp_lcd_qemu_rgb/README.md b/esp_lcd_qemu_rgb/README.md index 1514ee24e5..bd714ffbec 100644 --- a/esp_lcd_qemu_rgb/README.md +++ b/esp_lcd_qemu_rgb/README.md @@ -4,4 +4,4 @@ This component presents an interface for the virtual QEMU RGB panel, implemented This virtual RGB panel that can be used to display graphical interfaces. This panel also includes a dedicated frame buffer, absent in real hardware and independent from the internal RAM, that allows user program to populate the pixels in. -**Please note** that the virtual RGB panel currently only supports ARGB8888 (32-bit) color mode. +**Please note** that the virtual RGB panel currently supports only two color modes: ARGB8888 (32-bit) and RGB565 (16-bit). diff --git a/esp_lcd_qemu_rgb/examples/lcd_qemu_rgb_panel/main/lcd_qemu_rgb_panel_main.c b/esp_lcd_qemu_rgb/examples/lcd_qemu_rgb_panel/main/lcd_qemu_rgb_panel_main.c index 6319c2dd43..06f1ce4512 100644 --- a/esp_lcd_qemu_rgb/examples/lcd_qemu_rgb_panel/main/lcd_qemu_rgb_panel_main.c +++ b/esp_lcd_qemu_rgb/examples/lcd_qemu_rgb_panel/main/lcd_qemu_rgb_panel_main.c @@ -21,10 +21,14 @@ static const char *TAG = "example"; /** - * Only 32-bit colors are currently supported by QEMU RGB Panel + * 32-bit and 16-bit colors are currently supported by QEMU RGB Panel */ -#if !CONFIG_LV_COLOR_DEPTH_32 -#error "QEMU RGB Panel only support 32-bit colors, please enable LV_COLOR_DEPTH_32" +#if CONFIG_LV_COLOR_DEPTH_32 +#define CURRENT_COLOR_DEPTH RGB_QEMU_BPP_32 +#elif CONFIG_LV_COLOR_DEPTH_16 +#define CURRENT_COLOR_DEPTH RGB_QEMU_BPP_16 +#else +#error "QEMU RGB Panel only supports 32-bit and 16-bit colors, please enable LV_COLOR_DEPTH_32 or LV_COLOR_DEPTH_16" #endif // The pixel number in horizontal and vertical @@ -120,7 +124,8 @@ void app_main(void) esp_lcd_panel_handle_t panel_handle = NULL; esp_lcd_rgb_qemu_config_t panel_config = { .width = EXAMPLE_LCD_H_RES, - .height = EXAMPLE_LCD_V_RES + .height = EXAMPLE_LCD_V_RES, + .bpp = CURRENT_COLOR_DEPTH, }; ESP_ERROR_CHECK(esp_lcd_new_rgb_qemu(&panel_config, &panel_handle)); diff --git a/esp_lcd_qemu_rgb/idf_component.yml b/esp_lcd_qemu_rgb/idf_component.yml index befe84b554..2abc8c7e86 100644 --- a/esp_lcd_qemu_rgb/idf_component.yml +++ b/esp_lcd_qemu_rgb/idf_component.yml @@ -1,4 +1,4 @@ -version: "1.0.0" +version: "1.0.1" description: Driver for the virtual QEMU RGB panel url: https://github.com/espressif/idf-extra-components/tree/master/esp_lcd_qemu_rgb repository: https://github.com/espressif/idf-extra-components.git diff --git a/esp_lcd_qemu_rgb/interface/esp_lcd_qemu_rgb.h b/esp_lcd_qemu_rgb/interface/esp_lcd_qemu_rgb.h index 9f1f44ac96..9b9c4ffa9b 100644 --- a/esp_lcd_qemu_rgb/interface/esp_lcd_qemu_rgb.h +++ b/esp_lcd_qemu_rgb/interface/esp_lcd_qemu_rgb.h @@ -13,12 +13,17 @@ extern "C" { #endif +typedef enum { + RGB_QEMU_BPP_32 = 32, + RGB_QEMU_BPP_16 = 16, +} esp_lcd_rgb_qemu_bpp_t; /** * @brief QEMU RGB panel configuration structure */ typedef struct { uint32_t width; /*!< Width of the graphical window in pixels */ uint32_t height; /*!< Height of the graphical window in pixels */ + esp_lcd_rgb_qemu_bpp_t bpp; /*!< BPP - bit per pixel*/ } esp_lcd_rgb_qemu_config_t; /** diff --git a/esp_lcd_qemu_rgb/src/esp_lcd_qemu_rgb.c b/esp_lcd_qemu_rgb/src/esp_lcd_qemu_rgb.c index 428f34d12c..402bb47f66 100644 --- a/esp_lcd_qemu_rgb/src/esp_lcd_qemu_rgb.c +++ b/esp_lcd_qemu_rgb/src/esp_lcd_qemu_rgb.c @@ -58,9 +58,10 @@ esp_err_t esp_lcd_new_rgb_qemu(const esp_lcd_rgb_qemu_config_t *rgb_config, esp_ rgb_panel = calloc(1, sizeof(esp_rgb_qemu_t)); ESP_GOTO_ON_FALSE(rgb_panel, ESP_ERR_NO_MEM, err, TAG, "no mem for rgb qemu panel"); - /* Resize the window */ + /* Resize the window and setup bpp*/ s_rgb_dev->size.height = rgb_config->height; s_rgb_dev->size.width = rgb_config->width; + s_rgb_dev->bpp = rgb_config->bpp ? rgb_config->bpp : RGB_QEMU_BPP_32; /* If the configured size is bigger than authorized, the hardware will arrange it. * So, read back the configured size */ rgb_panel->height = rgb_config->height; diff --git a/esp_lcd_qemu_rgb/src/esp_lcd_qemu_rgb_struct.h b/esp_lcd_qemu_rgb/src/esp_lcd_qemu_rgb_struct.h index 24e5f35e34..0389465270 100644 --- a/esp_lcd_qemu_rgb/src/esp_lcd_qemu_rgb_struct.h +++ b/esp_lcd_qemu_rgb/src/esp_lcd_qemu_rgb_struct.h @@ -50,6 +50,7 @@ typedef volatile struct rgb_qemu_dev_s { }; uint32_t val; } update_st; + uint32_t bpp; } rgb_qemu_dev_t; #ifdef __cplusplus