Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import select, os
- PATH = '/sys/class/gpio/gpio47/{0}'
- os.system('echo 27 > /sys/kernel/debug/omap_mux/gpmc_ad15')
- os.system('echo in > {0}'.format(PATH.format('direction')))
- os.system('echo rising > {0}'.format(PATH.format('edge')))
- fd = os.open(PATH.format('value'), os.O_RDONLY | os.O_NONBLOCK)
- READ_ONLY = select.POLLPRI
- poller = select.poll()
- poller.register(fd, READ_ONLY)
- count = 0
- while True:
- events = poller.poll(-1)
- os.lseek(fd, 0, 0)
- if os.read(fd, 2) == '1\n':
- count += 1
- print count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement