David-OConnor / stm32-hal

This library provides access to STM32 peripherals in Rust.
MIT License
147 stars 44 forks source link

Timer Interrupt Reason/Flags #96

Closed revilo196 closed 5 months ago

revilo196 commented 5 months ago

Hi,

If having multiple Interrupts active on a Timer, like Update and multiple Channels, is there a way to check which interrupt(s) are active once inside the Interrupt function.

I want to trigger different actions on different Channels of a timer.

Is there anything i've overlooked? I can't find any function to get this information.

David-OConnor commented 5 months ago

Try my_timer.regs.sr().read().bits(), and see which flags are set. Or my_timer.regs.sr().read().uif.bit_is_set() etc on a specific flag.

Note: Most periphs have a read_status() method to simplify this, but it's missing on Timer; adding for future version.

David-OConnor commented 5 months ago

Closing due to inactivity, and likely solution.