make UART.write be blocking on SAMD; add timeout property #2331
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
UART
fixes and changes:UART.write()
was inadvertently non-blocking, due to my misunderstanding the (poorly documented) ASF4 API. Fixes busio.UART write sometimes returns None #2263, I believe.timeout
apply only to read. Note, for instance, that PySerial has separate read, write, and inter-character timeouts..timeout
property so that the timeout can be changed after construction.board.UART()
. It was 1000.0 seconds, should have been 1 second (leftover from msecs to msecs API change previously).Tested on atmel-samd, nrf, and stm32f4. Not tested on spresense because I don't have one yet.
I tried making
UART.write
interruptible by ctrl-C on atmel-samd, but it causes the ASF4 driver to get irreversibly confused about whether it's completed the write or not, and there's no easy API call to reset it. It's not possible to have ctrl-C interrupts on some other ports anyway, so never mind.@jepler if you want to review, feel free, but no obligation. Not sure how we should divvy up reviewing in the future.