NXP MCU 技术论坛
直播中

杨平

8年用户 1753经验值
私信 关注
[问答]

如何在基于imx8mm的板上添加一个键盘?

试图在我的基于 imx8mm 的板上添加一个键盘。
我将其添加到我的设备树中:
[...]
    gpio-keys {
                compatible = "gpio-keys";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_gpio_keys>;

                col0_btn {
                        label = "COL0_BTN";
                        gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
                        gpio-key,wakeup;
                        linux,code = ;
                };
        };

[...]

&iomuxc {
                pinctrl_gpio_keys: keys0grp {
                        fsl,pins = <
                                MX8MM_IOMUXC_GPIO1_IO05_GPIO1_IO5                0x1d6 /* KEY_C0 */               
                        >;
                };
[...]
在 Linux 中使用“gpioinfo”命令进行检查:
root@asdf:~# gpioinfo 0
gpiochip0 - 32 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed  "interrupt"   input  active-high [used]
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed   "COL0_BTN"   input   active-low [used]
看起来不错。

检查 evtest /dev/input/event0
root@asdf:/# evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio-keys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 256 (BTN_0)
Properties:
Testing ... (interrupt to exit)
但是,从未注册过按钮的按下。我想知道之间是否以某种方式映射
gpios = <&gpio1 5 GPIO_ACTIVE_LOW> 和 MX8MM_IOMUXC_GPIO1_IO05_GPIO1_IO5 不正确,是不是看起来很明显?

               

更多回帖

发帖
×
20
完善资料,
赚取积分