Skip to content

Add wait_for_value helper function #263

Description

@fhunleth

This helper function would block until an already open GPIO or set of GPIOs has the specified value.

The motivation for this is that this comes up periodically in synchronous code that needs to wait for a pin that signifies device busy. Asynchronous code has no problems with this use case since it can just subscribe to the GPIO and react to value change notifications. With synchronous code, the easiest thing to do is to poll the pin every millisecond or so. Polling isn't ideal for long waits and converting this code to subscribe to change notifications turns out to be easy to get subtly wrong.

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