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

periodic advertising and sleep mode

link text from this link i want to advertise for 10 second then i want to stop advertise for 20 second then again advertise for 10 second. i want this continuously. for that i have defined timer

static void timers1_init(void)
{
    uint32_t err_code;

    // Initialize timer module.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);

    // Create timers.
    err_code = app_timer_create(&abc,
                               APP_TIMER_MODE_SINGLE_SHOT,
                                timeout_handler);

//APP_TIMER_MODE_SINGLE_SHOT-The timer will expire only once.
//APP_TIMER_MODE_REPEATED-The timer will restart each time it expires.

    APP_ERROR_CHECK(err_code);
}

static void application_timers_start(void)
{
    uint32_t err_code;

    // Start application timers.
    err_code = app_timer_start(abc, INTERVAL, NULL);
    APP_ERROR_CHECK(err_code);
}


static void timeout_handler(void * p_context)
{
    UNUSED_PARAMETER(p_context);
	sd_ble_gap_adv_stop ();
	//power_manage();
    
}
Related