]> git.parisson.com Git - piplayer.git/commitdiff
working well with DOWN method
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 23 Jul 2013 01:17:30 +0000 (03:17 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 23 Jul 2013 01:17:30 +0000 (03:17 +0200)
piplayer.py

index 6687fe60f1b46edf60f58314589111266f2ce09b..b55db7a8c87aa12d3ea1d8f8820ad22481aad7fd 100644 (file)
@@ -55,18 +55,18 @@ class GPIOController(Thread):
 
     def __init__(self, channel):
         Thread.__init__(self)
-        self.gpio_channel = channel
-    
-    def add_callback(self, callback):
         import RPi.GPIO as GPIO
+        self.server = GPIO
+        self.gpio_channel = channel
         GPIO.setmode(GPIO.BCM)
-        GPIO.setup(self.gpio_channel, GPIO.IN, pull_up_down=GPIO.PUD_UP)
-        GPIO.add_event_detect(self.gpio_channel, GPIO.PUD_UP, callback=callback)
+        GPIO.setup(self.gpio_channel, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
+        
+    def add_callback(self, callback):
+        GPIO.add_event_detect(self.gpio_channel, GPIO.PUD_DOWN, callback=callback, bouncetime=100)
         
     def run(self):
-        while True:
-            time.sleep(0.1)
-    
+        pass
+            
             
 class AudioPlayer(object):