Skip to content

Commit 6a0de9b

Browse files
faxe1008carlescufi
authored andcommitted
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 <[email protected]>
1 parent b296d11 commit 6a0de9b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

samples/subsys/display/lvgl/boards/native_posix.overlay

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,41 @@
1111
sw0 = &button0;
1212
};
1313

14-
keys {
14+
keys: keys {
1515
compatible = "gpio-keys";
1616
button0: button0 {
1717
/* gpio0 pin 0 is already aliased to led0 */
1818
gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
1919
zephyr,code = <INPUT_KEY_0>;
2020
};
21+
22+
button1: button1 {
23+
gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
24+
zephyr,code = <INPUT_KEY_1>;
25+
};
2126
};
2227

2328
lvgl_pointer_input {
2429
status = "okay";
2530
compatible = "zephyr,lvgl-pointer-input";
2631
input = <&input_sdl_touch>;
2732
};
33+
34+
lvgl_button_input {
35+
compatible = "zephyr,lvgl-button-input";
36+
input = <&keys>;
37+
input-codes = <INPUT_KEY_1>;
38+
coordinates = <160 120>;
39+
};
2840
};
2941

3042
&gpio0 {
31-
ngpios = <2>;
43+
ngpios = <3>;
3244

3345
sdl_gpio {
3446
status = "okay";
3547
compatible = "zephyr,gpio-emul-sdl";
3648
/* Skip pin 0 with the unknown code 0 */
37-
scancodes = <0 21>;
49+
scancodes = <0 21 5>;
3850
};
3951
};

0 commit comments

Comments
 (0)