<?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>pin change interrupt with nrf52 and s132</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19413/pin-change-interrupt-with-nrf52-and-s132</link><description>Hello, 
 I want to know what is the correct way to use GPIOTE while my softdevice is running.
I have referred the example of pin_change_interrupt that is provided with SDK12.1, which runs as expected, but if I am writing that code to my main.c which</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 03 Feb 2017 08:30:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19413/pin-change-interrupt-with-nrf52-and-s132" /><item><title>RE: pin change interrupt with nrf52 and s132</title><link>https://devzone.nordicsemi.com/thread/75341?ContentTypeID=1</link><pubDate>Fri, 03 Feb 2017 08:30:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0d0f15b-2923-401c-b6e2-c9c41a947be9</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;first define
#define INTERRUPT_PIN   BUTTON_3&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;In main function

    nrf_drv_gpiote_init();
    nrf_drv_gpiote_out_config_t led_config = GPIOTE_CONFIG_OUT_TASK_LOW;
    nrf_drv_gpiote_out_init(LED_3, &amp;amp;led_config);

			  nrf_drv_gpiote_in_config_t config =
    {
     //   .sense = NRF_GPIOTE_POLARITY_LOTOHI,
		.sense =NRF_GPIOTE_POLARITY_TOGGLE, //NRF_GPIOTE_POLARITY_LOTOHI,
       .pull = NRF_GPIO_PIN_PULLUP  , //NRF_GPIO_PIN_NOPULL
			// .pull = NRF_GPIO_PIN_PULLUP ,
        .is_watcher = false,
        .hi_accuracy = false
    };
		
   
	  nrf_drv_gpiote_in_init(INTERRUPT_PIN, &amp;amp;config, gpiote_evt_handler);
		nrf_drv_gpiote_in_event_enable(INTERRUPT_PIN,true);




void gpiote_evt_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    switch(action)
    {
			 
      case    NRF_GPIOTE_POLARITY_TOGGLE:
            if(nrf_drv_gpiote_in_is_set(INTERRUPT_PIN))
            {  
            
								nrf_drv_gpiote_out_set(LED_3);
						
            }
            else							
            {  
						     nrf_drv_gpiote_out_clear(LED_3);
					
            }
            break;
        default:
          
            break;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pin change interrupt with nrf52 and s132</title><link>https://devzone.nordicsemi.com/thread/75340?ContentTypeID=1</link><pubDate>Fri, 03 Feb 2017 06:56:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c48b86a-ee03-4250-9257-b21c9e03ea21</guid><dc:creator>Anjali</dc:creator><description>&lt;p&gt;Yes. I have referred the pin change example from sdk 12.1&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pin change interrupt with nrf52 and s132</title><link>https://devzone.nordicsemi.com/thread/75339?ContentTypeID=1</link><pubDate>Fri, 03 Feb 2017 06:44:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d875f905-05f6-4152-899e-5dd9585da3bd</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;i think you want when interrupt occurs on input pin, LED toggles&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pin change interrupt with nrf52 and s132</title><link>https://devzone.nordicsemi.com/thread/75338?ContentTypeID=1</link><pubDate>Thu, 02 Feb 2017 11:21:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bb65d2c-4310-4313-bb2e-78a4f786a69f</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;your code should not be freezed. you can add timer2 or gpiote event handler. you should post your code&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>