Skip to content

Support invalidating references to a GPIO to allow it to be opened again #209

Open
@fhunleth

Description

@fhunleth

The problem is that if a GPIO reference gets lost in some process's state, it's no longer possible to open that GPIO. This happens when using GPIOs at the IEx prompt, since return values are saved in the session history. It can also happen in code that returns GPIO references rather than wrapping them in GenServers so there's only one owning process.

Currently it's hard to debug lost GPIO references other than to reboot. It would be a lot nicer to be able to invalidate old references and try again.

If you run this, try the following for now:

  1. For non-performance critical code, use Circuits.GPIO.write_one/3 and Circuits.GPIO.read_one/2 instead. This totally avoids references.
  2. Create a GenServer that holds the GPIO reference in its state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions