Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods to check idle, tx empty and rx not empty for serial #206

Merged
merged 1 commit into from
Dec 10, 2021

Conversation

azerupi
Copy link
Contributor

@azerupi azerupi commented Dec 9, 2021

There is currently already a method pending_event that allows to get events when the interrupts are enabled. But the idle flag and the txe and rxne flags can also be used when interrupts are disabled (idleie=0, txeie=0 and rxneie=0 respectively).

This PR adds methods on Rx and Tx to read the state of those flags and reset the idle flag. This is inspired by https://github.com/stm32-rs/stm32f1xx-hal/blob/master/src/serial.rs#L303-L324

These methods are also more intuitive IMHO than the pending_event method.

We tested is_idle and clear_idle_interrupt and confirmed that it worked.
What do you guys think?

@azerupi azerupi requested a review from a team as a code owner December 9, 2021 15:55
Copy link
Contributor

@hannobraun hannobraun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @azerupi, looks good to me!

@hannobraun hannobraun merged commit c04c434 into stm32-rs:master Dec 10, 2021
@hannobraun hannobraun mentioned this pull request Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants