Jeff Epler 76f03a2bee
Make keypad select/poll'able for better async
This allows a small wrapper class to be written
```py
class AsyncEventQueue:
    def __init__(self, events):
        self._events = events

    async def __await__(self):
        yield asyncio.core._io_queue.queue_read(self._events)
        return self._events.get()

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_value, traceback):
        pass

```
and used to just "await" the next event:
```py
async def key_task():
    print("waiting for keypresses")
    with keypad.KeyMatrix([board.D4], [board.D5]) as keys, AsyncEventQueue(keys.events) as ev:
        while True:
            print(await ev)
```

Because checking the empty status of the EventQueue does not enter
CircuitPython bytecode, it's assumed (but not measured) that this is
more efficient than an equivalent loop with an `await async.sleep(0)`
yield and introduces less latency than any non-zero sleep value.
2022-08-09 21:48:27 -05:00
..
2022-07-11 11:04:06 -05:00
2022-04-05 14:50:30 -05:00
2021-09-16 21:08:05 -05:00
2022-04-15 21:51:40 +02:00
2022-04-05 14:50:30 -05:00
2022-04-05 14:50:30 -05:00
2022-04-05 14:50:30 -05:00