mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 05:36:37 +00:00
Support evdev on Linux
This commit is contained in:
parent
ac5fe4a424
commit
fdc5f9170a
@ -11,6 +11,10 @@
|
|||||||
#include "drv/tft/tft_driver.h"
|
#include "drv/tft/tft_driver.h"
|
||||||
#include "tft_driver_posix_fbdev.h"
|
#include "tft_driver_posix_fbdev.h"
|
||||||
|
|
||||||
|
#if USE_EVDEV || USE_BSD_EVDEV
|
||||||
|
#include "indev/evdev.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "dev/device.h"
|
#include "dev/device.h"
|
||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
#include "hasp_gui.h"
|
#include "hasp_gui.h"
|
||||||
@ -23,6 +27,9 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern uint16_t tft_width;
|
||||||
|
extern uint16_t tft_height;
|
||||||
|
|
||||||
namespace dev {
|
namespace dev {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,6 +78,13 @@ void TftFbdevDrv::init(int32_t w, int h)
|
|||||||
fbdev_init();
|
fbdev_init();
|
||||||
fbdev_get_sizes((uint32_t*)&_width, (uint32_t*)&_height);
|
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
|
#if HASP_USE_LVGL_TASK
|
||||||
#error "fbdev LVGL task is not implemented"
|
#error "fbdev LVGL task is not implemented"
|
||||||
#else
|
#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)
|
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)
|
bool TftFbdevDrv::is_driver_pin(uint8_t pin)
|
||||||
{
|
{
|
||||||
|
@ -291,6 +291,10 @@ void guiSetup()
|
|||||||
#endif
|
#endif
|
||||||
disp_drv.monitor_cb = gui_monitor_cb;
|
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 */
|
/* Initialize the touch pad */
|
||||||
static lv_indev_drv_t indev_drv;
|
static lv_indev_drv_t indev_drv;
|
||||||
lv_indev_drv_init(&indev_drv);
|
lv_indev_drv_init(&indev_drv);
|
||||||
@ -331,6 +335,8 @@ void guiSetup()
|
|||||||
gui_hide_pointer(false);
|
gui_hide_pointer(false);
|
||||||
lv_indev_set_cursor(mouse_indev, cursor); /*Connect the image object to the driver*/
|
lv_indev_set_cursor(mouse_indev, cursor); /*Connect the image object to the driver*/
|
||||||
|
|
||||||
|
#endif // TOUCH_DRIVER != -1 || USE_MONITOR
|
||||||
|
|
||||||
#if HASP_TARGET_ARDUINO
|
#if HASP_TARGET_ARDUINO
|
||||||
// drv_touch_init(gui_settings.rotation); // Touch driver
|
// drv_touch_init(gui_settings.rotation); // Touch driver
|
||||||
haspTouch.init(tft_width, tft_height);
|
haspTouch.init(tft_width, tft_height);
|
||||||
|
@ -14,6 +14,7 @@ build_flags =
|
|||||||
;-D LV_LVGL_H_INCLUDE_SIMPLE
|
;-D LV_LVGL_H_INCLUDE_SIMPLE
|
||||||
;-D LV_DRV_NO_CONF
|
;-D LV_DRV_NO_CONF
|
||||||
-D USE_FBDEV
|
-D USE_FBDEV
|
||||||
|
-D USE_EVDEV
|
||||||
; ----- ArduinoJson
|
; ----- ArduinoJson
|
||||||
-D ARDUINOJSON_DECODE_UNICODE=1
|
-D ARDUINOJSON_DECODE_UNICODE=1
|
||||||
-D HASP_NUM_PAGES=12
|
-D HASP_NUM_PAGES=12
|
||||||
|
Loading…
x
Reference in New Issue
Block a user