1/* 2 * Copyright (c) 2022, Basalte bv 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7#include <zephyr/dt-bindings/input/input-event-codes.h> 8#include <zephyr/dt-bindings/lvgl/lvgl.h> 9 10/ { 11 aliases { 12 sw0 = &button0; 13 }; 14 15 qdec { 16 compatible = "gpio-qdec"; 17 gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>, <&gpio0 5 GPIO_ACTIVE_HIGH>; 18 steps-per-period = <4>; 19 zephyr,axis = <INPUT_REL_WHEEL>; 20 sample-time-us = <2000>; 21 idle-timeout-ms = <200>; 22 }; 23 24 keys: keys { 25 compatible = "gpio-keys"; 26 button0: button0 { 27 /* gpio0 pin 0 is already aliased to led0 */ 28 gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; 29 zephyr,code = <INPUT_KEY_R>; 30 }; 31 32 button1: button1 { 33 gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; 34 zephyr,code = <INPUT_KEY_B>; 35 }; 36 37 encoder_button: encoder_button { 38 gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>; 39 zephyr,code = <INPUT_KEY_0>; 40 }; 41 42 button_left: button_left { 43 gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; 44 zephyr,code = <INPUT_KEY_LEFT>; 45 }; 46 47 button_right: button_right { 48 gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; 49 zephyr,code = <INPUT_KEY_RIGHT>; 50 }; 51 52 button_enter: button_enter { 53 gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; 54 zephyr,code = <INPUT_KEY_ENTER>; 55 }; 56 }; 57 58 lvgl_button_input { 59 compatible = "zephyr,lvgl-button-input"; 60 input = <&keys>; 61 input-codes = <INPUT_KEY_B>; 62 coordinates = <160 120>; 63 }; 64 65 lvgl_encoder_input { 66 compatible = "zephyr,lvgl-encoder-input"; 67 rotation-input-code = <INPUT_REL_WHEEL>; 68 button-input-code = <INPUT_KEY_0>; 69 }; 70 71 lvgl_keypad_input { 72 compatible = "zephyr,lvgl-keypad-input"; 73 input = <&keys>; 74 input-codes = <INPUT_KEY_LEFT INPUT_KEY_RIGHT INPUT_KEY_ENTER>; 75 lvgl-codes = <LV_KEY_LEFT LV_KEY_RIGHT LV_KEY_ENTER>; 76 }; 77}; 78 79&gpio0 { 80 ngpios = <9>; 81 82 sdl_gpio { 83 status = "okay"; 84 compatible = "zephyr,gpio-emul-sdl"; 85 /* Skip pin 0 with the unknown code 0 */ 86 scancodes = <0 21 5 30 31 32 80 79 40>; 87 }; 88}; 89