-
Notifications
You must be signed in to change notification settings - Fork 67
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 read and write impl for Serial, Irq flags functions and RTIC example #232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS: This is my first pull request ever :)
Whoooho. Pretty exciting stuff. I'm happy to be the reviewer of your first PR 🎉
This PR looks pretty good. One minor nit, and you also have to make rustfmt happy via cargo fmt --all
and clippy
has also some minor thing to say: https://github.com/stm32-rs/stm32f3xx-hal/runs/2765167229
Thanks for your PR. I'm pretty excited about this as well, as this comes with the first RTIC example for this project! 😄
examples/serial_echo_rtic.rs
Outdated
type SerialType = Serial<stm32f3xx_hal::pac::USART1, (gpio::Pin<gpio::Gpioa, U<9_u8>, Alternate<PushPull, 7_u8>>, gpio::Pin<gpio::Gpioa, U<10_u8>, Alternate<PushPull, 7_u8>>)>; | ||
type DirType = stm32f3xx_hal::gpio::Pin<gpio::Gpioe, U<13_u8>, Output<PushPull>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though these are the correct types hinted by the compiler, there exists type aliases, which are easier to read. I'd recommend them:
type SerialType = Serial<stm32f3xx_hal::pac::USART1, (gpio::Pin<gpio::Gpioa, U<9_u8>, Alternate<PushPull, 7_u8>>, gpio::Pin<gpio::Gpioa, U<10_u8>, Alternate<PushPull, 7_u8>>)>; | |
type DirType = stm32f3xx_hal::gpio::Pin<gpio::Gpioe, U<13_u8>, Output<PushPull>>; | |
type SerialType = Serial<stm32f3xx_hal::pac::USART1, (gpio::gpioa::PA9<A7<PushPull>>, gpio::gpioa::PA10<A7<PushPull>>)>; | |
type DirType = stm32f3xx_hal::gpio::gpioe::PE13<Output<PushPull>>; |
Hi, Actually I don't understand why clippy make me to change |
This is pretty strange indeed. A wild guess: Maybe it has something to do with the rtic Thank you really much for your contribution. Nice PR! 👍 |
Hi,
This pull request adds Read and Write implementations to Serial and few functions to work with Irq flags.
This needed to add more control under communicaiton flow and timing.
Also I added an example how to use this with RTIC. The example uses DIR pin when transmiting (like RS485).
PS: This is my first pull request ever :)