mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	Me and my big mouth. No sooner do I declare the base classes "relatively stable" than I go and mess around with it all again. Anyway, this is the long promised set of utilities to make source/values more interesting. It includes a few interesting little utility functions, a whole bunch of examples and introduces the notion of "pseudo" devices with no (obvious) hardware representation like a time-of-day device. This necessitated making the event system a little more generic (it's not exclusive the GPIO devices after all; no reason we can't use it on composite devices in future) and by this point the mixins have gotten large enough to justify their own module. The pseudo-devices are a bit spartan and basic at the moment but I'm sure there'll be plenty of future ideas...
		
			
				
	
	
		
			130 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			130 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| from __future__ import (
 | |
|     unicode_literals,
 | |
|     print_function,
 | |
|     absolute_import,
 | |
|     division,
 | |
| )
 | |
| 
 | |
| from .pins import (
 | |
|     Pin,
 | |
| )
 | |
| from .exc import (
 | |
|     GPIOZeroError,
 | |
|     DeviceClosed,
 | |
|     BadEventHandler,
 | |
|     CompositeDeviceError,
 | |
|     CompositeDeviceBadName,
 | |
|     SPIError,
 | |
|     SPIBadArgs,
 | |
|     EnergenieSocketMissing,
 | |
|     EnergenieBadSocket,
 | |
|     GPIODeviceError,
 | |
|     GPIODeviceClosed,
 | |
|     GPIOPinInUse,
 | |
|     GPIOPinMissing,
 | |
|     GPIOBadQueueLen,
 | |
|     GPIOBadSampleWait,
 | |
|     InputDeviceError,
 | |
|     OutputDeviceError,
 | |
|     OutputDeviceBadValue,
 | |
|     PinError,
 | |
|     PinInvalidFunction,
 | |
|     PinInvalidState,
 | |
|     PinInvalidPull,
 | |
|     PinInvalidEdges,
 | |
|     PinSetInput,
 | |
|     PinFixedPull,
 | |
|     PinEdgeDetectUnsupported,
 | |
|     PinPWMError,
 | |
|     PinPWMUnsupported,
 | |
|     PinPWMFixedValue,
 | |
|     GPIOZeroWarning,
 | |
|     SPIWarning,
 | |
|     SPISoftwareFallback,
 | |
| )
 | |
| from .devices import (
 | |
|     Device,
 | |
|     GPIODevice,
 | |
|     CompositeDevice,
 | |
| )
 | |
| from .mixins import (
 | |
|     SharedMixin,
 | |
|     SourceMixin,
 | |
|     ValuesMixin,
 | |
|     EventsMixin,
 | |
| )
 | |
| from .input_devices import (
 | |
|     InputDevice,
 | |
|     DigitalInputDevice,
 | |
|     SmoothedInputDevice,
 | |
|     Button,
 | |
|     LineSensor,
 | |
|     MotionSensor,
 | |
|     LightSensor,
 | |
|     DistanceSensor,
 | |
| )
 | |
| from .spi_devices import (
 | |
|     SPIDevice,
 | |
|     AnalogInputDevice,
 | |
|     MCP3001,
 | |
|     MCP3002,
 | |
|     MCP3004,
 | |
|     MCP3008,
 | |
|     MCP3201,
 | |
|     MCP3202,
 | |
|     MCP3204,
 | |
|     MCP3208,
 | |
|     MCP3301,
 | |
|     MCP3302,
 | |
|     MCP3304,
 | |
| )
 | |
| from .output_devices import (
 | |
|     OutputDevice,
 | |
|     DigitalOutputDevice,
 | |
|     PWMOutputDevice,
 | |
|     PWMLED,
 | |
|     LED,
 | |
|     Buzzer,
 | |
|     Motor,
 | |
|     RGBLED,
 | |
| )
 | |
| from .boards import (
 | |
|     CompositeOutputDevice,
 | |
|     LEDCollection,
 | |
|     LEDBoard,
 | |
|     LEDBarGraph,
 | |
|     PiLiter,
 | |
|     PiLiterBarGraph,
 | |
|     TrafficLights,
 | |
|     PiTraffic,
 | |
|     SnowPi,
 | |
|     TrafficLightsBuzzer,
 | |
|     FishDish,
 | |
|     TrafficHat,
 | |
|     Robot,
 | |
|     RyanteckRobot,
 | |
|     CamJamKitRobot,
 | |
|     Energenie,
 | |
| )
 | |
| from .other_devices import (
 | |
|     InternalDevice,
 | |
|     PingServer,
 | |
|     TimeOfDay,
 | |
| )
 | |
| from .source_tools import (
 | |
|     averaged,
 | |
|     clamped,
 | |
|     conjunction,
 | |
|     cos_values,
 | |
|     disjunction,
 | |
|     inverted,
 | |
|     negated,
 | |
|     post_delayed,
 | |
|     pre_delayed,
 | |
|     quantized,
 | |
|     queued,
 | |
|     random_values,
 | |
|     scaled,
 | |
|     sin_values,
 | |
| )
 |