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

Cannot acknowledge timer interrupt flag #156

Open
mcbridejc opened this issue Jun 8, 2022 · 0 comments
Open

Cannot acknowledge timer interrupt flag #156

mcbridejc opened this issue Jun 8, 2022 · 0 comments

Comments

@mcbridejc
Copy link

I'm attempting to use a periodic timer using the HAL Timer driver, on an stm32f031, and have hit a limitation.

I can instantiate it and use the driver to setup the desired overflow rate, and then turn on the interrrupt -- so that's easy enough:

let timer = hal::timers::Timer::<pac::TIM16>::tim16(cx.device.TIM16, 1.khz(), &mut rcc);
timer.listen(hal::timers::Event::TimeOut);

I can then create a handler for the TIM16 vector... but now I need to clear the UIF flag, and the only way I can come up with to do it is to steal another copy of the TIM16 register block. One solution is that probably the driver should provide a way to clear the interrupt flags, but it seems to me that a more general solution is to make the tim field (the reg block) public so that if I have a mutable Timer I can manipulate it's registers as well -- this allows for more general extensions of the driver as well as simply clearing the interrupt flag.

Perhaps I am missing something about the intended use here. I'm fairly new to Rust still -- still trying to adapt from C++.

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

No branches or pull requests

1 participant