|
|
|
@@ -1,13 +1,15 @@
|
|
|
|
|
/*
|
|
|
|
|
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
|
|
|
|
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: CC0-1.0
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <sys/lock.h>
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
|
#include "freertos/task.h"
|
|
|
|
|
#include "freertos/semphr.h"
|
|
|
|
|
#include "esp_timer.h"
|
|
|
|
|
#include "esp_lcd_panel_io.h"
|
|
|
|
|
#include "esp_lcd_panel_vendor.h"
|
|
|
|
@@ -60,99 +62,80 @@ static const char *TAG = "example";
|
|
|
|
|
#define EXAMPLE_LCD_CMD_BITS 8
|
|
|
|
|
#define EXAMPLE_LCD_PARAM_BITS 8
|
|
|
|
|
|
|
|
|
|
#define EXAMPLE_LVGL_DRAW_BUF_LINES 20 // number of display lines in each draw buffer
|
|
|
|
|
#define EXAMPLE_LVGL_TICK_PERIOD_MS 2
|
|
|
|
|
#define EXAMPLE_LVGL_TASK_MAX_DELAY_MS 500
|
|
|
|
|
#define EXAMPLE_LVGL_TASK_MIN_DELAY_MS 1
|
|
|
|
|
#define EXAMPLE_LVGL_TASK_STACK_SIZE (4 * 1024)
|
|
|
|
|
#define EXAMPLE_LVGL_TASK_PRIORITY 2
|
|
|
|
|
|
|
|
|
|
static SemaphoreHandle_t lvgl_mux = NULL;
|
|
|
|
|
|
|
|
|
|
#if CONFIG_EXAMPLE_LCD_TOUCH_ENABLED
|
|
|
|
|
esp_lcd_touch_handle_t tp = NULL;
|
|
|
|
|
#endif
|
|
|
|
|
// LVGL library is not thread-safe, this example will call LVGL APIs from different tasks, so use a mutex to protect it
|
|
|
|
|
static _lock_t lvgl_api_lock;
|
|
|
|
|
|
|
|
|
|
extern void example_lvgl_demo_ui(lv_disp_t *disp);
|
|
|
|
|
|
|
|
|
|
static bool example_notify_lvgl_flush_ready(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
|
|
|
|
|
{
|
|
|
|
|
lv_disp_drv_t *disp_driver = (lv_disp_drv_t *)user_ctx;
|
|
|
|
|
lv_disp_flush_ready(disp_driver);
|
|
|
|
|
lv_display_t *disp = (lv_display_t *)user_ctx;
|
|
|
|
|
lv_display_flush_ready(disp);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void example_lvgl_flush_cb(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
|
|
|
|
|
{
|
|
|
|
|
esp_lcd_panel_handle_t panel_handle = (esp_lcd_panel_handle_t) drv->user_data;
|
|
|
|
|
int offsetx1 = area->x1;
|
|
|
|
|
int offsetx2 = area->x2;
|
|
|
|
|
int offsety1 = area->y1;
|
|
|
|
|
int offsety2 = area->y2;
|
|
|
|
|
// copy a buffer's content to a specific area of the display
|
|
|
|
|
esp_lcd_panel_draw_bitmap(panel_handle, offsetx1, offsety1, offsetx2 + 1, offsety2 + 1, color_map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Rotate display and touch, when rotated screen in LVGL. Called when driver parameters are updated. */
|
|
|
|
|
static void example_lvgl_port_update_callback(lv_disp_drv_t *drv)
|
|
|
|
|
static void example_lvgl_port_update_callback(lv_display_t *disp)
|
|
|
|
|
{
|
|
|
|
|
esp_lcd_panel_handle_t panel_handle = (esp_lcd_panel_handle_t) drv->user_data;
|
|
|
|
|
esp_lcd_panel_handle_t panel_handle = lv_display_get_user_data(disp);
|
|
|
|
|
lv_display_rotation_t rotation = lv_display_get_rotation(disp);
|
|
|
|
|
|
|
|
|
|
switch (drv->rotated) {
|
|
|
|
|
case LV_DISP_ROT_NONE:
|
|
|
|
|
switch (rotation) {
|
|
|
|
|
case LV_DISPLAY_ROTATION_0:
|
|
|
|
|
// Rotate LCD display
|
|
|
|
|
esp_lcd_panel_swap_xy(panel_handle, false);
|
|
|
|
|
esp_lcd_panel_mirror(panel_handle, true, false);
|
|
|
|
|
#if CONFIG_EXAMPLE_LCD_TOUCH_ENABLED
|
|
|
|
|
// Rotate LCD touch
|
|
|
|
|
esp_lcd_touch_set_mirror_y(tp, false);
|
|
|
|
|
esp_lcd_touch_set_mirror_x(tp, false);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
case LV_DISP_ROT_90:
|
|
|
|
|
case LV_DISPLAY_ROTATION_90:
|
|
|
|
|
// Rotate LCD display
|
|
|
|
|
esp_lcd_panel_swap_xy(panel_handle, true);
|
|
|
|
|
esp_lcd_panel_mirror(panel_handle, true, true);
|
|
|
|
|
#if CONFIG_EXAMPLE_LCD_TOUCH_ENABLED
|
|
|
|
|
// Rotate LCD touch
|
|
|
|
|
esp_lcd_touch_set_mirror_y(tp, false);
|
|
|
|
|
esp_lcd_touch_set_mirror_x(tp, false);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
case LV_DISP_ROT_180:
|
|
|
|
|
case LV_DISPLAY_ROTATION_180:
|
|
|
|
|
// Rotate LCD display
|
|
|
|
|
esp_lcd_panel_swap_xy(panel_handle, false);
|
|
|
|
|
esp_lcd_panel_mirror(panel_handle, false, true);
|
|
|
|
|
#if CONFIG_EXAMPLE_LCD_TOUCH_ENABLED
|
|
|
|
|
// Rotate LCD touch
|
|
|
|
|
esp_lcd_touch_set_mirror_y(tp, false);
|
|
|
|
|
esp_lcd_touch_set_mirror_x(tp, false);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
case LV_DISP_ROT_270:
|
|
|
|
|
case LV_DISPLAY_ROTATION_270:
|
|
|
|
|
// Rotate LCD display
|
|
|
|
|
esp_lcd_panel_swap_xy(panel_handle, true);
|
|
|
|
|
esp_lcd_panel_mirror(panel_handle, false, false);
|
|
|
|
|
#if CONFIG_EXAMPLE_LCD_TOUCH_ENABLED
|
|
|
|
|
// Rotate LCD touch
|
|
|
|
|
esp_lcd_touch_set_mirror_y(tp, false);
|
|
|
|
|
esp_lcd_touch_set_mirror_x(tp, false);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void example_lvgl_flush_cb(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map)
|
|
|
|
|
{
|
|
|
|
|
example_lvgl_port_update_callback(disp);
|
|
|
|
|
esp_lcd_panel_handle_t panel_handle = lv_display_get_user_data(disp);
|
|
|
|
|
int offsetx1 = area->x1;
|
|
|
|
|
int offsetx2 = area->x2;
|
|
|
|
|
int offsety1 = area->y1;
|
|
|
|
|
int offsety2 = area->y2;
|
|
|
|
|
// because SPI LCD is big-endian, we need to swap the RGB bytes order
|
|
|
|
|
lv_draw_sw_rgb565_swap(px_map, (offsetx2 + 1 - offsetx1) * (offsety2 + 1 - offsety1));
|
|
|
|
|
// copy a buffer's content to a specific area of the display
|
|
|
|
|
esp_lcd_panel_draw_bitmap(panel_handle, offsetx1, offsety1, offsetx2 + 1, offsety2 + 1, px_map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if CONFIG_EXAMPLE_LCD_TOUCH_ENABLED
|
|
|
|
|
static void example_lvgl_touch_cb(lv_indev_drv_t * drv, lv_indev_data_t * data)
|
|
|
|
|
static void example_lvgl_touch_cb(lv_indev_t * indev, lv_indev_data_t * data)
|
|
|
|
|
{
|
|
|
|
|
uint16_t touchpad_x[1] = {0};
|
|
|
|
|
uint16_t touchpad_y[1] = {0};
|
|
|
|
|
uint8_t touchpad_cnt = 0;
|
|
|
|
|
|
|
|
|
|
/* Read touch controller data */
|
|
|
|
|
esp_lcd_touch_read_data(drv->user_data);
|
|
|
|
|
|
|
|
|
|
esp_lcd_touch_handle_t touch_pad = lv_indev_get_user_data(indev);
|
|
|
|
|
esp_lcd_touch_read_data(touch_pad);
|
|
|
|
|
/* Get coordinates */
|
|
|
|
|
bool touchpad_pressed = esp_lcd_touch_get_coordinates(drv->user_data, touchpad_x, touchpad_y, NULL, &touchpad_cnt, 1);
|
|
|
|
|
bool touchpad_pressed = esp_lcd_touch_get_coordinates(touch_pad, touchpad_x, touchpad_y, NULL, &touchpad_cnt, 1);
|
|
|
|
|
|
|
|
|
|
if (touchpad_pressed && touchpad_cnt > 0) {
|
|
|
|
|
data->point.x = touchpad_x[0];
|
|
|
|
@@ -170,44 +153,23 @@ static void example_increase_lvgl_tick(void *arg)
|
|
|
|
|
lv_tick_inc(EXAMPLE_LVGL_TICK_PERIOD_MS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool example_lvgl_lock(int timeout_ms)
|
|
|
|
|
{
|
|
|
|
|
// Convert timeout in milliseconds to FreeRTOS ticks
|
|
|
|
|
// If `timeout_ms` is set to -1, the program will block until the condition is met
|
|
|
|
|
const TickType_t timeout_ticks = (timeout_ms == -1) ? portMAX_DELAY : pdMS_TO_TICKS(timeout_ms);
|
|
|
|
|
return xSemaphoreTakeRecursive(lvgl_mux, timeout_ticks) == pdTRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void example_lvgl_unlock(void)
|
|
|
|
|
{
|
|
|
|
|
xSemaphoreGiveRecursive(lvgl_mux);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void example_lvgl_port_task(void *arg)
|
|
|
|
|
{
|
|
|
|
|
ESP_LOGI(TAG, "Starting LVGL task");
|
|
|
|
|
uint32_t task_delay_ms = EXAMPLE_LVGL_TASK_MAX_DELAY_MS;
|
|
|
|
|
uint32_t time_till_next_ms = 0;
|
|
|
|
|
uint32_t time_threshold_ms = 1000 / CONFIG_FREERTOS_HZ;
|
|
|
|
|
while (1) {
|
|
|
|
|
// Lock the mutex due to the LVGL APIs are not thread-safe
|
|
|
|
|
if (example_lvgl_lock(-1)) {
|
|
|
|
|
task_delay_ms = lv_timer_handler();
|
|
|
|
|
// Release the mutex
|
|
|
|
|
example_lvgl_unlock();
|
|
|
|
|
}
|
|
|
|
|
if (task_delay_ms > EXAMPLE_LVGL_TASK_MAX_DELAY_MS) {
|
|
|
|
|
task_delay_ms = EXAMPLE_LVGL_TASK_MAX_DELAY_MS;
|
|
|
|
|
} else if (task_delay_ms < EXAMPLE_LVGL_TASK_MIN_DELAY_MS) {
|
|
|
|
|
task_delay_ms = EXAMPLE_LVGL_TASK_MIN_DELAY_MS;
|
|
|
|
|
}
|
|
|
|
|
vTaskDelay(pdMS_TO_TICKS(task_delay_ms));
|
|
|
|
|
_lock_acquire(&lvgl_api_lock);
|
|
|
|
|
time_till_next_ms = lv_timer_handler();
|
|
|
|
|
_lock_release(&lvgl_api_lock);
|
|
|
|
|
// in case of triggering a task watch dog time out
|
|
|
|
|
time_till_next_ms = MAX(time_till_next_ms, time_threshold_ms);
|
|
|
|
|
usleep(1000 * time_till_next_ms);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void app_main(void)
|
|
|
|
|
{
|
|
|
|
|
static lv_disp_draw_buf_t disp_buf; // contains internal graphic buffer(s) called draw buffer(s)
|
|
|
|
|
static lv_disp_drv_t disp_drv; // contains callback functions
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(TAG, "Turn off LCD backlight");
|
|
|
|
|
gpio_config_t bk_gpio_config = {
|
|
|
|
|
.mode = GPIO_MODE_OUTPUT,
|
|
|
|
@@ -236,8 +198,6 @@ void app_main(void)
|
|
|
|
|
.lcd_param_bits = EXAMPLE_LCD_PARAM_BITS,
|
|
|
|
|
.spi_mode = 0,
|
|
|
|
|
.trans_queue_depth = 10,
|
|
|
|
|
.on_color_trans_done = example_notify_lvgl_flush_ready,
|
|
|
|
|
.user_ctx = &disp_drv,
|
|
|
|
|
};
|
|
|
|
|
// Attach the LCD to the SPI bus
|
|
|
|
|
ESP_ERROR_CHECK(esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)LCD_HOST, &io_config, &io_handle));
|
|
|
|
@@ -266,6 +226,49 @@ void app_main(void)
|
|
|
|
|
// user can flush pre-defined pattern to the screen before we turn on the screen or backlight
|
|
|
|
|
ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(panel_handle, true));
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(TAG, "Turn on LCD backlight");
|
|
|
|
|
gpio_set_level(EXAMPLE_PIN_NUM_BK_LIGHT, EXAMPLE_LCD_BK_LIGHT_ON_LEVEL);
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(TAG, "Initialize LVGL library");
|
|
|
|
|
lv_init();
|
|
|
|
|
|
|
|
|
|
// create a lvgl display
|
|
|
|
|
lv_display_t *display = lv_display_create(EXAMPLE_LCD_H_RES, EXAMPLE_LCD_V_RES);
|
|
|
|
|
|
|
|
|
|
// alloc draw buffers used by LVGL
|
|
|
|
|
// it's recommended to choose the size of the draw buffer(s) to be at least 1/10 screen sized
|
|
|
|
|
size_t draw_buffer_sz = EXAMPLE_LCD_H_RES * EXAMPLE_LVGL_DRAW_BUF_LINES * sizeof(lv_color16_t);
|
|
|
|
|
|
|
|
|
|
void *buf1 = spi_bus_dma_memory_alloc(LCD_HOST, draw_buffer_sz, 0);
|
|
|
|
|
assert(buf1);
|
|
|
|
|
void *buf2 = spi_bus_dma_memory_alloc(LCD_HOST, draw_buffer_sz, 0);
|
|
|
|
|
assert(buf2);
|
|
|
|
|
// initialize LVGL draw buffers
|
|
|
|
|
lv_display_set_buffers(display, buf1, buf2, draw_buffer_sz, LV_DISPLAY_RENDER_MODE_PARTIAL);
|
|
|
|
|
// associate the mipi panel handle to the display
|
|
|
|
|
lv_display_set_user_data(display, panel_handle);
|
|
|
|
|
// set color depth
|
|
|
|
|
lv_display_set_color_format(display, LV_COLOR_FORMAT_RGB565);
|
|
|
|
|
// set the callback which can copy the rendered image to an area of the display
|
|
|
|
|
lv_display_set_flush_cb(display, example_lvgl_flush_cb);
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(TAG, "Install LVGL tick timer");
|
|
|
|
|
// Tick interface for LVGL (using esp_timer to generate 2ms periodic event)
|
|
|
|
|
const esp_timer_create_args_t lvgl_tick_timer_args = {
|
|
|
|
|
.callback = &example_increase_lvgl_tick,
|
|
|
|
|
.name = "lvgl_tick"
|
|
|
|
|
};
|
|
|
|
|
esp_timer_handle_t lvgl_tick_timer = NULL;
|
|
|
|
|
ESP_ERROR_CHECK(esp_timer_create(&lvgl_tick_timer_args, &lvgl_tick_timer));
|
|
|
|
|
ESP_ERROR_CHECK(esp_timer_start_periodic(lvgl_tick_timer, EXAMPLE_LVGL_TICK_PERIOD_MS * 1000));
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(TAG, "Register io panel event callback for LVGL flush ready notification");
|
|
|
|
|
const esp_lcd_panel_io_callbacks_t cbs = {
|
|
|
|
|
.on_color_trans_done = example_notify_lvgl_flush_ready,
|
|
|
|
|
};
|
|
|
|
|
/* Register done callback */
|
|
|
|
|
ESP_ERROR_CHECK(esp_lcd_panel_io_register_event_callbacks(io_handle, &cbs, display));
|
|
|
|
|
|
|
|
|
|
#if CONFIG_EXAMPLE_LCD_TOUCH_ENABLED
|
|
|
|
|
esp_lcd_panel_io_handle_t tp_io_handle = NULL;
|
|
|
|
|
esp_lcd_panel_io_spi_config_t tp_io_config = ESP_LCD_TOUCH_IO_SPI_STMPE610_CONFIG(EXAMPLE_PIN_NUM_TOUCH_CS);
|
|
|
|
@@ -283,68 +286,27 @@ void app_main(void)
|
|
|
|
|
.mirror_y = 0,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
esp_lcd_touch_handle_t tp = NULL;
|
|
|
|
|
|
|
|
|
|
#if CONFIG_EXAMPLE_LCD_TOUCH_CONTROLLER_STMPE610
|
|
|
|
|
ESP_LOGI(TAG, "Initialize touch controller STMPE610");
|
|
|
|
|
ESP_ERROR_CHECK(esp_lcd_touch_new_spi_stmpe610(tp_io_handle, &tp_cfg, &tp));
|
|
|
|
|
#endif // CONFIG_EXAMPLE_LCD_TOUCH_CONTROLLER_STMPE610
|
|
|
|
|
#endif // CONFIG_EXAMPLE_LCD_TOUCH_ENABLED
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(TAG, "Turn on LCD backlight");
|
|
|
|
|
gpio_set_level(EXAMPLE_PIN_NUM_BK_LIGHT, EXAMPLE_LCD_BK_LIGHT_ON_LEVEL);
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(TAG, "Initialize LVGL library");
|
|
|
|
|
lv_init();
|
|
|
|
|
// alloc draw buffers used by LVGL
|
|
|
|
|
// it's recommended to choose the size of the draw buffer(s) to be at least 1/10 screen sized
|
|
|
|
|
lv_color_t *buf1 = heap_caps_malloc(EXAMPLE_LCD_H_RES * 20 * sizeof(lv_color_t), MALLOC_CAP_DMA);
|
|
|
|
|
assert(buf1);
|
|
|
|
|
lv_color_t *buf2 = heap_caps_malloc(EXAMPLE_LCD_H_RES * 20 * sizeof(lv_color_t), MALLOC_CAP_DMA);
|
|
|
|
|
assert(buf2);
|
|
|
|
|
// initialize LVGL draw buffers
|
|
|
|
|
lv_disp_draw_buf_init(&disp_buf, buf1, buf2, EXAMPLE_LCD_H_RES * 20);
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(TAG, "Register display driver to LVGL");
|
|
|
|
|
lv_disp_drv_init(&disp_drv);
|
|
|
|
|
disp_drv.hor_res = EXAMPLE_LCD_H_RES;
|
|
|
|
|
disp_drv.ver_res = EXAMPLE_LCD_V_RES;
|
|
|
|
|
disp_drv.flush_cb = example_lvgl_flush_cb;
|
|
|
|
|
disp_drv.drv_update_cb = example_lvgl_port_update_callback;
|
|
|
|
|
disp_drv.draw_buf = &disp_buf;
|
|
|
|
|
disp_drv.user_data = panel_handle;
|
|
|
|
|
lv_disp_t *disp = lv_disp_drv_register(&disp_drv);
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(TAG, "Install LVGL tick timer");
|
|
|
|
|
// Tick interface for LVGL (using esp_timer to generate 2ms periodic event)
|
|
|
|
|
const esp_timer_create_args_t lvgl_tick_timer_args = {
|
|
|
|
|
.callback = &example_increase_lvgl_tick,
|
|
|
|
|
.name = "lvgl_tick"
|
|
|
|
|
};
|
|
|
|
|
esp_timer_handle_t lvgl_tick_timer = NULL;
|
|
|
|
|
ESP_ERROR_CHECK(esp_timer_create(&lvgl_tick_timer_args, &lvgl_tick_timer));
|
|
|
|
|
ESP_ERROR_CHECK(esp_timer_start_periodic(lvgl_tick_timer, EXAMPLE_LVGL_TICK_PERIOD_MS * 1000));
|
|
|
|
|
|
|
|
|
|
#if CONFIG_EXAMPLE_LCD_TOUCH_ENABLED
|
|
|
|
|
static lv_indev_drv_t indev_drv; // Input device driver (Touch)
|
|
|
|
|
lv_indev_drv_init(&indev_drv);
|
|
|
|
|
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
|
|
|
|
indev_drv.disp = disp;
|
|
|
|
|
indev_drv.read_cb = example_lvgl_touch_cb;
|
|
|
|
|
indev_drv.user_data = tp;
|
|
|
|
|
|
|
|
|
|
lv_indev_drv_register(&indev_drv);
|
|
|
|
|
static lv_indev_t *indev;
|
|
|
|
|
indev = lv_indev_create(); // Input device driver (Touch)
|
|
|
|
|
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
|
|
|
|
|
lv_indev_set_display(indev, display);
|
|
|
|
|
lv_indev_set_user_data(indev, tp);
|
|
|
|
|
lv_indev_set_read_cb(indev, example_lvgl_touch_cb);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
lvgl_mux = xSemaphoreCreateRecursiveMutex();
|
|
|
|
|
assert(lvgl_mux);
|
|
|
|
|
ESP_LOGI(TAG, "Create LVGL task");
|
|
|
|
|
xTaskCreate(example_lvgl_port_task, "LVGL", EXAMPLE_LVGL_TASK_STACK_SIZE, NULL, EXAMPLE_LVGL_TASK_PRIORITY, NULL);
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(TAG, "Display LVGL Meter Widget");
|
|
|
|
|
// Lock the mutex due to the LVGL APIs are not thread-safe
|
|
|
|
|
if (example_lvgl_lock(-1)) {
|
|
|
|
|
example_lvgl_demo_ui(disp);
|
|
|
|
|
// Release the mutex
|
|
|
|
|
example_lvgl_unlock();
|
|
|
|
|
}
|
|
|
|
|
_lock_acquire(&lvgl_api_lock);
|
|
|
|
|
example_lvgl_demo_ui(display);
|
|
|
|
|
_lock_release(&lvgl_api_lock);
|
|
|
|
|
}
|
|
|
|
|