金牌会员
积分 1289
金钱 1289
注册时间 2014-6-15
在线时间 143 小时
1 金钱
type can be
• LV_INDEV_TYPE_POINTER touchpad or mouse
• LV_INDEV_TYPE_KEYPAD keyboard or keypad
• LV_INDEV_TYPE_ENCODER encoder with left/right turn and push options
• LV_INDEV_TYPE_BUTTON external buttons virtually pressing the screen
上边是从LVGL的document抄出来的,
我的设备设置了 输入类型为 LV_INDEV_TYPE_POINTER,触摸屏操作正常
然后,增加了一个输入设备为 LV_INDEV_TYPE_BUTTON,关键代码如下:
/* Initialize and register a display input driver */
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv); /*Basic initialization*/
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = evdev_read; //lv_gesture_dir_t lv_indev_get_gesture_dir(const lv_indev_t * indev)
lv_indev_t * my_indev = lv_indev_drv_register(&indev_drv);
keyboard_init();
lv_indev_drv_t indev_drv_btn;
lv_indev_drv_init(&indev_drv_btn);
indev_drv_btn.type = LV_INDEV_TYPE_BUTTON;
indev_drv_btn.read_cb = keypad_read;
lv_indev_t *indev_keypad = lv_indev_drv_register(&indev_drv_btn);
然后,发现物理按键正常了,但是触摸屏幕上的button没反应了,
我的问题: 1. 难道LVGL里这几种输入方式,这个只能支持一种吗? 如果我需要触摸屏和物理按键同时工作,怎么办?
2. 物理按键还必须通过lv_indev_set_button_points()依附于虚拟button 吗?
我来回答