Closed TheZoq2 closed 5 years ago
I too would like to see this merged. :+1:
There has been some discussion about this in the HAL crate https://github.com/japaric/embedded-hal/issues/85. Some people are advocating different methods for resetting error flags. I would say that this is still the best method, at least until the HAL has a specified way of doing things
I also ran into this issue today, and would love to see it get merged!
Unless you find any other problems after my fix, this should be mergeable, right? @TeXitoi
@TheZoq2 sorry, I forgot this PR.
Thanks for merging, @therealprof - tested these changes out and they work perfectly!
Thanks for merging, @therealprof - tested these changes out and they work perfectly!
If any error occurs during serial read, a flag is set in the USARTx_SR register. However, this flag is not currently reset after being read which means that any errors are permanent.
The flags are reset by a read from the
sr
register followed by a read fromdr
which is what this PR does.This seems to work in my limted testing, but I am not sure why the
sr.<bit>().bit_is_set()
doesn't count as a read for this purpose.