Framebuffer clipping top and touchscreen input issues

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.
ezgif-3-dadecbf8c0b0

The warning is caused because you need to register the display before you register the input device. Otherwise LittlevGL has no display to attach the input device to.

For your other issue, my guess is that another program (or the Linux framebuffer console) is overwriting the top of your framebuffer.

Thanks, moving the indev stuff below the display stuff in the hal_init() worked for the touch screen.

Now when I click it appears to register, and the top of the screen appears momentarily. I assume you’re correct that something external is interfering. I’ll update the post if I find it.

Edit: Fixed, it was the lxdm.service service that was interfering.

Hi, i have the same problem, touchscreen was inactive. I have inizialized first video drive then touch drive and now it’s OK. You saved a man :slight_smile:
Thank you
Andrea

1 Like