嵌入式爱好者

6254使用按键gpio

2024-6-29 15:20| 发布者: 87岁拄拐上分| 查看: 40| 评论: 0

类目: AM6254系列产品  >  linux     文档编号: 1445

1.引脚配置
mcu_gpio_key_pin_default: mcu-gpio-key-pin-default {
pinctrl-single,pins = <
AM62X_MCU_IOPAD(0x040, PIN_INPUT, 7) /* (D4) MCU_GPIO0_16 */
>;
};
2.节点配置
gpio-keys1 {
        compatible = "gpio-keys";
        autorepeat;
pinctrl-names = "default";
pinctrl-0 = <&mcu_gpio_key_pin_default>;
key-mcu16 {
interrupt-parent = <&mcu_gpio0>;
label = "GPIO Key UP";
linux,code = <30>;
gpios = <&mcu_gpio0 16 GPIO_ACTIVE_LOW>;
interrupts = <16 IRQ_TYPE_EDGE_RISING>;
            };
    };
3.编译内核替换设备树
4.查看是否生成节点
root@OK62xx:/# cat sys/kernel/debug/gpio
gpiochip0: GPIOs 0-23, parent: platform/4201000.gpio, 4201000.gpio:
 gpio-16  (                    |GPIO Key UP         ) in  hi ACTIVE LOW
5evtest测试
root@OK62xx:/# evtest /dev/input/by-path/platform-gpio-keys1-event
//按下是1,松开是0,长按是2

Event: time 1719645537.990880, type 1 (EV_KEY), code 30 (KEY_A), value 1
Event: time 1719645537.990880, -------------- SYN_REPORT ------------
Event: time 1719645538.172304, type 1 (EV_KEY), code 30 (KEY_A), value 0
Event: time 1719645538.172304, -------------- SYN_REPORT ------------
Event: time 1719645558.377843, type 1 (EV_KEY), code 30 (KEY_A), value 1
Event: time 1719645558.377843, -------------- SYN_REPORT ------------
Event: time 1719645558.649860, type 1 (EV_KEY), code 30 (KEY_A), value 2
Event: time 1719645558.649860, -------------- SYN_REPORT ------------
Event: time 1719645558.689855, type 1 (EV_KEY), code 30 (KEY_A), value 2
Event: time 1719645558.689855, -------------- SYN_REPORT ------------
Event: time 1719645558.729848, type 1 (EV_KEY), code 30 (KEY_A), value 2

已解决

未解决

只是看看
上一篇:ntp服务下一篇:6254去除屏上打印信息

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-9-19 09:13

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

返回顶部