-
Notifications
You must be signed in to change notification settings - Fork 1k
Flexible interrupts handling #767
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
Conversation
This lets the user start the timer without a callback and add it after. Moreover, now it is faster after detachInterrupt because the ISR is actually stopped and no context switching is made. This is good in performance critical code.
Hi @LinoBarreca |
@fpistm yes. Let me explain it. @ABOSTM told me that, if the timer doesn't have a clock, you can't access its registers. I assume he is right because he is way more expert than me. what was the logic behind my PR:
I thought my logic was working because with the If I misunderstood something (or you could clarify my doubt), however, let me know :) |
Hi @LinoBarreca , Your understanding of the issue is correct, |
ok. Thanks Alexandre but...can you please explain me why, with the timer clock disabled, we can write to ARR (setOverflow) and PSC (setPrescaler) but not to DIER? |
From hardware point of view it is not possible to write ARR or PSC registres (or any register) with timer clock disabled.
|
now I understood. You were very kind. |
I add label OnHold as it depends on #763 |
This lets the user start the timer without a callback and add it after. Moreover, now it is faster after detachInterrupt because the ISR is actually stopped and no context switching is made. This is good in performance critical code.
…rduino_Core_STM32 into FlexibleInterrupts
Main rework: * HAL_TIM_Base_Init() is now called only once at object creation * HAL_TIM_xxx_ConfigChannel is now done in setMode() * HAL_TIM_xxx_Start is done in resumeChannel() * use LL when possible * Configuration are directly made through hardware register access (xhen possible), then remove useless attribut * Add new API to pause only one channel: pauseChannel(uint32_t channel) fixes stm32duino#763 * integration of PR stm32duino#767 Flexible interrupts handling
Main rework: * HAL_TIM_Base_Init() is now called only once at object creation * HAL_TIM_xxx_ConfigChannel is now done in setMode() * HAL_TIM_xxx_Start is done in resumeChannel() * use LL when possible * Configuration are directly made through hardware register access (xhen possible), then remove useless attribut * Add new API to pause only one channel: pauseChannel(uint32_t channel) resumeChannel(uint32_t channel) fixes stm32duino#763 * integration of PR stm32duino#767 Flexible interrupts handling
Hi @LinoBarreca |
Main rework: * HAL_TIM_Base_Init() is now called only once at object creation * HAL_TIM_xxx_ConfigChannel is now done in setMode() * HAL_TIM_xxx_Start is done in resumeChannel() * use LL when possible * Configuration are directly made through hardware register access (xhen possible), then remove useless attribut * Add new API to pause only one channel: pauseChannel(uint32_t channel) resumeChannel(uint32_t channel) fixes stm32duino#763 * integration of PR stm32duino#767 Flexible interrupts handling
Main rework: * HAL_TIM_Base_Init() is now called only once at object creation * HAL_TIM_xxx_ConfigChannel is now done in setMode() * HAL_TIM_xxx_Start is done in resumeChannel() * use LL when possible * Configuration are directly made through hardware register access (xhen possible), then remove useless attribut * Add new API to pause only one channel: pauseChannel(uint32_t channel) resumeChannel(uint32_t channel) fixes stm32duino#763 * integration of PR stm32duino#767 Flexible interrupts handling
Main rework: * HAL_TIM_Base_Init() is now called only once at object creation * HAL_TIM_xxx_ConfigChannel is now done in setMode() * HAL_TIM_xxx_Start is done in resumeChannel() * use LL when possible * Configuration are directly made through hardware register access (xhen possible), then remove useless attribut * Add new API to pause only one channel: pauseChannel(uint32_t channel) resumeChannel(uint32_t channel) fixes stm32duino#763 * integration of PR stm32duino#767 Flexible interrupts handling
I close this one has integrated in #806. |
Summary
This PR modifies (internally) how timers are started so that it will be possible to attach an interrupt to an already running timer.
This PR fixes/implements the following bugs/features
detachInterrupt
and he expects to not have something besides systick that can interrupt his code. His code is still interrupted by HardwareTimer IRQ handler (and this is bad for time critical code, for example when the user, using the callback, wants to give a clock to something)Motivation
Improvement in usage and predictable behavior if the user didn't read the "warning" in the documentation.
Validation
Sorry it's untested at the moment. But, in theory, it should work fine.
Code formatting
I changed everything that travis complained about.
Closing issues
Closes the issues I mentioned in "bugs".
I didn't open them because I preferred to see if I could use the same time to find a solution instead of creating a problem :)