mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	| @@ -31,6 +31,10 @@ class GPIODevice(object): | |||||||
|     def is_active(self): |     def is_active(self): | ||||||
|         return self._read() |         return self._read() | ||||||
|  |  | ||||||
|  |     def __repr__(self): | ||||||
|  |         return "<gpiozero.%s object on pin=%d, is_active=%s>" % ( | ||||||
|  |             self.__class__.__name__, self.pin, self.is_active) | ||||||
|  |  | ||||||
|  |  | ||||||
| _GPIO_THREADS = set() | _GPIO_THREADS = set() | ||||||
|  |  | ||||||
|   | |||||||
| @@ -36,6 +36,10 @@ class InputDevice(GPIODevice): | |||||||
|     def pull_up(self): |     def pull_up(self): | ||||||
|         return self._pull_up |         return self._pull_up | ||||||
|  |  | ||||||
|  |     def __repr__(self): | ||||||
|  |         return "<gpiozero.%s object on pin=%d, pull_up=%s, is_active=%s>" % ( | ||||||
|  |             self.__class__.__name__, self.pin, self.pull_up, self.is_active) | ||||||
|  |  | ||||||
|  |  | ||||||
| class WaitableInputDevice(InputDevice): | class WaitableInputDevice(InputDevice): | ||||||
|     def __init__(self, pin=None, pull_up=False): |     def __init__(self, pin=None, pull_up=False): | ||||||
| @@ -143,6 +147,13 @@ class SmoothedInputDevice(WaitableInputDevice): | |||||||
|         self._queue = GPIOQueue(self, queue_len, sample_wait, partial) |         self._queue = GPIOQueue(self, queue_len, sample_wait, partial) | ||||||
|         self.threshold = float(threshold) |         self.threshold = float(threshold) | ||||||
|  |  | ||||||
|  |     def __repr__(self): | ||||||
|  |         if self.partial or self._queue.full.wait(0): | ||||||
|  |             return super(SmoothedInputDevice, self).__repr__() | ||||||
|  |         else: | ||||||
|  |             return "<gpiozero.%s object on pin=%d, pull_up=%s>" % ( | ||||||
|  |                 self.__class__.__name__, self.pin, self.pull_up) | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def queue_len(self): |     def queue_len(self): | ||||||
|         return self._queue.queue.maxlen |         return self._queue.queue.maxlen | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user