You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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++.
The text was updated successfully, but these errors were encountered:
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:
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 thetim
field (the reg block) public so that if I have a mutableTimer
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++.
The text was updated successfully, but these errors were encountered: