Example #1
0
void lld_sleep_init_func(void)
{
    // Clear the environment
    memset(&lld_sleep_env, 0, sizeof(lld_sleep_env));

    // Set wakeup_delay
    set_sleep_delay();
    
    // Enable external wake-up by default
    ble_extwkupdsb_setf(0);
}
Example #2
0
void lld_sleep_init_func(void)
{
    uint16_t delay;
    uint32_t twirq_set_value;
    
    if (lp_clk_sel == LP_CLK_RCX20)
        twirq_set_value = XTAL_TRIMMING_TIME_RCX;
    else // if (lp_clk_sel == LP_CLK_XTAL32)
        twirq_set_value = XTAL_TRIMMING_TIME;
    
    // Clear the environment
    memset(&lld_sleep_env, 0, sizeof(lld_sleep_env));

    // Actual "delay" is application specific and is the execution time of the BLE_WAKEUP_LP_Handler(), which depends on XTAL trimming delay,
    // plus the time taken for the OTP copy. Time unit of delay is usec.
    delay = lld_sleep_lpcycles_2_us_func(twirq_set_value);
    // Icrease time taking in to account the time from the setting of BLE_DEEP_SLEEP_ON_BIT until the execution of WFI.    
    delay += 200;     
    rwip_wakeup_delay_set(delay);

    // Enable external wake-up by default
    ble_extwkupdsb_setf(0);
}