Description
I am having trouble with my the standard linux framebuffer and the top of my project getting clipped off. Also no touch inputs are being accepted.
What MCU/Processor/Board and compiler are you using?
Linux with an ARM processor, and this generic capacitive touchscreen.
What do you want to achieve?
I want the screen to not clip and to be able to click a button.
What have you tried so far?
I started with this
and also this:
Output on the console:
The framebuffer device was opened successfully.
1360x768, 16bpp
The framebuffer device was mapped to memory successfully.
I am also getting a warning through the logging function of:
Warn: lv_indev_drv_register: no display registered hence can't attache the indev to a display (src/GUI/lvgl/src/lv_hal/lv_hal_indev.c #75)
which I’m sure means I have set something incorrectly. I have done the evtest and I know I have the correct event set in the lv_conf.h
I feel like I’m spinning my wheels here.
Code to reproduce
Main:
#define DISP_BUF_SIZE (10*LV_HOR_RES_MAX)
int main(void)
{
lv_init();
fbdev_init();
hal_init();
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL);
lv_obj_set_pos(btn, 10, 10);
lv_obj_set_size(btn, 300, 200);
lv_obj_set_event_cb(btn, btn_event_cb);
lv_obj_t * label = lv_label_create(btn, NULL);
lv_label_set_text(label, "Button");
/*Handle LitlevGL tasks (tickless mode)*/
while (1)
{
lv_task_handler();
lv_tick_inc(5);
}
return 0;
}
static void hal_init(void)
{
evdev_init();
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = evdev_read;
lv_indev_drv_register(&indev_drv);
/*A small buffer for LittlevGL to draw the screen's content*/
static lv_color_t buf[DISP_BUF_SIZE];
/*Initialize a descriptor for the buffer*/
static lv_disp_buf_t disp_buf;
lv_disp_buf_init(&disp_buf, buf, NULL, DISP_BUF_SIZE);
/*Initialize and register a display driver*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.buffer = &disp_buf;
disp_drv.flush_cb = fbdev_flush;
lv_disp_drv_register(&disp_drv);
}
lv_conf.h
/* Maximal horizontal and vertical resolution to support by the library.*/
//#define LV_HOR_RES_MAX (800)
//#define LV_VER_RES_MAX (480)
#define LV_HOR_RES_MAX (1360)
#define LV_VER_RES_MAX (768)
/* Color depth:
* - 1: 1 byte per pixel
* - 8: RGB233
* - 16: RGB565
* - 32: ARGB8888
*/
#define LV_COLOR_DEPTH 16
Screenshot and/or video
Here is a screenshot. The code above just creates a button, and the screen is clipped for that too. As soon as I run the program, it shows the full screen, but then it immediately starts clipping.