Beispiel #1
0
/*******************************************************************************
* Function Name: InitializeSystem
********************************************************************************
*
* Summary:
*  Systm initialization function.
*
* Parameters:  
*  None
*
* Return: 
*  None
*
*******************************************************************************/
void InitializeSystem(void)
{
    CyGlobalIntEnable;      /* Enable Global Interrupts*/
    
    /* Internal low power oscillator is no longer required after Watch Crystal oscillator is started */
    CySysClkIloStop();
    
    /* Set the divider for ECO, ECO will be used as source when IMO is switched off to save power */
    CySysClkWriteEcoDiv(CY_SYS_CLK_ECO_DIV8);
    
    BLE_Engine_Start();     /* start the BLE interface */
    
    /* Wait for BLE Component to Initialize */
    while (CyBle_GetState() == CYBLE_STATE_INITIALIZING)
    {
        CyBle_ProcessEvents(); 
    }
    
#if (CONSOLE_LOG_ENABLE)
    Console_Start();  /* Console log interface */
    Console_UartPutString("System initialization complete\r\n"); 
#endif /* End of #if (CONSOLE_LOG_ENABLE) */
    
    /* ADD YOUR CODE TO INITIALIZE OTHER COMPONENTS IN YOUR DESIGN */
}
Beispiel #2
0
/*******************************************************************************
* Function Name: InitializeSystem
********************************************************************************
*
* Summary:
*  Systm initialization function.
*
* Parameters:
*  None
*
* Return:
*  None
*
*******************************************************************************/
void InitializeSystem(void)
{
    CyGlobalIntEnable;      /* Enable Global Interrupts*/

    /* Set the divider for ECO, ECO will be used as source when IMO is switched off to save power */
    CySysClkWriteEcoDiv(CY_SYS_CLK_ECO_DIV8);

#if LOW_POWER_STARTUP_ENABLE

    /* If LOW_POWER_STARTUP_ENABLE is set, then do the following for achieving lowest possible WCO & ECO startup current:
     * 1. Shut down the ECO (to reduce power consumption while WCO is starting)
     * 2. Enable WDT counter 0 to wakeup the system after 500ms (500ms = WCO startup time)
     * 3. Configure PSoC 4 BLE device in DeepSleep mode for the 500ms WCO startup time
     * 4. After WCO is enabled, restart the ECO so that BLESS interface can function
     * 5. Enable WDT counter 1 to wakeup the system after 1ms (1ms = ECO startup time)
     * 5. Configure PSoC 4 BLE device in DeepSleep mode for the 1ms ECO startup time */

    CySysClkEcoStop();      /* Shutdown the ECO and later re-start in low power mode after WCO is turned on */

    WDT_Interrupt_StartEx(WDT_Handler); /* Initialize WDT interrupt */

    WCO_ECO_LowPowerStart();    /* Enable WCO & ECO in low power mode using WDT counter 0/1 as system wakeup sources respectively */

#endif /* End of #if LOW_POWER_STARTUP_ENABLE */

#if (CONSOLE_LOG_ENABLE)
    Console_Start();  /* Console log interface */
    Console_UartPutString("Low power system startup complete\r\n");
#endif /* End of #if (CONSOLE_LOG_ENABLE) */

    BLE_Engine_Start();     /* start the BLE interface */

    /* Wait for BLE Component to Initialize */
    while (CyBle_GetState() == CYBLE_STATE_INITIALIZING)
    {
        CyBle_ProcessEvents();
    }
}