-
Notifications
You must be signed in to change notification settings - Fork 172
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 blinky_rtcalarm_irq example #217
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.
Thanks for the PR, more docs and examples are always welcome!
I realise that I had quite a bunch of comments, I hope you don't mind. Most of them are nitpicky, and I also noticed that a lot of the things I commented on are also done in https://github.com/stm32-rs/stm32f1xx-hal/blob/master/examples/blinky_timer_irq.rs which we already merged 😉. Hope you don't mind :)
examples/blinky_rtcalarm_irq.rs
Outdated
#[entry] | ||
fn main() -> ! { | ||
if let (Some(dp), Some(cp)) = (Peripherals::take(), c_m_Peripherals::take()) { | ||
cortex_m::interrupt::free(move |cs| { |
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.
We don't really need the interrupt free until we start turning on interrupts, right?
examples/blinky_rtcalarm_irq.rs
Outdated
let exti = dp.EXTI; | ||
exti.ftsr.write(|w| w.tr17().set_bit()); | ||
exti.imr.write(|w| w.mr17().set_bit()); |
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.
I think, based on reading the mentioned section of the RM, that this isn't required since we are listening for the RTCALARM interrupt, rather than the exti interrupt
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.
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.
RM008 page 489
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.
Right, I read that yesterday but think I missinterpreted it. Perhaps we should add a convenience that does this at some point 🤔
Looks great now, thanks. Unfortunately, the build fails on the f101 which I presume is because the f101 doesn't have the RTC. I guess we have to add some config to not build the example if the 101 feature is selected |
It is not obvious how to use RTCALARM interrupt. It took me a near an hour to find it in reference manual.