Skip to content

Commit

Permalink
feat(lvgl_port): Used added SW rotation to LVGL9
Browse files Browse the repository at this point in the history
  • Loading branch information
espzav committed Jul 26, 2024
1 parent 645f085 commit 2224906
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 437 deletions.
4 changes: 3 additions & 1 deletion components/esp_lvgl_port/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

## 2.3.0
- Fixed LVGL port for using with LVGL9 OS FreeRTOS enabled
- Fixed bad handled touch due to synchronization timer task

### Features
- Added support for SW rotation in LVGL9
- Added support for PPA rotation in LVGL9 (available for ESP32P4)

## 2.2.2

Expand Down
199 changes: 0 additions & 199 deletions components/esp_lvgl_port/src/common/ppa/lcd_ppa.c

This file was deleted.

111 changes: 0 additions & 111 deletions components/esp_lvgl_port/src/common/ppa/lcd_ppa.h

This file was deleted.

11 changes: 11 additions & 0 deletions components/esp_lvgl_port/src/lvgl9/esp_lvgl_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static const char *TAG = "LVGL";
typedef struct lvgl_port_ctx_s {
TaskHandle_t lvgl_task;
SemaphoreHandle_t lvgl_mux;
SemaphoreHandle_t timer_mux;
QueueHandle_t lvgl_queue;
SemaphoreHandle_t task_init_mux;
esp_timer_handle_t tick_timer;
Expand Down Expand Up @@ -68,6 +69,9 @@ esp_err_t lvgl_port_init(const lvgl_port_cfg_t *cfg)
if (lvgl_port_ctx.task_max_sleep_ms == 0) {
lvgl_port_ctx.task_max_sleep_ms = 500;
}
/* Timer semaphore */
lvgl_port_ctx.timer_mux = xSemaphoreCreateMutex();
ESP_GOTO_ON_FALSE(lvgl_port_ctx.timer_mux, ESP_ERR_NO_MEM, err, TAG, "Create timer mutex fail!");
/* LVGL semaphore */
lvgl_port_ctx.lvgl_mux = xSemaphoreCreateRecursiveMutex();
ESP_GOTO_ON_FALSE(lvgl_port_ctx.lvgl_mux, ESP_ERR_NO_MEM, err, TAG, "Create LVGL mutex fail!");
Expand Down Expand Up @@ -229,6 +233,7 @@ static void lvgl_port_task(void *arg)

/* Call read input devices */
if (event.type == LVGL_PORT_EVENT_TOUCH) {
xSemaphoreTake(lvgl_port_ctx.timer_mux, portMAX_DELAY);
if (event.param != NULL) {
lv_indev_read(event.param);
} else {
Expand All @@ -238,6 +243,7 @@ static void lvgl_port_task(void *arg)
indev = lv_indev_get_next(indev);
}
}
xSemaphoreGive(lvgl_port_ctx.timer_mux);
}

/* Handle LVGL */
Expand All @@ -264,6 +270,9 @@ static void lvgl_port_task(void *arg)

static void lvgl_port_task_deinit(void)
{
if (lvgl_port_ctx.timer_mux) {
vSemaphoreDelete(lvgl_port_ctx.timer_mux);
}
if (lvgl_port_ctx.lvgl_mux) {
vSemaphoreDelete(lvgl_port_ctx.lvgl_mux);
}
Expand All @@ -282,8 +291,10 @@ static void lvgl_port_task_deinit(void)

static void lvgl_port_tick_increment(void *arg)
{
xSemaphoreTake(lvgl_port_ctx.timer_mux, portMAX_DELAY);
/* Tell LVGL how many milliseconds have elapsed */
lv_tick_inc(lvgl_port_ctx.timer_period_ms);
xSemaphoreGive(lvgl_port_ctx.timer_mux);
}

static esp_err_t lvgl_port_tick_init(void)
Expand Down
Loading

0 comments on commit 2224906

Please sign in to comment.