Hal refactored (#99)
This commit is contained in:
committed by
GitHub
parent
0188ce721c
commit
33bb742dfb
@@ -90,7 +90,7 @@ lv_indev_t *lvgl_port_add_navigation_buttons(const lvgl_port_nav_btns_cfg_t *but
|
||||
lv_indev_set_type(indev, LV_INDEV_TYPE_ENCODER);
|
||||
lv_indev_set_read_cb(indev, lvgl_port_navigation_buttons_read);
|
||||
lv_indev_set_disp(indev, buttons_cfg->disp);
|
||||
lv_indev_set_user_data(indev, buttons_ctx);
|
||||
lv_indev_set_driver_data(indev, buttons_ctx);
|
||||
//buttons_ctx->indev->long_press_repeat_time = 300;
|
||||
buttons_ctx->indev = indev;
|
||||
lvgl_port_unlock();
|
||||
@@ -116,7 +116,7 @@ err:
|
||||
esp_err_t lvgl_port_remove_navigation_buttons(lv_indev_t *buttons)
|
||||
{
|
||||
assert(buttons);
|
||||
lvgl_port_nav_btns_ctx_t *buttons_ctx = (lvgl_port_nav_btns_ctx_t *)lv_indev_get_user_data(buttons);
|
||||
lvgl_port_nav_btns_ctx_t *buttons_ctx = (lvgl_port_nav_btns_ctx_t *)lv_indev_get_driver_data(buttons);
|
||||
|
||||
lvgl_port_lock(0);
|
||||
/* Remove input device driver */
|
||||
@@ -140,7 +140,7 @@ static void lvgl_port_navigation_buttons_read(lv_indev_t *indev_drv, lv_indev_da
|
||||
static uint32_t last_key = 0;
|
||||
|
||||
assert(indev_drv);
|
||||
lvgl_port_nav_btns_ctx_t *ctx = (lvgl_port_nav_btns_ctx_t *)lv_indev_get_user_data(indev_drv);
|
||||
lvgl_port_nav_btns_ctx_t *ctx = (lvgl_port_nav_btns_ctx_t *)lv_indev_get_driver_data(indev_drv);
|
||||
assert(ctx);
|
||||
|
||||
/* Buttons */
|
||||
|
||||
@@ -114,7 +114,7 @@ lv_display_t *lvgl_port_add_disp(const lvgl_port_display_cfg_t *disp_cfg)
|
||||
lv_display_set_flush_cb(disp, lvgl_port_flush_callback);
|
||||
lv_display_add_event_cb(disp, lvgl_port_disp_size_update_callback, LV_EVENT_RESOLUTION_CHANGED, disp_ctx);
|
||||
|
||||
lv_display_set_user_data(disp, disp_ctx);
|
||||
lv_display_set_driver_data(disp, disp_ctx);
|
||||
disp_ctx->disp_drv = disp;
|
||||
|
||||
#if LVGL_PORT_HANDLE_FLUSH_READY
|
||||
@@ -146,7 +146,7 @@ err:
|
||||
esp_err_t lvgl_port_remove_disp(lv_display_t *disp)
|
||||
{
|
||||
assert(disp);
|
||||
lvgl_port_display_ctx_t *disp_ctx = (lvgl_port_display_ctx_t *)lv_display_get_user_data(disp);
|
||||
lvgl_port_display_ctx_t *disp_ctx = (lvgl_port_display_ctx_t *)lv_display_get_driver_data(disp);
|
||||
|
||||
lvgl_port_lock(0);
|
||||
lv_disp_remove(disp);
|
||||
@@ -229,7 +229,7 @@ static void _lvgl_port_transform_monochrome(lv_display_t *display, const lv_area
|
||||
static void lvgl_port_flush_callback(lv_display_t *drv, const lv_area_t *area, uint8_t *color_map)
|
||||
{
|
||||
assert(drv != NULL);
|
||||
lvgl_port_display_ctx_t *disp_ctx = (lvgl_port_display_ctx_t *)lv_display_get_user_data(drv);
|
||||
lvgl_port_display_ctx_t *disp_ctx = (lvgl_port_display_ctx_t *)lv_display_get_driver_data(drv);
|
||||
assert(disp_ctx != NULL);
|
||||
|
||||
//TODO: try to use SPI_SWAP_DATA_RX from https://docs.espressif.com/projects/esp-idf/en/v5.1/esp32s3/api-reference/peripherals/spi_master.html#c.SPI_SWAP_DATA_TX
|
||||
|
||||
@@ -71,7 +71,7 @@ lv_indev_t *lvgl_port_add_encoder(const lvgl_port_encoder_cfg_t *encoder_cfg)
|
||||
lv_indev_set_type(indev, LV_INDEV_TYPE_ENCODER);
|
||||
lv_indev_set_read_cb(indev, lvgl_port_encoder_read);
|
||||
lv_indev_set_disp(indev, encoder_cfg->disp);
|
||||
lv_indev_set_user_data(indev, encoder_ctx);
|
||||
lv_indev_set_driver_data(indev, encoder_ctx);
|
||||
encoder_ctx->indev = indev;
|
||||
lvgl_port_unlock();
|
||||
|
||||
@@ -95,7 +95,7 @@ err:
|
||||
esp_err_t lvgl_port_remove_encoder(lv_indev_t *encoder)
|
||||
{
|
||||
assert(encoder);
|
||||
lvgl_port_encoder_ctx_t *encoder_ctx = (lvgl_port_encoder_ctx_t *)lv_indev_get_user_data(encoder);
|
||||
lvgl_port_encoder_ctx_t *encoder_ctx = (lvgl_port_encoder_ctx_t *)lv_indev_get_driver_data(encoder);
|
||||
|
||||
if (encoder_ctx->knob_handle != NULL) {
|
||||
iot_knob_delete(encoder_ctx->knob_handle);
|
||||
@@ -125,7 +125,7 @@ static void lvgl_port_encoder_read(lv_indev_t *indev_drv, lv_indev_data_t *data)
|
||||
{
|
||||
static int32_t last_v = 0;
|
||||
assert(indev_drv);
|
||||
lvgl_port_encoder_ctx_t *ctx = (lvgl_port_encoder_ctx_t *)lv_indev_get_user_data(indev_drv);
|
||||
lvgl_port_encoder_ctx_t *ctx = (lvgl_port_encoder_ctx_t *)lv_indev_get_driver_data(indev_drv);
|
||||
assert(ctx);
|
||||
|
||||
int32_t invd = iot_knob_get_count_value(ctx->knob_handle);
|
||||
|
||||
@@ -52,7 +52,7 @@ lv_indev_t *lvgl_port_add_touch(const lvgl_port_touch_cfg_t *touch_cfg)
|
||||
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
|
||||
lv_indev_set_read_cb(indev, lvgl_port_touchpad_read);
|
||||
lv_indev_set_disp(indev, touch_cfg->disp);
|
||||
lv_indev_set_user_data(indev, touch_ctx);
|
||||
lv_indev_set_driver_data(indev, touch_ctx);
|
||||
touch_ctx->indev = indev;
|
||||
lvgl_port_unlock();
|
||||
|
||||
@@ -62,7 +62,7 @@ lv_indev_t *lvgl_port_add_touch(const lvgl_port_touch_cfg_t *touch_cfg)
|
||||
esp_err_t lvgl_port_remove_touch(lv_indev_t *touch)
|
||||
{
|
||||
assert(touch);
|
||||
lvgl_port_touch_ctx_t *touch_ctx = (lvgl_port_touch_ctx_t *)lv_indev_get_user_data(touch);
|
||||
lvgl_port_touch_ctx_t *touch_ctx = (lvgl_port_touch_ctx_t *)lv_indev_get_driver_data(touch);
|
||||
|
||||
lvgl_port_lock(0);
|
||||
/* Remove input device driver */
|
||||
@@ -83,7 +83,7 @@ esp_err_t lvgl_port_remove_touch(lv_indev_t *touch)
|
||||
static void lvgl_port_touchpad_read(lv_indev_t *indev_drv, lv_indev_data_t *data)
|
||||
{
|
||||
assert(indev_drv);
|
||||
lvgl_port_touch_ctx_t *touch_ctx = (lvgl_port_touch_ctx_t *)lv_indev_get_user_data(indev_drv);
|
||||
lvgl_port_touch_ctx_t *touch_ctx = (lvgl_port_touch_ctx_t *)lv_indev_get_driver_data(indev_drv);
|
||||
assert(touch_ctx);
|
||||
assert(touch_ctx->handle);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ lv_indev_t *lvgl_port_add_usb_hid_mouse_input(const lvgl_port_hid_mouse_cfg_t *m
|
||||
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
|
||||
lv_indev_set_read_cb(indev, lvgl_port_usb_hid_read_mouse);
|
||||
lv_indev_set_disp(indev, mouse_cfg->disp);
|
||||
lv_indev_set_user_data(indev, hid_ctx);
|
||||
lv_indev_set_driver_data(indev, hid_ctx);
|
||||
hid_ctx->mouse.indev = indev;
|
||||
lvgl_port_unlock();
|
||||
|
||||
@@ -126,7 +126,7 @@ lv_indev_t *lvgl_port_add_usb_hid_keyboard_input(const lvgl_port_hid_keyboard_cf
|
||||
lv_indev_set_type(indev, LV_INDEV_TYPE_KEYPAD);
|
||||
lv_indev_set_read_cb(indev, lvgl_port_usb_hid_read_kb);
|
||||
lv_indev_set_disp(indev, keyboard_cfg->disp);
|
||||
lv_indev_set_user_data(indev, hid_ctx);
|
||||
lv_indev_set_driver_data(indev, hid_ctx);
|
||||
hid_ctx->kb.indev = indev;
|
||||
lvgl_port_unlock();
|
||||
|
||||
@@ -136,7 +136,7 @@ lv_indev_t *lvgl_port_add_usb_hid_keyboard_input(const lvgl_port_hid_keyboard_cf
|
||||
esp_err_t lvgl_port_remove_usb_hid_input(lv_indev_t *hid)
|
||||
{
|
||||
assert(hid);
|
||||
lvgl_port_usb_hid_ctx_t *hid_ctx = (lvgl_port_usb_hid_ctx_t *)lv_indev_get_user_data(hid);
|
||||
lvgl_port_usb_hid_ctx_t *hid_ctx = (lvgl_port_usb_hid_ctx_t *)lv_indev_get_driver_data(hid);
|
||||
|
||||
lvgl_port_lock(0);
|
||||
/* Remove input device driver */
|
||||
@@ -397,7 +397,7 @@ static void lvgl_port_usb_hid_read_mouse(lv_indev_t *indev_drv, lv_indev_data_t
|
||||
int16_t width = 0;
|
||||
int16_t height = 0;
|
||||
assert(indev_drv);
|
||||
lvgl_port_usb_hid_ctx_t *ctx = (lvgl_port_usb_hid_ctx_t *)lv_indev_get_user_data(indev_drv);
|
||||
lvgl_port_usb_hid_ctx_t *ctx = (lvgl_port_usb_hid_ctx_t *)lv_indev_get_driver_data(indev_drv);
|
||||
assert(ctx);
|
||||
|
||||
lv_display_t *disp = lv_indev_get_display(indev_drv);
|
||||
@@ -452,7 +452,7 @@ static void lvgl_port_usb_hid_read_mouse(lv_indev_t *indev_drv, lv_indev_data_t
|
||||
static void lvgl_port_usb_hid_read_kb(lv_indev_t *indev_drv, lv_indev_data_t *data)
|
||||
{
|
||||
assert(indev_drv);
|
||||
lvgl_port_usb_hid_ctx_t *ctx = (lvgl_port_usb_hid_ctx_t *)lv_indev_get_user_data(indev_drv);
|
||||
lvgl_port_usb_hid_ctx_t *ctx = (lvgl_port_usb_hid_ctx_t *)lv_indev_get_driver_data(indev_drv);
|
||||
assert(ctx);
|
||||
|
||||
data->key = ctx->kb.last_key;
|
||||
|
||||
Reference in New Issue
Block a user