Edit: This question is wrong. The stm325105 has only one wakeup pin. But other ST-parts has more than one wakeup pin, so the given answer is valid for those.
I have a stm32f105 that has two momentary buttons connected to the wakeup inputs. The processor is put in STANDBY MODE. When any of the buttons are pressed, or the RTC timer fires, the cpu wakes up.
The problem is that I want the cpu to do different things depending on which wakeup input was triggered. According to 5.3.5 from ST stm32f105xx reference manual, no registers are preserved except for a status register indicating that we've been woken up (but not by who) and 42 backup registers.
The Standby mode allows to achieve the lowest power consumption. It is based on the Cortex ® -M3 deepsleep mode, with the voltage regulator disabled. The 1.8 V domain is consequently powered off. The PLL, the HSI oscillator and the HSE oscillator are also switched off. SRAM and register contents are lost except for registers in the Backup domain and Standby circuitry.
After waking up from Standby mode, program execution restarts in the same way as after a Reset (boot pins sampling, vector reset is fetched, etc.). The SBF status flag in the Power control/status register (PWR_CSR) indicates that the MCU was in Standby mode.
This ST forum post, How to determine the origin of Wakeup from Standby?, suggests that I can't detect which wakeup triggered in software. I found no other posts there that gave any more enlightment.
How can I use software or hardware for determining, after waking up, which wakeup input was triggered?