Skip to content

Commit

Permalink
esp_lvgl_port: put sw_rotate in flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
espressif2022 committed Dec 6, 2023
1 parent af2d950 commit d638271
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
20 changes: 13 additions & 7 deletions components/esp_lvgl_port/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ Rotation mode can be selected in the `lvgl_port_display_cfg_t` structure.
``` c
const lvgl_port_display_cfg_t disp_cfg = {
...
.sw_rotate = true / false, // true: software; false: hardware
...
.flags = {
...
.sw_rotate = true / false, // true: software; false: hardware
}
}
```
Display rotation can be changed at runtime.
Expand All @@ -204,11 +206,15 @@ Display rotation can be changed at runtime.
If the SRAM is insufficient, you can use the PSRAM as a canvas and use a small trans_buffer to carry it, this makes drawing more efficient.
``` c
.buffer_size = DISP_WIDTH*DISP_HEIGHT, // in PSRAM, not DMA-capable
.trans_size = size, // in SRAM, DMA-capable
.flags = {
.buff_spiram = true,
.buff_dma = false,
const lvgl_port_display_cfg_t disp_cfg = {
...
.buffer_size = DISP_WIDTH * DISP_HEIGHT, // in PSRAM, not DMA-capable
.trans_size = size, // in SRAM, DMA-capable
.flags = {
.buff_spiram = true,
.buff_dma = false,
...
}
}
```

Expand Down
2 changes: 1 addition & 1 deletion components/esp_lvgl_port/esp_lvgl_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ lv_disp_t *lvgl_port_add_disp(const lvgl_port_display_cfg_t *disp_cfg)
disp_ctx->disp_drv.hor_res = disp_cfg->hres;
disp_ctx->disp_drv.ver_res = disp_cfg->vres;
disp_ctx->disp_drv.flush_cb = lvgl_port_flush_callback;
disp_ctx->disp_drv.sw_rotate = disp_cfg->sw_rotate;
disp_ctx->disp_drv.sw_rotate = disp_cfg->flags.sw_rotate;
if (disp_ctx->disp_drv.sw_rotate == false) {
disp_ctx->disp_drv.drv_update_cb = lvgl_port_update_callback;
}
Expand Down
2 changes: 1 addition & 1 deletion components/esp_lvgl_port/include/esp_lvgl_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ typedef struct {
uint32_t hres; /*!< LCD display horizontal resolution */
uint32_t vres; /*!< LCD display vertical resolution */
bool monochrome; /*!< True, if display is monochrome and using 1bit for 1px */
bool sw_rotate; /*!< Use software rotation (slower) */
lvgl_port_rotation_cfg_t rotation; /*!< Default values of the screen rotation */

struct {
unsigned int buff_dma: 1; /*!< Allocated LVGL buffer will be DMA capable */
unsigned int buff_spiram: 1; /*!< Allocated LVGL buffer will be in PSRAM */
unsigned int sw_rotate: 1; /*!< Use software rotation (slower) */
} flags;
} lvgl_port_display_cfg_t;

Expand Down

0 comments on commit d638271

Please sign in to comment.