In the void HAL_PWREx_S3WU_IRQHandler(uint32_t WakeUpPin) callback is called with the WakeUpPin parameter, which does not indicate that specific interrupt occurred. Instead, it only forwards the WakeUpPin variable which contains information about which pins should trigger the handler. Also since wake up flag is cleared in the HAL_PWREx_S3WU_IRQHandler we can't check it later.
Proposed Change
Invoke the callback with the pin that triggered the interrupt:
...
if ((WakeUpPin & PWR_WAKEUP_PIN1) != 0U)
{
if (READ_BIT(PWR->WUSR, PWR_WUSR_WUF1) != 0U)
{
/* Clear PWR wake up flag line 1 */
SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF1);
/* PWR S3WU interrupt user callback */
HAL_PWREx_S3WUCallback(PWR_WAKEUP_PIN1); // instead of HAL_PWREx_S3WUCallback(WakeUpPin);
}
}
...
or call callback for all interrupts at once:
...
uint32_t local_wkp = 0;
if ((WakeUpPin & PWR_WAKEUP_PIN1) != 0U)
{
if (READ_BIT(PWR->WUSR, PWR_WUSR_WUF1) != 0U)
{
/* Clear PWR wake up flag line 1 */
SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF1);
/* PWR S3WU interrupt user callback */
local_wkp |= PWR_WAKEUP_PIN1;
}
}
if ((WakeUpPin & PWR_WAKEUP_PIN2) != 0U)
{
if (READ_BIT(PWR->WUSR, PWR_WUSR_WUF2) != 0U)
{
/* Clear PWR wake up flag line 2 */
SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF2);
/* PWR S3WU interrupt user callback */
local_wkp |= PWR_WAKEUP_PIN2;
}
}
HAL_PWREx_S3WUCallback(local_wkp);
}
In the
void HAL_PWREx_S3WU_IRQHandler(uint32_t WakeUpPin)
callback is called with theWakeUpPin
parameter, which does not indicate that specific interrupt occurred. Instead, it only forwards theWakeUpPin
variable which contains information about which pins should trigger the handler. Also since wake up flag is cleared in theHAL_PWREx_S3WU_IRQHandler
we can't check it later.Proposed Change
Invoke the callback with the pin that triggered the interrupt:
or call callback for all interrupts at once: