add support for mouse wheel
This commit is contained in:
parent
cdefeaa6ce
commit
d3af18dcbd
@ -17,6 +17,7 @@
|
|||||||
#include "lv_drivers/display/monitor.h"
|
#include "lv_drivers/display/monitor.h"
|
||||||
#include "lv_drivers/indev/mouse.h"
|
#include "lv_drivers/indev/mouse.h"
|
||||||
#include "lv_drivers/indev/keyboard.h"
|
#include "lv_drivers/indev/keyboard.h"
|
||||||
|
#include "lv_drivers/indev/mousewheel.h"
|
||||||
#include "lv_examples/lv_examples.h"
|
#include "lv_examples/lv_examples.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
@ -120,12 +121,19 @@ static void hal_init(void) {
|
|||||||
/* Add the keyboard as input device
|
/* Add the keyboard as input device
|
||||||
* Use the 'keyboard' driver which reads the PC's keyboard*/
|
* Use the 'keyboard' driver which reads the PC's keyboard*/
|
||||||
static lv_indev_drv_t keyb_drv;
|
static lv_indev_drv_t keyb_drv;
|
||||||
lv_indev_drv_init(&keyb_drv); /*Basic initialization*/
|
lv_indev_drv_init(&keyb_drv);
|
||||||
keyb_drv.type = LV_INDEV_TYPE_KEYPAD;
|
keyb_drv.type = LV_INDEV_TYPE_KEYPAD;
|
||||||
keyb_drv.read_cb = keyboard_read;
|
keyb_drv.read_cb = keyboard_read;
|
||||||
/*Register the driver in LVGL and save the created input device object*/
|
|
||||||
lv_indev_drv_register(&keyb_drv);
|
lv_indev_drv_register(&keyb_drv);
|
||||||
|
|
||||||
|
/* Add the mouse wheel as input device (encoder type)
|
||||||
|
* Use the 'mousewheel' driver which reads the PC's mouse wheel*/
|
||||||
|
static lv_indev_drv_t enc_drv;
|
||||||
|
lv_indev_drv_init(&enc_drv);
|
||||||
|
enc_drv.type = LV_INDEV_TYPE_ENCODER;
|
||||||
|
enc_drv.read_cb = mousewheel_read;
|
||||||
|
lv_indev_drv_register(&enc_drv);
|
||||||
|
|
||||||
/* Tick init.
|
/* Tick init.
|
||||||
* You have to call 'lv_tick_inc()' in periodically to inform LittelvGL about
|
* You have to call 'lv_tick_inc()' in periodically to inform LittelvGL about
|
||||||
* how much time were elapsed Create an SDL thread to do this*/
|
* how much time were elapsed Create an SDL thread to do this*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user