mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Refactor low level implementation
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.
This commit is contained in:
@@ -281,7 +281,7 @@ Each button plays a different sound!
|
||||
|
||||
buttons = [Button(pin) for pin in sound_pins]
|
||||
for button in buttons:
|
||||
sound = sound_pins[button.pin]
|
||||
sound = sound_pins[button.pin.number]
|
||||
button.when_pressed = sound.play
|
||||
|
||||
pause()
|
||||
|
||||
Reference in New Issue
Block a user