Hello BP,
To handle multiple, overlapping key presses using the KBI module might be possible with the following approach -
Whenever a key is pressed, it generates an interrupt that wakes up the MCU.
Within the ISR code, the pressed key would be ascertained and action taken to flag the event. Interrupts would then be disabled for that key only, before exiting the ISR. You might also start a debounce delay period within the ISR, in lieu of your CR input filter, (but don't wait until timeout occurs before exiting the ISR).
With each interrupt disabled while the key remains pressed, this should allow other keys to be sensed, and to generate new interrupts.
From within main(), or an associated function, you might then periodically test, firstly for completion of the debounce timeout period, and after this has occurred, for the key being in a released state. Only after the key has been released would the interrupt be re-enabled for that particular keyswitch.
You should not re-enter stop mode until all keyswitches have been released (and the KBI interrupt has been re-enabled for all keyswitches).
Regards,
Mac