Beispiel #1
0
 def Add_Event_Spi(self, channel, function, value, callback, endvalue):
     if not self.SpiEvent.__contains__(channel):
         queue = gpioqueue.queue(callback)
         self.SpiEvent[channel] = [
             Thread(
                 target=self._threadSpi,
                 args=(channel, function, queue, value, endvalue),
                 name="Thread channel {0}".format(channel),
             ),
             callback,
             [False, 0],
         ]
         self.SpiEvent[channel][0].start()
         return True
     else:
         return False
Beispiel #2
0
 def Add_Event(self, pin, mode, callback):
     # Add a event on a mode like falling to add a event 1 -> 0 and rising form 0 -> 1 or both on a pin
     if not self.PinEvent.__contains__(pin):
         queue = gpioqueue.queue(callback)
         self.PinEvent[pin] = [Thread(target=self._threadEvent, args=(pin, mode)), True, queue, mode]
         self.PinEvent[pin][0].start()