/* LLW_IRQHandler that would cover the same name's APIs in startup code */ void LLWU_IRQHandler(void) { // The LLWU wakeup interrup is LPTMR source if (LLWU_HAL_GetInternalModuleWakeupFlag(LLWU_BASE_PTR, PM_RTOS_DEMO_LPTMR_LLWU_WAKEUP_MODULE)) { LPTMR_HAL_ClearIntFlag(g_lptmrBase[PM_RTOS_DEMO_LPTMR_FUNC_INSTANCE]); } // The LLWU wakeup interrup is RTC source if (LLWU_HAL_GetInternalModuleWakeupFlag(LLWU_BASE_PTR, PM_RTOS_DEMO_RTC_LLWU_WAKEUP_MODULE)) { RTC_DRV_SetAlarmIntCmd(PM_RTOS_DEMO_RTC_FUNC_INSTANCE, false); } }
/*! * @brief LLWU ISR function */ void llwu_isr(void) { uint8_t pinEn; NVIC_ClearPendingIRQ(LLW_IRQn); /* Print LLWU acknowledgement only if UART is enabled */ for(pinEn = 0; pinEn < FSL_FEATURE_LLWU_HAS_EXTERNAL_PIN; pinEn++) { if (LLWU_HAL_GetExternalPinWakeupFlag(LLWU_BASE, (llwu_wakeup_pin_t)pinEn)) { LLWU_HAL_ClearExternalPinWakeupFlag(LLWU_BASE, (llwu_wakeup_pin_t)pinEn); /* write one to clear the flag */ } } /* * Note: This ISR does not write to the LLWU_F3 register because these * are peripheral module wakeups. The flags contained in the LLWU_F3 * register should be cleared through the associated module interrupt * and not through the LLWU_F3 per the Kinetis L Family Reference * Manual (LLWU Chapter) */ if (LLWU_HAL_GetInternalModuleWakeupFlag(LLWU_BASE, kLlwuWakeupModule0)) { CLOCK_SYS_EnableLptimerClock(0); LPTMR_HAL_ClearIntFlag(LPTMR0_BASE); /* write 1 to TCF to clear the LPT timer compare flag */ LPTMR_HAL_IsEnabled(LPTMR0_BASE); LPTMR_HAL_SetIntCmd(LPTMR0_BASE, 1); LPTMR_HAL_IsIntPending(LPTMR0_BASE); } if(LLWU_HAL_GetFilterDetectFlag(LLWU_BASE, 0)){ LLWU_HAL_ClearFilterDetectFlag(LLWU_BASE, 0); } if(LLWU_HAL_GetFilterDetectFlag(LLWU_BASE, 1)){ LLWU_HAL_ClearFilterDetectFlag(LLWU_BASE, 1); } }
/* LLW_IRQHandler that would cover the same name's APIs in startup code */ void LLWU_IRQHandler(void) { // The LLWU wakeup interrup is LPTMR source if (LLWU_HAL_GetInternalModuleWakeupFlag(LLWU_BASE_PTR, PM_RTOS_DEMO_LPTMR_LLWU_WAKEUP_MODULE)) { LPTMR_HAL_ClearIntFlag(g_lptmrBase[PM_RTOS_DEMO_LPTMR_FUNC_INSTANCE]); } // The LLWU wakeup interrup is RTC source if (LLWU_HAL_GetInternalModuleWakeupFlag(LLWU_BASE_PTR, PM_RTOS_DEMO_RTC_LLWU_WAKEUP_MODULE)) { RTC_DRV_SetAlarmIntCmd(PM_RTOS_DEMO_RTC_FUNC_INSTANCE, false); } // The LLWU wakeup interrup is Switch/Button source if (LLWU_HAL_GetExternalPinWakeupFlag(LLWU_BASE_PTR,(llwu_wakeup_pin_t)BOARD_SW_LLWU_EXT_PIN)) { LLWU_HAL_ClearExternalPinWakeupFlag(LLWU_BASE_PTR, (llwu_wakeup_pin_t)BOARD_SW_LLWU_EXT_PIN); } }
/*FUNCTION********************************************************************** * * Function Name : POWER_SYS_GetWakeupModuleFlag * Description : This function allows to get wake up module flag in LLWU. * *END**************************************************************************/ bool POWER_SYS_GetWakeupModuleFlag(power_wakeup_module_t module) { /* Checks module range which is defined by enumeration type */ assert( module < kPowerManagerWakeupMax); return LLWU_HAL_GetInternalModuleWakeupFlag(LLWU, (llwu_wakeup_module_t)module); }