Skip to content

Commit

Permalink
feat(esp_qemu_rgb_panel): implement 16bpp QEMU RGB panel
Browse files Browse the repository at this point in the history
  • Loading branch information
horw authored and igor.udot committed Dec 27, 2023
1 parent 22e2825 commit 81e7816
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@
static const char *TAG = "example";

/**
* Only 32-bit colors are currently supported by QEMU RGB Panel
* 16-bit and 32-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"
#endif

// The pixel number in horizontal and vertical
#define EXAMPLE_LCD_H_RES 800
Expand Down Expand Up @@ -120,7 +117,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 = BPP_32,
};
ESP_ERROR_CHECK(esp_lcd_new_rgb_qemu(&panel_config, &panel_handle));

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 {
BPP_16 = 16,
BPP_32 = 32
} BppEnum;
/**
* @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 */
BppEnum 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;
/* 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 81e7816

Please sign in to comment.