<?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>NFR52840 button P1.02 and P0.02 callback</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87505/nfr52840-button-p1-02-and-p0-02-callback</link><description>How Can I store information about button port ? I have two buttons P1.02 and P0.02. I have 
 
 And I have one function to init button 
 
 the most interesting is callback because I thought If I have pin bitmask I can use the same callback for gpio1 and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 03 May 2022 14:34:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87505/nfr52840-button-p1-02-and-p0-02-callback" /><item><title>RE: NFR52840 button P1.02 and P0.02 callback</title><link>https://devzone.nordicsemi.com/thread/366030?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 14:34:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9647734-7a34-4519-88e4-93456920b6e4</guid><dc:creator>404Software</dc:creator><description>&lt;p&gt;Ok so I need to compare string something like that&amp;nbsp;&lt;br /&gt;accessoryConfiguration.driver.testButtonPin == bit_to_pin &amp;amp;&amp;amp;&amp;nbsp;&lt;span&gt;dev&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;name == &amp;#39;GPIO_1&amp;#39;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NFR52840 button P1.02 and P0.02 callback</title><link>https://devzone.nordicsemi.com/thread/365985?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 12:34:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b71419dc-28e7-42c3-854d-4000cdbb1ace</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Michael,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the callback you can get the port number of the pin that trigger the callback by checking the dev argument. So in the&amp;nbsp;Button_pressed() function if you add this:&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;printk&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;Port of the button:&amp;nbsp;&lt;/span&gt;&lt;span&gt;%s&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;dev&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;name&lt;/span&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;You can find which port the pin (s) is on.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NFR52840 button P1.02 and P0.02 callback</title><link>https://devzone.nordicsemi.com/thread/365869?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 04:56:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6554b4a-92cc-4eb8-b0e5-d7e36992aab1</guid><dc:creator>qwertynoon</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;If understand you write then&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#definу gpio_0 11
#definу gpio_1 12
#definу gpio_2 24
#definу gpio_3 25

static void GPIO_EVENT(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
        LOG_INF(&amp;quot;screaming pin %d&amp;quot;, pin);
        LOG_INF(&amp;quot;low or high state %d&amp;quot;, action);
}

main()
{
	    IRQ_CONNECT(DT_IRQN(DT_NODELABEL(gpiote)),
		DT_IRQ(DT_NODELABEL(gpiote), priority),
		nrfx_isr, nrfx_gpiote_irq_handler, 0);
        nrfx_gpiote_init(NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY);
        nrfx_gpiote_in_config_t cfg = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);
        cfg.pull = NRF_GPIO_PIN_PULLDOWN;
        nrfx_gpiote_in_init(gpio_0, &amp;amp;cfg, GPIO_EVENT);
        nrfx_gpiote_in_init(gpio_1, &amp;amp;cfg, GPIO_EVENT);
        nrfx_gpiote_in_init(gpio_2, &amp;amp;cfg, GPIO_EVENT);
        nrfx_gpiote_in_init(gpio_3, &amp;amp;cfg, GPIO_EVENT);
        nrfx_gpiote_in_event_enable(gpio_0, true);
        nrfx_gpiote_in_event_enable(gpio_1, true);
        nrfx_gpiote_in_event_enable(gpio_2, true);
        nrfx_gpiote_in_event_enable(gpio_3, true);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>