mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
This commit is a fairly major piece of work that abstracts all pin operations (function, state, edge detection, PWM, etc.) into a base "Pin" class which is then used by input/output/composite devices to perform all required configuration. The idea is to pave the way for I2C based IO extenders which can present additional GPIO ports with similar capabilities to the Pi's "native" GPIO ports. As a bonus it also abstracts away the reliance on the RPi.GPIO library to allow alternative pin implementations (e.g. using RPIO to take advantage of DMA based PWM), or even pure Python implementations.
80 lines
1.3 KiB
Python
80 lines
1.3 KiB
Python
from __future__ import (
|
|
unicode_literals,
|
|
print_function,
|
|
absolute_import,
|
|
division,
|
|
)
|
|
|
|
from .pins.exc import (
|
|
PinError,
|
|
PinFixedFunction,
|
|
PinInvalidFunction,
|
|
PinInvalidState,
|
|
PinInvalidPull,
|
|
PinInvalidEdges,
|
|
PinSetInput,
|
|
PinFixedPull,
|
|
PinEdgeDetectUnsupported,
|
|
PinPWMError,
|
|
PinPWMUnsupported,
|
|
PinPWMFixedValue,
|
|
)
|
|
from .pins import (
|
|
Pin,
|
|
)
|
|
from .exc import (
|
|
GPIODeviceClosed,
|
|
GPIODeviceError,
|
|
InputDeviceError,
|
|
OutputDeviceError,
|
|
)
|
|
from .devices import (
|
|
GPIODevice,
|
|
CompositeDevice,
|
|
SourceMixin,
|
|
ValuesMixin,
|
|
)
|
|
from .input_devices import (
|
|
InputDevice,
|
|
WaitableInputDevice,
|
|
DigitalInputDevice,
|
|
SmoothedInputDevice,
|
|
AnalogInputDevice,
|
|
Button,
|
|
LineSensor,
|
|
MotionSensor,
|
|
LightSensor,
|
|
AnalogInputDevice,
|
|
MCP3008,
|
|
MCP3004,
|
|
MCP3208,
|
|
MCP3204,
|
|
MCP3301,
|
|
MCP3302,
|
|
MCP3304,
|
|
)
|
|
from .output_devices import (
|
|
OutputDevice,
|
|
DigitalOutputDevice,
|
|
PWMOutputDevice,
|
|
PWMLED,
|
|
LED,
|
|
Buzzer,
|
|
Motor,
|
|
RGBLED,
|
|
)
|
|
from .boards import (
|
|
LEDBoard,
|
|
LEDBarGraph,
|
|
PiLiter,
|
|
PiLiterBarGraph,
|
|
TrafficLights,
|
|
PiTraffic,
|
|
TrafficLightsBuzzer,
|
|
FishDish,
|
|
TrafficHat,
|
|
Robot,
|
|
RyanteckRobot,
|
|
CamJamKitRobot,
|
|
)
|