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

Possible to read config at startup and detect busy pins #150

Closed
andrewdavidmackenzie opened this issue Jun 25, 2024 · 2 comments
Closed

Comments

@andrewdavidmackenzie
Copy link

andrewdavidmackenzie commented Jun 25, 2024

A question, more than an issue....

In pigg I have this issue to work on:

andrewdavidmackenzie/pigg#39

Is it possible that pins are in use (via rppal as it happens) by another app of mine, and I can detect that at start-up and mark those pins as "unavailable", but I can continue to use other free pins?

So, two separate binaries, one using some GPIO pins, the other using different GPIO pins?

@golemparts
Copy link
Owner

Is it possible that pins are in use (via rppal as it happens) by another app of mine, and I can detect that at start-up and mark those pins as "unavailable", but I can continue to use other free pins?

It's not currently possible, but it's something to consider to add support for.

The GPIO (v1/v2) API does register the consumer of a specific pin, but we're only using it for interrupts at the moment. Everything else is done through direct register access because of GPIO API limitations (see my comment here for details). Additionally, any other (non-RPPAL) application that accesses the GPIO pins in some other way wouldn't show up in the GPIO API as the consumer, so it still wouldn't catch all cases of a pin in-use by another application.

I do think it's worth re-evaluating the GPIO API once we've moved to v2, and move more systems from using direct register access to going through the API instead, where it makes sense.

The main roadblock that previously prevented me from moving everything to using the GPIO API was the lack of support for reading which alt function mode a pin is set to, which is needed to show a GPIO pin status overview. Part of the reason why that was an issue at the time was because it initially looked like we'd lose access to direct GPIO register access entirely. Now that we have access to both I could combine their use, and use register access for functionality that isn't available through the API.

@andrewdavidmackenzie
Copy link
Author

andrewdavidmackenzie commented Jun 25, 2024

Noted. Thanks for the reply.

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

No branches or pull requests

2 participants