import numpy as np #import TCPSOCK as tcps from TCPSOCK import Interruptor from threading import Thread # Initialise class # tcps = Interruptor() #functions needed ############################################## def wait_for_interrupts(classinit,threaded=False, epoll_timeout=1): """ Blocking loop to listen for GPIO interrupts and distribute them to associated callbacks. epoll_timeout is an easy way to shutdown the blocking function. Per default the timeout is set to 1 second; if `_is_waiting_for_interrupts` is set to False the loop will exit. If an exception occurs while waiting for interrupts, the interrupt gpio interfaces will be cleaned up (/sys/class/gpio unexports). In this case all interrupts will be reset and you'd need to add the callbacks again before using `wait_for_interrupts(..)` again. If the argument `threaded` is True, wait_for_interrupts will be started in a daemon Thread. To quit it, call `RPIO.stop_waiting_for_interrupts()`. """ if threaded: t = Thread(target=classinit.wait_for_interrupts, args=(epoll_timeout,)) t.daemon = True t.start() else: classinit.wait_for_interrupts(epoll_timeout) def cleanup(classinit):
import os import time ####### camera parameters ##################################### os.system('v4l2-ctl -d 0 -c focus_auto=0') os.system('v4l2-ctl -d 0 -c focus_absolute=0') os.system('v4l2-ctl -d 0 -c zoom_absolute=100') os.system('v4l2-ctl -d 0 -c exposure_auto=3') #os.system('v4l2-ctl -d 0 -c exposure_absolute=120') os.system('v4l2-ctl -d 0 -c contrast=128') os.system('v4l2-ctl -d 0 -c brightness=128') os.system('v4l2-ctl -d 0 -c white_balance_temperature_auto=1') #os.system('v4l2-ctl -d 0 -c white_balance_temperature=6500') # Initialise class # tcps1 = Interruptor() #tcps2 = Interruptor() #functions needed ############################################## def wait_for_interrupts(classinit,threaded=False, epoll_timeout=1): """ Blocking loop to listen for GPIO interrupts and distribute them to associated callbacks. epoll_timeout is an easy way to shutdown the blocking function. Per default the timeout is set to 1 second; if `_is_waiting_for_interrupts` is set to False the loop will exit. If an exception occurs while waiting for interrupts, the interrupt gpio interfaces will be cleaned up (/sys/class/gpio unexports). In this case all interrupts will be reset and you'd need to add the callbacks again before using `wait_for_interrupts(..)` again. If the argument `threaded` is True, wait_for_interrupts will be started in a daemon Thread. To quit it, call
import numpy as np #import TCPSOCK as tcps from TCPSOCK import Interruptor from threading import Thread # Initialise class # tcps = Interruptor() tcps2 = Interruptor() #functions needed ############################################## def wait_for_interrupts(classinit,threaded=False, epoll_timeout=1): """ Blocking loop to listen for GPIO interrupts and distribute them to associated callbacks. epoll_timeout is an easy way to shutdown the blocking function. Per default the timeout is set to 1 second; if `_is_waiting_for_interrupts` is set to False the loop will exit. If an exception occurs while waiting for interrupts, the interrupt gpio interfaces will be cleaned up (/sys/class/gpio unexports). In this case all interrupts will be reset and you'd need to add the callbacks again before using `wait_for_interrupts(..)` again. If the argument `threaded` is True, wait_for_interrupts will be started in a daemon Thread. To quit it, call `RPIO.stop_waiting_for_interrupts()`. """ if threaded: t = Thread(target=classinit.wait_for_interrupts, args=(epoll_timeout,)) t.daemon = True t.start() else: classinit.wait_for_interrupts(epoll_timeout)