是这样的,我用imx283开发板,由于还没有移植好tslib,所以就用mouse_hid.c改了一下,在获取坐标的函数里直接赋坐标值模拟按键触摸,但是屏幕没有反应?
界面是自带的demo例程
bool mouse_hid_read(lv_indev_data_t * data)
{
static lv_indev_state_t st;
static unsigned char b;
//ts_read(touch_pad,&sample,1);
data->point.x = 240;
data->point.y = 25;
if(st == LV_INDEV_STATE_PR)
{
b ++;
if(b > 20)
{
b = 0;
st = LV_INDEV_STATE_REL;
}
}
else
{
b ++;
if(b > 20)
{
b = 0;
st = LV_INDEV_STATE_PR;
}
}
data->state = st;
printf("x = %d y = %d state = %d\r\n",data->point.x,data->point.y,data->state);
return false;
}
离线
调用了的,while(1) {
lv_tick_inc(5);
lv_task_handler();
usleep(5000);
}
就是自带的demo,没改这个
离线
int main(void)
{
/*LittlevGL init*/
lv_init();
/*Linux frame buffer device init*/
fbdev_init();
mouse_hid_init();
/*Add a display the LittlevGL sing the frame buffer driver*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.disp_flush = fbdev_flush; /*It flushes the internal graphical buffer to the frame buffer*/
lv_disp_drv_register(&disp_drv);
lv_indev_drv_t in_drv;
lv_indev_drv_init(&in_drv);
in_drv.read = mouse_hid_read;
lv_indev_drv_register(&in_drv);
/*Create a Demo*/
demo_create();
//tpcal_create();
//lv_obj_t * label = lv_label_create(lv_scr_act(), NULL);
//lv_label_set_text(label, "Hello world!");
//lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
/*Handle LitlevGL tasks (tickless mode)*/
while(1) {
lv_tick_inc(5);
lv_task_handler();
usleep(5000);
}
return 0;
}
离线
lv_tick_inc 这个函数有没有调用,这个很重要
调用了的,直接用的官方demo
离线
除了触摸之外,其他正常吗?
显示没问题,就是界面没反应
离线
lv_indev_drv_init(&pdat->indev);
pdat->indev.type = LV_INDEV_TYPE_POINTER;
pdat->indev.read = ex_tp_read;
lv_indev_drv_register(&pdat->indev);我用的是这种输入的,用tp,没问题,没用鼠标试验过哦
非常感谢,点醒梦中人啊,加上这句可以了
in_drv.type = LV_INDEV_TYPE_POINTER;
离线
可以用鼠标拖动了吗?
还没弄那个,我才了解这个ui,准备弄到linux上用触摸屏
离线