Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Study of a possible implementation of gpiozero to support RPI5 #269

Closed
wants to merge 0 commits into from

Conversation

outdoorbits
Copy link

@outdoorbits outdoorbits commented Jan 4, 2024

This is just a study of a possible implementation of gpiozero to support the Raspberry Pi 5 in the future. Up to now I didn't step deep enough into your code to really understand it. So I couldn't test it yet. But I think this could be an easy way to migrate from RPi.GPIO to gpiozero. The advantage would be to have one library (gpiozero) which is compatible to both, Raspberry Pi 4 (and older) and Raspberry Pi 5 (and hopefully others in future).

refs #268

@thijstriemstra
Copy link
Collaborator

thanks! I saw another project (moonraker) that switched to https://pypi.org/project/python-periphery, maybe an option as well..

@thijstriemstra thijstriemstra changed the title Study of a possible implementation of gpiozero to support the Raspber… Study of a possible implementation of gpiozero to support RPI5 Jan 4, 2024
@outdoorbits
Copy link
Author

But the last commit of python-periphery is much older than the RPi 5, so it won't be able to support its new hardware.

@thijstriemstra
Copy link
Collaborator

But the last commit of python-periphery is much older than the RPi 5, so it won't be able to support its new hardware.

Not sure, as long as it supports the linux kernel gpio interface (around for years), it should be fine since that is what the rpi5 uses afaik.

@outdoorbits
Copy link
Author

outdoorbits commented Jan 5, 2024

I don't think python-periphery works. I tested inputs:

from gpiozero import Button
from signal import pause

def pressed():
        print('+')

def released():
        print('-')


button = Button(26,pull_up=False)

button.when_pressed = pressed
button.when_released = released

pause()

works fine while

from periphery import GPIO
import time

# Open GPIO /dev/gpiochip0 line 10 with input direction
gpio_in = GPIO("/dev/gpiochip0", 26, "in")
# Open GPIO /dev/gpiochip0 line 12 with output direction
gpio_out = GPIO("/dev/gpiochip0", 12, "out")

while True:
        print(gpio_in.read())
        time.sleep(1)

gpio_out.write(not value)

gpio_in.close()
gpio_out.close()

didn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants