Support evdev on Linux

This commit is contained in:
Kuba Szczodrzyński 2024-02-08 18:57:08 +01:00
parent ac5fe4a424
commit fdc5f9170a
No known key found for this signature in database
GPG Key ID: 43037AC62A600562
3 changed files with 22 additions and 1 deletions

View File

@ -11,6 +11,10 @@
#include "drv/tft/tft_driver.h"
#include "tft_driver_posix_fbdev.h"
#if USE_EVDEV || USE_BSD_EVDEV
#include "indev/evdev.h"
#endif
#include "dev/device.h"
#include "hasp_debug.h"
#include "hasp_gui.h"
@ -23,6 +27,9 @@
#include <unistd.h>
extern uint16_t tft_width;
extern uint16_t tft_height;
namespace dev {
/**
@ -71,6 +78,13 @@ void TftFbdevDrv::init(int32_t w, int h)
fbdev_init();
fbdev_get_sizes((uint32_t*)&_width, (uint32_t*)&_height);
tft_width = _width;
tft_height = _height;
#if USE_EVDEV || USE_BSD_EVDEV
evdev_register("/dev/input/event2", LV_INDEV_TYPE_POINTER, NULL);
#endif
#if HASP_USE_LVGL_TASK
#error "fbdev LVGL task is not implemented"
#else
@ -99,7 +113,7 @@ void TftFbdevDrv::set_invert(bool invert)
{}
void TftFbdevDrv::flush_pixels(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p)
{
fbdev_flush(disp, area, color_p);
lv_disp_flush_ready(disp);
}
bool TftFbdevDrv::is_driver_pin(uint8_t pin)
{

View File

@ -291,6 +291,10 @@ void guiSetup()
#endif
disp_drv.monitor_cb = gui_monitor_cb;
// register a touchscreen/mouse driver - only on real hardware and SDL2
// Win32 and POSIX handles input drivers in tft_driver
#if TOUCH_DRIVER != -1 || USE_MONITOR
/* Initialize the touch pad */
static lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
@ -331,6 +335,8 @@ void guiSetup()
gui_hide_pointer(false);
lv_indev_set_cursor(mouse_indev, cursor); /*Connect the image object to the driver*/
#endif // TOUCH_DRIVER != -1 || USE_MONITOR
#if HASP_TARGET_ARDUINO
// drv_touch_init(gui_settings.rotation); // Touch driver
haspTouch.init(tft_width, tft_height);

View File

@ -14,6 +14,7 @@ build_flags =
;-D LV_LVGL_H_INCLUDE_SIMPLE
;-D LV_DRV_NO_CONF
-D USE_FBDEV
-D USE_EVDEV
; ----- ArduinoJson
-D ARDUINOJSON_DECODE_UNICODE=1
-D HASP_NUM_PAGES=12