samples: subsys: display: lvgl: add lvgl-button-input to native_posix

Adds a lvgl-button-input pseudo device to the lvgl sample. Triggering the
SDL gpio (pressing 'b') on the keyboard should trigger a click event at the
center of the screen.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
This commit is contained in:
Fabian Blatz 2023-08-21 14:05:20 +02:00 committed by Carles Cufí
commit 6a0de9bb7c

View file

@ -11,13 +11,18 @@
sw0 = &button0; sw0 = &button0;
}; };
keys { keys: keys {
compatible = "gpio-keys"; compatible = "gpio-keys";
button0: button0 { button0: button0 {
/* gpio0 pin 0 is already aliased to led0 */ /* gpio0 pin 0 is already aliased to led0 */
gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
zephyr,code = <INPUT_KEY_0>; zephyr,code = <INPUT_KEY_0>;
}; };
button1: button1 {
gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
zephyr,code = <INPUT_KEY_1>;
};
}; };
lvgl_pointer_input { lvgl_pointer_input {
@ -25,15 +30,22 @@
compatible = "zephyr,lvgl-pointer-input"; compatible = "zephyr,lvgl-pointer-input";
input = <&input_sdl_touch>; input = <&input_sdl_touch>;
}; };
lvgl_button_input {
compatible = "zephyr,lvgl-button-input";
input = <&keys>;
input-codes = <INPUT_KEY_1>;
coordinates = <160 120>;
};
}; };
&gpio0 { &gpio0 {
ngpios = <2>; ngpios = <3>;
sdl_gpio { sdl_gpio {
status = "okay"; status = "okay";
compatible = "zephyr,gpio-emul-sdl"; compatible = "zephyr,gpio-emul-sdl";
/* Skip pin 0 with the unknown code 0 */ /* Skip pin 0 with the unknown code 0 */
scancodes = <0 21>; scancodes = <0 21 5>;
}; };
}; };