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

sleep mode in nrf51822

hello there i want to put my nrf51822 in sleep mode when it is not advertising. can you tell me how to do it?

Parents
  • you can see it in most demo.

    I can tell you most of this operation occur is when the ADV (fast ADV / Slow ADV / direct ADV, etc.) time out. So you can find it in the adv time out call back function. And slow ADV is always the last ADv type, then go to sleep. You can find what you want by search BLE_ADV_EVT_IDLE.

    case BLE_ADV_MODE_SLOW:
                        m_adv_evt = BLE_ADV_EVT_IDLE;
                        LOG("[ADV]: Timed out from slow advertising, stopping advertising.\r\n");
                        if (m_evt_handler != NULL)
                        {
                            m_evt_handler(m_adv_evt);
                        }
                        break;
    
    
    static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
    {
        uint32_t err_code;
    
        switch (ble_adv_evt)
        {
            case BLE_ADV_EVT_FAST:
                err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
                APP_ERROR_CHECK(err_code);
                break;
            case BLE_ADV_EVT_IDLE:
                sleep_mode_enter();
                break;
            default:
                break;
        }
    }
    
  • can we add time? like after 5 s nrf51822 goes into sleep mode

Reply Children
No Data
Related