コード例 #1
0
ファイル: main.c プロジェクト: cjc1029nice/ksdk
/*!
 * @brief Get inup from user about wakeup timeout
 */
uint8_t setWakeUpTimeOut(void)
{
    uint8_t val0;
    uint8_t val1;

    while(1)
    {
        PRINTF("Select the wake up timeout in format DD. Possible decimal value is from range 01 - 60 seconds. Eg. 05 means 5 seconds delay");
        PRINTF("\r\nWaiting for key press..\r\n\r\n");
        val0 = GETCHAR();
        if( (val0 >= '0') && (val0 <= '6') )
        {
            val1 = GETCHAR();
            if( (val1 >= '0') && (val1 <= '9') )
            {
                val0 = (val0-'0')*10 + (val1-'0');
                if( (val0!=0) && (val0<=60) )
                {
                    INT_SYS_DisableIRQGlobal();
                    LLWU_HAL_SetInternalModuleCmd(LLWU_BASE_PTR,kLlwuWakeupModule5,true);
                    INT_SYS_EnableIRQGlobal();
                    cmd_alarm(val0);
                    return val0;
                }
            }
        }

        PRINTF("Wrong value!\r\n");
    }
}
コード例 #2
0
ファイル: llwu.c プロジェクト: colossus212/Quadcopter_Will
/*!
 * @brief Set up the LLWU for wakeup the MCU from LLS and VLLSx modes 
 * from the selected pin or module.
 *  
 * @param
 * pin_en - unsigned integer, bit position indicates the pin is enabled.  
 *          More than one bit can be set to enable more than one pin at a time.  
 * @param 
 * rise_fall - 0x00 = External input disabled as wakeup
 *             0x01 - External input enabled as rising edge detection
 *             0x02 - External input enabled as falling edge detection
 *             0x03 - External input enablge as any edge detection
 * @param
 * module_en - unsigned char, bit position indicates the module is enabled.  
 *             More than one bit can be set to enabled more than one module                   
 *  
 * for example:  if bit 0 and 1 need to be enabled as rising edge detect call this  routine with
 * pin_en = 0x0003 and rise_fall = 0x02
   
 * Note: to set up one set of pins for rising and another for falling, 2 calls to this 
 *       function are required, 1st for rising then the second for falling.
 */
void llwu_configure(llwu_wakeup_pin_t pinEn, llwu_external_pin_modes_t riseFall, 
                    llwu_wakeup_module_t moduleEn ) 
{
    /****************************************************************
     * LLWU pin initialization
     *
     * First, clear the associated flag just to be sure the device
     * doesn't immediately enter the LLWU interrupt service routine 
     * (ISR). Then enable the interrupt
     ****************************************************************/
    LLWU_HAL_ClearExternalPinWakeupFlag(LLWU_BASE, pinEn);
    
    LLWU_HAL_SetExternalInputPinMode(LLWU_BASE, riseFall, pinEn);
    
    /******************************************************************
     * LLWU module initialization
     *
     * Now enable an internal peripheral module as an LLWU source if
     * desired
     ****************************************************************/
    if (moduleEn < NULL_LLWU_SRC_VAL)
    {
      LLWU_HAL_SetInternalModuleCmd(LLWU_BASE, moduleEn, true);
    }
    
} /* End LLWU Configuration */
コード例 #3
0
ファイル: fsl_power_manager.c プロジェクト: Btar/HEXIWEAR
/*FUNCTION**********************************************************************
 *
 * Function Name : POWER_SYS_SetWakeupModule
 * Description   : This function allows to set wake up module in low leakage wake up unit (LLWU).
 *
 *END**************************************************************************/
void POWER_SYS_SetWakeupModule(power_wakeup_module_t module,bool enable)
{   
    /* Checks module range which is defined by enumeration type */
    assert( module < kPowerManagerWakeupMax);
    /* Set module */
    LLWU_HAL_SetInternalModuleCmd(LLWU, (llwu_wakeup_module_t)module, enable);
    
}
コード例 #4
0
ファイル: task_lpm.c プロジェクト: kylemanna/kinetis-sdk1
uint8_t setWakeUpTimeOut(wakeUpSource_t wus)
{
    uint8_t val0;
    uint8_t val1;

    while(1)
    {
        PRINTF("Select the wake up timeout in format DD. Possible decimal value is from range 01 - 60 seconds. Eg. 05 means 5 seconds delay");
        PRINTF("\n\rWaiting for key press..\n\r\n\r");
        val0 = getInput();
        PRINTF("You pressed: '%c", val0);
        if( (val0 >= '0') && (val0 <= '6') )
        {
            val1 = getInput();
            PRINTF("%c'\r\n", val1);
            if( (val1 >= '0') && (val1 <= '9') )
            {
                val0 = (val0-'0')*10 + (val1-'0');
                if( (val0!=0) && (val0<=60) )
                {
                    OSA_EnterCritical(kCriticalDisableInt);
                    if((wus & wakeUpSourceRtc) != 0)
                    {
                        LLWU_HAL_SetInternalModuleCmd(LLWU_BASE_PTR,PM_RTOS_DEMO_RTC_LLWU_WAKEUP_MODULE,true);
                    }
                    if((wus & wakeUpSourceLptmr) != 0)
                    {
                        LLWU_HAL_SetInternalModuleCmd(LLWU_BASE_PTR,PM_RTOS_DEMO_LPTMR_LLWU_WAKEUP_MODULE,true);
                    }
                    OSA_ExitCritical(kCriticalDisableInt);
                    cmdAlarm(wus, val0);
                    return val0;
                }
            }
        }

        PRINTF("Wrong value!\n\r");
    }
}
コード例 #5
0
ファイル: main.c プロジェクト: cjc1029nice/ksdk
void llwuDisableWakeUp(void)
{
    LLWU_HAL_SetInternalModuleCmd(LLWU_BASE_PTR,kLlwuWakeupModule5,false);
}
コード例 #6
0
ファイル: task_lpm.c プロジェクト: kylemanna/kinetis-sdk1
void llwuDisableWakeUp(void)
{
    LLWU_HAL_SetInternalModuleCmd(LLWU_BASE_PTR, PM_RTOS_DEMO_RTC_LLWU_WAKEUP_MODULE, false);
    LLWU_HAL_SetInternalModuleCmd(LLWU_BASE_PTR, PM_RTOS_DEMO_LPTMR_LLWU_WAKEUP_MODULE, false);
}