<?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>LED implementation on nrF9160 with nRF connect 2.1.2</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93861/led-implementation-on-nrf9160-with-nrf-connect-2-1-2</link><description>Hi all , 
 I had my code working on nRF connect 1.6.0 and now had to upgrade it to work with nRF connect 2.1.2. 
 I read the migration guide for nRF connect 1.x.x to 2.x.x but still can&amp;#39;t fully understand how to port my working code on nRF connect 1.6</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 15 Nov 2022 13:26:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93861/led-implementation-on-nrf9160-with-nrf-connect-2-1-2" /><item><title>RE: LED implementation on nrF9160 with nRF connect 2.1.2</title><link>https://devzone.nordicsemi.com/thread/395800?ContentTypeID=1</link><pubDate>Tue, 15 Nov 2022 13:26:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83850f6a-a5ae-411a-b9f7-e4a6e3e748bb</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hello Einar ,&lt;/p&gt;
&lt;p&gt;It turned out to be something with&amp;nbsp;&lt;span&gt;parentheses&amp;nbsp;since when I changed&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;red_led_gpio = GPIO_DT_SPEC_GET_BY_IDX(DT_N_S_leds_S_led_0, gpios, 0);&lt;/pre&gt;&lt;/p&gt;
&lt;div&gt;into :&lt;pre class="ui-code" data-mode="text"&gt;red_led_gpio.port = DEVICE_DT_GET(DT_GPIO_CTLR_BY_IDX(DT_N_S_leds_S_led_0, gpios, 0));
&amp;#160; &amp;#160; &amp;#160;red_led_gpio.pin = DT_GPIO_PIN_BY_IDX(DT_N_S_leds_S_led_0, gpios, 0);
&amp;#160; &amp;#160; &amp;#160;red_led_gpio.dt_flags = DT_GPIO_FLAGS_BY_IDX(DT_N_S_leds_S_led_0, gpios, 0);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;It eliminated the erros.&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Thanks you for your assistance.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LED implementation on nrF9160 with nRF connect 2.1.2</title><link>https://devzone.nordicsemi.com/thread/395730?ContentTypeID=1</link><pubDate>Tue, 15 Nov 2022 10:02:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b894dc6f-b317-4301-98e2-b483f3422b0c</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Based on your error message here, I would double check for any missing parentheses or semicolons etc in your code.&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t find anything like that missing, could you please share the &amp;#39;leds&amp;#39; node from your generated devicetree found in build/zephyr/zephyr.dts?&lt;/p&gt;
&lt;p&gt;-Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LED implementation on nrF9160 with nRF connect 2.1.2</title><link>https://devzone.nordicsemi.com/thread/395727?ContentTypeID=1</link><pubDate>Tue, 15 Nov 2022 09:40:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:add3af52-7577-4163-a1c3-c609101b664f</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hello Einar,&lt;/p&gt;
&lt;p&gt;I will try to clarify&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I have&amp;nbsp;chosen a nrf9160_ns board.&lt;/li&gt;
&lt;li&gt;nRF&amp;nbsp;connect 2.1.2.&lt;/li&gt;
&lt;li&gt;I want to control led0 (Red LED on GPIO 2 ) and led1&amp;nbsp;&lt;span&gt;(Blue LED on GPIO 3)&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;I have&amp;nbsp;followed the example here :&amp;nbsp;&lt;a id="" href="https://academy.nordicsemi.com/topic/gpio-generic-api/"&gt;https://academy.nordicsemi.com/topic/gpio-generic-api/&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Based on that example&amp;nbsp;I wrote :&amp;nbsp;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;struct gpio_dt_spec&amp;#160;red_led_gpio = GPIO_DT_SPEC_GET(DT_NODELABEL(led0), gpios);&lt;/pre&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;The error messages that I get during my build are:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;../src/generic_app.c: In function &amp;#39;init_leds&amp;#39;:
C:\ncs\v2.1.2\zephyr\include\zephyr\drivers\gpio.h:337:2: error: expected expression before &amp;#39;{&amp;#39; token
337 | { \
| ^
C:\ncs\v2.1.2\zephyr\include\zephyr\drivers\gpio.h:374:2: note: in expansion of macro &amp;#39;GPIO_DT_SPEC_GET_BY_IDX&amp;#39;
374 | GPIO_DT_SPEC_GET_BY_IDX(node_id, prop, 0)
| ^~~~~~~~~~~~~~~~~~~~~~~
generic_app.c:98:22: note: in expansion of macro &amp;#39;GPIO_DT_SPEC_GET&amp;#39;
98 | red_led_gpio = GPIO_DT_SPEC_GET(DT_NODELABEL(led0), gpios);
| ^~~~~~~~~~~~~~~~&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Any suggestions ?&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LED implementation on nrF9160 with nRF connect 2.1.2</title><link>https://devzone.nordicsemi.com/thread/395615?ContentTypeID=1</link><pubDate>Mon, 14 Nov 2022 15:44:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5941dc7-d72a-4ca7-9c36-bdcf4e10040e</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hello Einar,&lt;/p&gt;
&lt;p&gt;The main issue that I have is how do I get the device that corresponds to led0, led1.&lt;/p&gt;
&lt;p&gt;I am able to get the GPIOs using :&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class="ui-code" data-mode="text"&gt;&amp;#160; &amp;#160; &amp;#160; /* GPIOs: &amp;#160;p0.02 == RED */
&amp;#160; &amp;#160; &amp;#160; red_gpio = DT_GPIO_PIN(DT_NODELABEL(led0), gpios);
&amp;#160;
&amp;#160; &amp;#160; &amp;#160; /* GPIOs: &amp;#160;p0.03 == BLUE */
&amp;#160; &amp;#160; &amp;#160; blue_gpio= &amp;#160;DT_GPIO_PIN(DT_NODELABEL(led1), gpios);&lt;/pre&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;How do I get the relevant device id?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LED implementation on nrF9160 with nRF connect 2.1.2</title><link>https://devzone.nordicsemi.com/thread/395602?ContentTypeID=1</link><pubDate>Mon, 14 Nov 2022 15:00:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fc7a274-97b1-49a4-af5c-44e981fa3782</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;It would help if you shared exactly what you&amp;#39;re having trouble with.&lt;/p&gt;
&lt;p&gt;In general I would recommend looking up the APIs you&amp;#39;re using in the newest documentation to check if they still work the same way:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/index.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/index.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you&amp;#39;ve done this and you are having trouble with something specific then please share any error messages you are seeing.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>