feat(nuttx): get fd by lv_xxx_get_driver_data (#4947)
Signed-off-by: YanXiaowei <yanxiaowei@xiaomi.com> Co-authored-by: YanXiaowei <yanxiaowei@xiaomi.com>
This commit is contained in:
@@ -32,13 +32,14 @@
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
/* fd should be defined at the beginning */
|
||||
int fd;
|
||||
struct fb_videoinfo_s vinfo;
|
||||
struct fb_planeinfo_s pinfo;
|
||||
|
||||
void * mem;
|
||||
void * mem2;
|
||||
uint32_t mem2_yoffset;
|
||||
int fd;
|
||||
} lv_nuttx_fb_t;
|
||||
|
||||
/**********************
|
||||
@@ -132,7 +133,6 @@ int lv_nuttx_fbdev_set_file(lv_display_t * disp, const char * file)
|
||||
|
||||
lv_display_set_draw_buffers(disp, dsc->mem, dsc->mem2,
|
||||
(dsc->pinfo.stride * dsc->vinfo.yres), LV_DISP_RENDER_MODE_DIRECT);
|
||||
lv_display_set_user_data(disp, (void *)(uintptr_t)(dsc->fd));
|
||||
lv_display_set_resolution(disp, dsc->vinfo.xres, dsc->vinfo.yres);
|
||||
lv_timer_set_cb(disp->refr_timer, display_refr_timer_cb);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
/* fd should be defined at the beginning */
|
||||
int fd;
|
||||
lv_display_t * disp;
|
||||
struct lcddev_area_s area;
|
||||
@@ -201,7 +202,6 @@ static lv_display_t * lcd_init(int fd, int hor_res, int ver_res)
|
||||
lv_display_add_event_cb(lcd->disp, rounder_cb, LV_EVENT_INVALIDATE_AREA, lcd);
|
||||
lv_display_add_event_cb(lcd->disp, display_release_cb, LV_EVENT_DELETE, lcd->disp);
|
||||
lv_display_set_driver_data(lcd->disp, lcd);
|
||||
lv_display_set_user_data(lcd->disp, (void *)(uintptr_t)fd);
|
||||
|
||||
return lcd->disp;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ static int lv_nuttx_uv_fb_init(lv_nuttx_uv_t * uv_info, lv_nuttx_uv_fb_ctx_t * f
|
||||
LV_ASSERT_NULL(disp);
|
||||
LV_ASSERT_NULL(loop);
|
||||
|
||||
fb_ctx->fd = (uintptr_t)lv_display_get_user_data(disp);
|
||||
fb_ctx->fd = *(int *)lv_display_get_driver_data(disp);
|
||||
|
||||
if(fb_ctx->fd <= 0) {
|
||||
LV_LOG_USER("skip uv fb init.");
|
||||
@@ -271,7 +271,7 @@ static int lv_nuttx_uv_input_init(lv_nuttx_uv_t * uv_info, lv_nuttx_uv_input_ctx
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
input_ctx->fd = (uintptr_t)lv_indev_get_user_data(indev);
|
||||
input_ctx->fd = *(int *)lv_indev_get_driver_data(indev);
|
||||
if(input_ctx->fd <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
/* fd should be defined at the beginning */
|
||||
int fd;
|
||||
lv_indev_state_t last_state;
|
||||
lv_indev_t * indev_drv;
|
||||
@@ -155,7 +156,6 @@ static lv_indev_t * touchscreen_init(int fd)
|
||||
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
|
||||
lv_indev_set_read_cb(indev, touchscreen_read);
|
||||
lv_indev_set_driver_data(indev, touchscreen);
|
||||
lv_indev_set_user_data(indev, (void *)(uintptr_t)fd);
|
||||
lv_indev_add_event_cb(indev, touchscreen_delete_cb, LV_EVENT_DELETE, indev);
|
||||
return indev;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user