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

sleep mode in nrf51822

from this post link text i have again doubt

i define #define APP_ADV_TIMEOUT_IN_SECONDS 10. now my advertising stops after 10 sec.but i want to restart it again then??

Parents
  • Hi, just add advertising start function call on idle event. See here below:

    /* Function for handling advertising events. This function will be called for advertising events which are passed to the application */ static void on_adv_evt(ble_adv_evt_t ble_adv_evt) { ret_code_t err_code;

    switch (ble_adv_evt)
    {
        case BLE_ADV_EVT_FAST:
    	{
        	/* do nothing */
            break;
    	}
        case BLE_ADV_EVT_IDLE:
    	{
    		/* start advertising again */
    		err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
            APP_ERROR_CHECK(err_code);
            break;
    	}
        default:
            break;
    }
    

    }

    Feel free to have a look at my code repo on github for a full application example:

    github.com/.../nrf51_led_dimmer

    Regards.

Reply
  • Hi, just add advertising start function call on idle event. See here below:

    /* Function for handling advertising events. This function will be called for advertising events which are passed to the application */ static void on_adv_evt(ble_adv_evt_t ble_adv_evt) { ret_code_t err_code;

    switch (ble_adv_evt)
    {
        case BLE_ADV_EVT_FAST:
    	{
        	/* do nothing */
            break;
    	}
        case BLE_ADV_EVT_IDLE:
    	{
    		/* start advertising again */
    		err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
            APP_ERROR_CHECK(err_code);
            break;
    	}
        default:
            break;
    }
    

    }

    Feel free to have a look at my code repo on github for a full application example:

    github.com/.../nrf51_led_dimmer

    Regards.

Children
Related