<?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>How to configure external pin interrupt with nRF51822?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/2468/how-to-configure-external-pin-interrupt-with-nrf51822</link><description>Is there a simple software code example how to configure an interrupt handler for a single GPIO-pin? I am using nRF51822 chip with softdevice S110 and the interrupt source is connected to pin P0.24.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 08 May 2014 07:18:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/2468/how-to-configure-external-pin-interrupt-with-nrf51822" /><item><title>RE: How to configure external pin interrupt with nRF51822?</title><link>https://devzone.nordicsemi.com/thread/9956?ContentTypeID=1</link><pubDate>Thu, 08 May 2014 07:18:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c25d4a99-c97d-4f7a-93dd-2a17c8d6e9a8</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;The library uses the timer for the &amp;quot;detection delay&amp;quot;.
The actual pin-interrupt occurs in &amp;quot;void GPIOTE_IRQHandler(void)&amp;quot; (app_gpiote.c), as he app-button lib registers itself as a GPIOTE-user in the init function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to configure external pin interrupt with nRF51822?</title><link>https://devzone.nordicsemi.com/thread/9957?ContentTypeID=1</link><pubDate>Thu, 08 May 2014 07:08:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:869519a2-5f5a-42f5-9155-733612419b55</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Thanks, I checked the code. For me, it looks like it is using a timer to poll the pin. The code is as below (clipped). There is no hint about using interrupt, except the timer, or do I misunderstand?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    // Configure pin.
    nrf_gpio_cfg_input(p_btn-&amp;amp;gt;pin_no, p_btn-&amp;amp;gt;pull_cfg);
    
    // Build GPIOTE user registration masks.
    m_active_high_states_mask |= ((p_btn-&amp;amp;gt;active_high ? 1 : 0) &amp;amp;lt;&amp;amp;lt; p_btn-&amp;amp;gt;pin_no);
    m_active_low_states_mask  |= ((p_btn-&amp;amp;gt;active_high ? 0 : 1) &amp;amp;lt;&amp;amp;lt; p_btn-&amp;amp;gt;pin_no);
}

// Register button module as a GPIOTE user.
err_code = app_gpiote_user_register(&amp;amp;amp;m_gpiote_user_id,
                                    m_active_high_states_mask,
                                    m_active_low_states_mask,
                                    gpiote_event_handler);
if (err_code != NRF_SUCCESS)
{
    return err_code;
}

// Create polling timer.
return app_timer_create(&amp;amp;amp;m_detection_delay_timer_id,
                        APP_TIMER_MODE_SINGLE_SHOT,
                        detection_delay_timeout_handler);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to configure external pin interrupt with nRF51822?</title><link>https://devzone.nordicsemi.com/thread/9955?ContentTypeID=1</link><pubDate>Wed, 07 May 2014 13:25:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d7d843f-648f-4532-ab3b-d6d69b723094</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Jarmo,&lt;/p&gt;
&lt;p&gt;Most ble-* prefixed examples in the nRF51822 SDK uses a module called &amp;quot;app_button&amp;quot; which you can use to generate a pin-interrupt. See function &amp;quot;buttons_init&amp;quot; in ble_app_hids_mouse for instance.&lt;/p&gt;
&lt;p&gt;This library also includes a simple debounce (or detection delay as it&amp;#39;s called in the lib)&lt;/p&gt;
&lt;p&gt;Best regards
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>