Skip to content

Commit

Permalink
Merge pull request espressif#287 from horw/feat/qemu-rgb-16bpp
Browse files Browse the repository at this point in the history
feat(esp_qemu_rgb_panel): implement 16bpp QEMU RGB panel ()
  • Loading branch information
igrr authored Jan 22, 2024
2 parents d5ba281 + c399bb3 commit 4e5c5ad
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_run_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion esp_lcd_qemu_rgb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion esp_lcd_qemu_rgb/idf_component.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions esp_lcd_qemu_rgb/interface/esp_lcd_qemu_rgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
3 changes: 2 additions & 1 deletion esp_lcd_qemu_rgb/src/esp_lcd_qemu_rgb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions esp_lcd_qemu_rgb/src/esp_lcd_qemu_rgb_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4e5c5ad

Please sign in to comment.