Clear Interrupts Prior to sleep confusion
I'm working on getting the STM32G0 to stop mode. Im using WFI so it will wake on interrupt. Right now its immediately waking which is confusing me.
My understanding is that I should __disable_irq() first to prevent the interrupt handlers from being called which would potentially cause you to miss a wakeup flag because the handler cleared it. I can't make sense of this.
with the irq disabled the flag could still get set. Thus, I think I need to disable the IRQ source itself. once the source is disabled then why would I need to call disable_irq?
Unless I should do as follows
1. Disable sources I don't want to wake the MCU
2. disable_irq
3. configure sources I _do_ want to wake the MCU
4. STOP
Is this the correct procedure?
