Hello Miro, I've got une question. If __WFI() stops CPU execution and it is called with interrupts disabled, why "enable_irq" is still executed afterwards? Is it because the CPU knows you have previously pressed the button when calling __WFI()?
@StateMachineCOM19 сағат бұрын
@jordibatlledelallave As you say, WFI is called with interrupts still disabled (with PRIMASK), and the interrupts remain *disabled* after the CPU wakes up. You can see this at 23:35. So, you must enable interrupts because nothing else will! This is precisely the special property of the PRIMASK register I referenced at 27:30 (Joseph Yiu's book). PRIMASK disables interrupts but still allows the CPU to be WOKEN UP by an interrupt (see the "Wake-up conditions" in Yiu). --MMS