示例#1
0
/*!
* @brief ISR Routine for Low Power Timer
*/
void demo_lptmr_isr(void)
{
   volatile uint32_t lptmrCsrTemp;
   CLOCK_SYS_EnableLptimerClock(0);
       
   LPTMR_HAL_ClearIntFlag(LPTMR0_BASE);      /* write 1 to TCF to clear the LPT timer compare flag */
   LPTMR_HAL_Enable(LPTMR0_BASE);            /* enable timer */
   LPTMR_HAL_SetIntCmd(LPTMR0_BASE, true);   /* enable interrupts */
   LPTMR_HAL_ClearIntFlag(LPTMR0_BASE);      /* clear the flag */

   /*wait for write to complete to  before returning */
   while(!(LPTMR_HAL_IsEnabled(LPTMR0_BASE) && LPTMR_HAL_GetIntCmd(LPTMR0_BASE)));
}
示例#2
0
/*!
* @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);
    }
}
示例#3
0
/* 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);
    }
}
示例#4
0
/* 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 : LPTMR_HAL_Init
 * Description   : Initialize LPTMR module to reset state.
 *
 *END**************************************************************************/
void LPTMR_HAL_Init(LPTMR_Type * base)
{
    lptmr_working_mode_user_config_t working_mode_config;
    lptmr_prescaler_user_config_t prescaler_config;
    
    LPTMR_HAL_Disable(base);
    LPTMR_HAL_ClearIntFlag(base);

    working_mode_config.timerModeSelect = kLptmrTimerModeTimeCounter;
    working_mode_config.freeRunningEnable = false;
    working_mode_config.pinPolarity = kLptmrPinPolarityActiveHigh;
    working_mode_config.pinSelect = kLptmrPinSelectInput0;
    LPTMR_HAL_SetTimerWorkingMode(base, working_mode_config);
    
    prescaler_config.prescalerValue = kLptmrPrescalerDivide2;
    prescaler_config.prescalerBypass = true;
    prescaler_config.prescalerClockSelect = kLptmrPrescalerClock0;
    LPTMR_HAL_SetPrescalerMode(base, prescaler_config);
    
    LPTMR_HAL_SetCompareValue(base, 0U);
    LPTMR_HAL_SetIntCmd(base, false);
}
示例#6
0
static void lptmr_isr(void)
{
    // TODO 0xc0170: looks like this gets fired even before set_interrupt
    LPTMR_HAL_ClearIntFlag(LPTMR0_BASE);
    LPTMR_HAL_Disable(LPTMR0_BASE);
}