- # horrible abuse of bash to poll the Quantron imx keypad for key presses
- a=0
- b=0
- c=0
- while true ; do
- (( i=$(printf "2#"; printf "%d" $(cat /sys/class/gpio/gpio{61..68}/value) ) ))
- case $i in
- 240) # no key pressed
- ;;
- 176) # "C/100%" key
- (( a++, b=0, c=0 ))
- ;;
- 224) # "enter" key
- (( a=0, b++, c=0 ))
- ;;
- 208) # "ESC" key
- (( a=0, b=0, c++ ))
- ;;
- *)
- (( a=0, b=0, c=0 ))
- ;;
- esac
- if (( (a+b+c) > 4 )) ; then
- printf "a=%d, b=%d, c=%d\n" $a $b $c
- exit 0
- fi
- msleep 10
- done
Quantron Linux gpio key poller, try 0.0.1
Posted by Anonymous on Thu 2nd Jan 2020 14:07
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.