-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for reading IIO events in the Python bindings. This is done by calling iio.Device.event_stream() using a context manager, which will create an EventStream object, and then use the read() method: dev = ctx.devices["iio:device4"] with dev.event_stream() as evstream: ev = evstream.read() if ev is not None: print("Got event!") else: time.sleep(0.1) The read() method takes a 'nonblock' argument, which defaults to True. Python code can then poll for events regularly. Polling is better, because doing a blocking read does not give any guarantee about when the call will return. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
- Loading branch information
Showing
1 changed file
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters