<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>custom_ble_service_example - LED&amp;#39;s</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/37081/custom_ble_service_example---led-s</link><description>Looking to better understand bsp_indication_set. 
 As per the example custom_ble_service_example found on github, ...when DK is connected, LED_1 is lit and stays lit from bsp_indication_set(BSP_INDICATE_CONNECTED). (I have attached main.c from example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 30 Aug 2018 15:15:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/37081/custom_ble_service_example---led-s" /><item><title>RE: custom_ble_service_example - LED's</title><link>https://devzone.nordicsemi.com/thread/146558?ContentTypeID=1</link><pubDate>Thu, 30 Aug 2018 15:15:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c24814b5-3662-48d4-9ac7-705ee39327a5</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;thank-you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: custom_ble_service_example - LED's</title><link>https://devzone.nordicsemi.com/thread/146454?ContentTypeID=1</link><pubDate>Thu, 30 Aug 2018 09:12:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9ac1f3c-e5f8-4c96-b5dc-244a52b66a72</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;One option is to track the SDK with Git and make a branch for each &amp;quot;project&amp;quot;. Then you can safely make small modifications to the SDK without it impacting other projects. I suggest you use the master branch as an unaltered version of the SDK, and only include the components and example folders in order to keep the size down.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: custom_ble_service_example - LED's</title><link>https://devzone.nordicsemi.com/thread/145771?ContentTypeID=1</link><pubDate>Sun, 26 Aug 2018 01:30:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22b666aa-e908-4452-bf4f-147a90c01f8c</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Switched to ble_app_template in sdk 15.0 to test again, and I&amp;#39;m looking for all the disconnects that have start_advertisment.&lt;br /&gt;The&amp;nbsp;disconnect event that seems to trigger before the disconnect in main, is in ble_advertising.c:&lt;/p&gt;
&lt;p&gt;case BLE_GAP_EVT_DISCONNECTED:&lt;br /&gt;on_disconnected(p_advertising, p_ble_evt);&lt;br /&gt;break;&lt;/p&gt;
&lt;p&gt;When disconnecting, the on_disconnected in ble_advertising.c will execute and cause LED_1 to blink very faintly. If you try to comment this line, then the program seems to go into sleep_mode after the disconnected event in main. By adding ble_advertising_start to disconnected in main.c seems to give better control over the LEDs when advertising again.&lt;/p&gt;
&lt;p&gt;But since this is an sdk file now all the examples that advertise are now affected with this comment. How then not to have to edit an sdk file and keep advertising control in main for each specific example?&lt;/p&gt;
&lt;p&gt;thank-you,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;In ble_advertising.c, 

        case BLE_GAP_EVT_DISCONNECTED:
            //on_disconnected(p_advertising, p_ble_evt);
            break;

In main.c, 


        case BLE_GAP_EVT_DISCONNECTED:
            NRF_LOG_INFO(&amp;quot;Disconnected.&amp;quot;);
           //LED indication will be changed when advertising starts.

          //Add BSP_INDICATE_IDLE to stop advertising LED 1 		
            err_code = bsp_indication_set(BSP_INDICATE_IDLE);
            APP_ERROR_CHECK(err_code);

          //If you comment &amp;quot;on_disconnected(p_advertising, p_ble_evt);&amp;quot; 
          //in ble_advertising.c, then LED_2 below will not be reached.		
            nrf_gpio_cfg_output(LED_2);
            nrf_gpio_pin_set(LED_2);
            nrf_gpio_pin_clear(LED_2);
            nrf_delay_ms(500);
            nrf_gpio_pin_set(LED_2);

          //Add ble_advertising_start to start advertising LED 1 		
            ret_code_t err_code = ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);
            APP_ERROR_CHECK(err_code);

            break;

        case BLE_GAP_EVT_CONNECTED:
            NRF_LOG_INFO(&amp;quot;Connected.&amp;quot;);

//            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
//            APP_ERROR_CHECK(err_code);

            //When you comment the line above, BSP_INDICATE_CONNECTED, 
            //and do not set BSP_INDICATE_IDLE, then LED_1 will blink 
            //like it is advertising!!!	
            err_code = bsp_indication_set(BSP_INDICATE_IDLE);
            APP_ERROR_CHECK(err_code);

            nrf_gpio_cfg_output(LED_3);
            nrf_gpio_pin_set(LED_3);
            nrf_gpio_pin_clear(LED_3);
            nrf_delay_ms(500);
            nrf_gpio_pin_set(LED_3);

            m_conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
            err_code = nrf_ble_qwr_conn_handle_assign(&amp;amp;m_qwr, m_conn_handle);
            APP_ERROR_CHECK(err_code);
            break;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: custom_ble_service_example - LED's</title><link>https://devzone.nordicsemi.com/thread/145727?ContentTypeID=1</link><pubDate>Fri, 24 Aug 2018 19:32:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7005fc1b-57a1-4b47-a7e8-ab7479d2488f</guid><dc:creator>gercer</dc:creator><description>&lt;p&gt;If you want to change which LED turns on you have to modify bsp_config.h (around line 110). If you want the &lt;em&gt;LED_3&lt;/em&gt; turn on instead of &lt;em&gt;LED_1&lt;/em&gt;, change&amp;nbsp;&lt;em&gt;BSP_BOARD_LED_0&amp;nbsp;&lt;/em&gt;&lt;strong&gt;(which is LED 1)&amp;nbsp;&lt;/strong&gt; to&amp;nbsp;&lt;em&gt;BSP_BOARD_LED_2&amp;nbsp;&lt;strong&gt;(&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt;LED_3)&amp;nbsp;&lt;/strong&gt;for each of the status you wanna modify.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: custom_ble_service_example - LED's</title><link>https://devzone.nordicsemi.com/thread/143517?ContentTypeID=1</link><pubDate>Thu, 09 Aug 2018 09:06:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46177b04-1d61-4797-9977-7acf6bf560fb</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Search your project for any call to start_advertisment() or whatever call is used to start advertisements, and then make sure it&amp;#39;s only present in one of the on_disconnected event handlers and once to start the first advertisements of course.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: custom_ble_service_example - LED's</title><link>https://devzone.nordicsemi.com/thread/143459?ContentTypeID=1</link><pubDate>Thu, 09 Aug 2018 02:06:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3aab957-3b22-46f6-a624-a72a5d5614e2</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I&amp;#39;ve been able to stay within main.c without having to edit the SDK file bsp.c so as not to have the LED&amp;#39;s overlap, except for when it comes to Disconnect.&lt;/p&gt;
&lt;p&gt;RTT output: (app: Disconnect -* is just a label to help identify location in code)&lt;br /&gt;--&amp;gt;&amp;gt; when clicking Connect in nrf connect&lt;br /&gt; 0&amp;gt; &amp;lt;info&amp;gt; app: Disconnect - ble_evt_handler&lt;br /&gt; 0&amp;gt; &amp;lt;info&amp;gt; app: Disconnect - default&lt;/p&gt;
&lt;p&gt;--&amp;gt;&amp;gt; when clicking Disconnect in nrf connect&lt;br /&gt; 0&amp;gt; &amp;lt;info&amp;gt; app: Disconnect - on_adv_evt&lt;br /&gt; 0&amp;gt; &amp;lt;info&amp;gt; app: Fast advertising. &amp;lt;&amp;lt;&amp;lt;---- advertising already comes on&lt;br /&gt; 0&amp;gt; &amp;lt;info&amp;gt; app: Disconnect - ble_cus_on_ble_evt&lt;br /&gt; 0&amp;gt; &amp;lt;info&amp;gt; app: BLE event received. Event type = 17&lt;br /&gt; 0&amp;gt; &lt;br /&gt; 0&amp;gt; &amp;lt;info&amp;gt; app: Disconnect - on_disconnect &amp;lt;&amp;lt;&amp;lt;--- from ble_cus.c&lt;br /&gt; 0&amp;gt; &amp;lt;info&amp;gt; app: Disconnect - ble_evt_handler&lt;br /&gt; 0&amp;gt; &amp;lt;info&amp;gt; app: Disconnected. &amp;lt;&amp;lt;&amp;lt;--- disconnect led is then executed from main.c&lt;br /&gt;---&amp;gt;&amp;gt;&amp;gt; Fast advertising should come here after Disconnected, and not before for the LED&amp;#39;s not to overlap&lt;/p&gt;
&lt;p&gt;On the DK you can faintly see the advertising LED1 already going on and off as the disconnect routine is still executing.&lt;/p&gt;
&lt;p&gt;How to get advertising to only start after completing disconnect?&lt;/p&gt;
&lt;p&gt;thank-you,&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/54752.main.c"&gt;devzone.nordicsemi.com/.../54752.main.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: custom_ble_service_example - LED's</title><link>https://devzone.nordicsemi.com/thread/143120?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 05:42:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebcd69a4-b96a-441d-bfd3-6e62762e810c</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;almost there, now to understand why when clicking disconnect it goes quickly into fast advertising before disconnecting (according to RTT)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: custom_ble_service_example - LED's</title><link>https://devzone.nordicsemi.com/thread/143041?ContentTypeID=1</link><pubDate>Mon, 06 Aug 2018 13:15:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2f609a4-9263-4fb4-b9ad-88cb86ae8150</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;If you want to change the behavior of the BSP then you need to go to where&amp;nbsp;bsp_indication_set(BSP_INDICATE_CONNECTED) in bsp.c and change it there.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>