This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

which changes are require in code when use of wakeup button ?

Respected sir, 

There is added external reset button at SRU532 module, and changes are given according to it using wakeup button at code.When wakeup button is used then some part is uncommented and want to reset only one pin using one button of nRF51422.It is done for reset time of BLE advertising after 3 min or within 1 hr,but it is not worked.How it will solve?

...

Parents
  • Hi,

    Please refer for instance to the \examples\ble_peripheral\ble_app_hids_keyboard on how to achieve this:

    [...]
    
    uint32_t bsp_btn_ble_sleep_mode_prepare(void)
    {
        uint32_t err_code = bsp_wakeup_button_enable(BTN_ID_WAKEUP); 
        RETURN_ON_ERROR_NOT_NOT_SUPPORTED(err_code);
    
        err_code = bsp_wakeup_button_enable(BTN_ID_WAKEUP_BOND_DELETE); 
        RETURN_ON_ERROR_NOT_NOT_SUPPORTED(err_code);
        
        return NRF_SUCCESS;
    }
    
    [...]
    
    static void sleep_mode_enter(void)
    {
        uint32_t err_code = bsp_indication_set(BSP_INDICATE_IDLE);
    
        APP_ERROR_CHECK(err_code);
    
        // Prepare wakeup buttons.
        err_code = bsp_btn_ble_sleep_mode_prepare();
        APP_ERROR_CHECK(err_code);
    
        // Go to system-off mode (this function will not return; wakeup will cause a reset).
        err_code = sd_power_system_off();
        APP_ERROR_CHECK(err_code);
    }
    
    [...]
    
    sleep_mode_enter();
    while(1);
    
    [...]

Reply
  • Hi,

    Please refer for instance to the \examples\ble_peripheral\ble_app_hids_keyboard on how to achieve this:

    [...]
    
    uint32_t bsp_btn_ble_sleep_mode_prepare(void)
    {
        uint32_t err_code = bsp_wakeup_button_enable(BTN_ID_WAKEUP); 
        RETURN_ON_ERROR_NOT_NOT_SUPPORTED(err_code);
    
        err_code = bsp_wakeup_button_enable(BTN_ID_WAKEUP_BOND_DELETE); 
        RETURN_ON_ERROR_NOT_NOT_SUPPORTED(err_code);
        
        return NRF_SUCCESS;
    }
    
    [...]
    
    static void sleep_mode_enter(void)
    {
        uint32_t err_code = bsp_indication_set(BSP_INDICATE_IDLE);
    
        APP_ERROR_CHECK(err_code);
    
        // Prepare wakeup buttons.
        err_code = bsp_btn_ble_sleep_mode_prepare();
        APP_ERROR_CHECK(err_code);
    
        // Go to system-off mode (this function will not return; wakeup will cause a reset).
        err_code = sd_power_system_off();
        APP_ERROR_CHECK(err_code);
    }
    
    [...]
    
    sleep_mode_enter();
    while(1);
    
    [...]

Children
No Data
Related