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 blinky_rtcalarm_irq example #217

Merged
merged 3 commits into from
Aug 12, 2020
Merged

Add blinky_rtcalarm_irq example #217

merged 3 commits into from
Aug 12, 2020

Conversation

khrs
Copy link
Contributor

@khrs khrs commented May 17, 2020

It is not obvious how to use RTCALARM interrupt. It took me a near an hour to find it in reference manual.

Copy link
Member

@TheZoq2 TheZoq2 left a 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 Show resolved Hide resolved
examples/blinky_rtcalarm_irq.rs Outdated Show resolved Hide resolved
examples/blinky_rtcalarm_irq.rs Outdated Show resolved Hide resolved
examples/blinky_rtcalarm_irq.rs Outdated Show resolved Hide resolved
examples/blinky_rtcalarm_irq.rs Outdated Show resolved Hide resolved
#[entry]
fn main() -> ! {
if let (Some(dp), Some(cp)) = (Peripherals::take(), c_m_Peripherals::take()) {
cortex_m::interrupt::free(move |cs| {
Copy link
Member

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?

Comment on lines 81 to 83
let exti = dp.EXTI;
exti.ftsr.write(|w| w.tr17().set_bit());
exti.imr.write(|w| w.mr17().set_bit());
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is why i spend near hour ;)

rm0008-p489

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RM008 page 489

Copy link
Member

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 🤔

@TheZoq2
Copy link
Member

TheZoq2 commented May 24, 2020

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

@TheZoq2 TheZoq2 merged commit 25e734f into stm32-rs:master Aug 12, 2020
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.

None yet

2 participants