按键按下用万用表测出电平变化, 但是查看对应GPIO的value文件却没有变化
-
/sys/class/gpio # echo 37 > export /sys/class/gpio # cd gpio37 /sys/devices/platform/soc@3000000/2000000.pinctrl/gpiochip0/gpio/gpio37 # cat direction in /sys/devices/platform/soc@3000000/2000000.pinctrl/gpiochip0/gpio/gpio37 # cat active_low 0 /sys/devices/platform/soc@3000000/2000000.pinctrl/gpiochip0/gpio/gpio37 # cat value 0 /sys/devices/platform/soc@3000000/2000000.pinctrl/gpiochip0/gpio/gpio37 # cat value 0 /sys/devices/platform/soc@3000000/2000000.pinctrl/gpiochip0/gpio/gpio37 # cat value 0 /sys/devices/platform/soc@3000000/2000000.pinctrl/gpiochip0/gpio/gpio37 #
按键对应的GPIO 是 PB5
请问需要怎么用程序检测按键状态变化呢?
-
按键可以用Linux内置的驱动gpio-keys,提供轮训中断等多种查询方式,而且直接对接了linux的event系统开发也很简单
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号