Skip to content
Discussion options

You must be logged in to vote

You need to use StreamReader to use the UART asynchronously. Then you can await uart.read(). See @peterhinch's excellent docs here: https://github.com/peterhinch/micropython-async/blob/master/v3/docs/TUTORIAL.md#63-using-the-stream-mechanism

Unfortunately StreamReader doesn't quite work with CAN. It does support the relevant ioctl for asyncio to poll it, but does not support read. What you could probably do is adapt StreamReader (see https://github.com/micropython/micropython/blob/master/extmod/uasyncio/stream.py ) to make a CANStreamReader. Basically it just needs a new read method that calls recv instead.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@IlysvlVEizbr
Comment options

Answer selected by IlysvlVEizbr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants