<?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>clear external interrupt</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11361/clear-external-interrupt</link><description>link text from this post i am generating interrupt using button 3. when i push my button,interrupt generates,LED turn on. but after turning on LED, i want to clear interrupt. so LED become off.here i don&amp;#39;t want to use nrf_drv_gpiote_out_toggle(); function</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Jan 2016 14:44:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11361/clear-external-interrupt" /><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42813?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 14:44:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d50c930e-e44e-4d88-abd1-d288630f9735</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;ok thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42812?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 14:41:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f187300-25fa-4f68-a71f-13d638a02fa7</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;No, the pin that detects a change in its logic level first will generate an interrupt first, which in turn is handled by &lt;code&gt;gpiote_evt_handler&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42811?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 13:58:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38b24385-4b29-4a6f-a070-065616fc87a9</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;then interrupt for INTERRUPT_PIN will be served first&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42810?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 13:57:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4af14cc-2a4e-4fc7-89ff-61d629f1ab87</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;ret_code = nrf_drv_gpiote_in_init(INTERRUPT_PIN, &amp;amp;config, gpiote_evt_handler);
ret_code = nrf_drv_gpiote_in_init(INTERRUPT_PIN1, &amp;amp;config, gpiote_evt_handler);&lt;/p&gt;
&lt;p&gt;like if i have defined two interrupt for INTERRUPT_PIN,INTERRUPT_PIN1&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42809?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 13:51:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a23ef42e-06e4-4328-bad9-f49d1b833833</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;You can&amp;#39;t. The interrupt that is detected first is handled first.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42808?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 13:48:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9986134b-7a92-4618-99c4-20ddf2e85bd0</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;yes. I am saying about it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42807?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 13:45:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d26335c2-6eb2-42ae-8673-b339f4665e22</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Do you mean setting which interrupt that should be handled first?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42806?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 12:54:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27d8cb39-3f55-417d-8c78-eefd0dbff5fc</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;ok. i have defined two external interrupt. can you tell me how to assign priority to interrupt??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42805?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2016 09:49:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b359a39-c0b9-42dd-adba-9a88f60e380f</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;You do not need the delay. When you call&lt;code&gt;sd_power_system_off()&lt;/code&gt; the chip will be in SYSTEM OFF mode untill it is woken-up. In System OFF the chip will only wake-up if the level on an input pin(i.e. pin that has sense enabled) goes from &lt;strong&gt;Low&lt;/strong&gt; to &lt;strong&gt;High&lt;/strong&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42804?ContentTypeID=1</link><pubDate>Tue, 19 Jan 2016 14:43:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7de5a855-1db4-42e8-b9cf-0093bfd8bc65</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;can we set like that interrupt&amp;#39;s certain condition run for certain time??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42803?ContentTypeID=1</link><pubDate>Tue, 19 Jan 2016 14:32:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb8d3210-6a9a-49d0-b278-b17ac7559623</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;hello there i have updated code.
my problem :
when i press button LED turn on,and i release button, LED turn off.  now i want to run else condition more time. so i add delay. so now when i release button after some delay LED off.&lt;/p&gt;
&lt;p&gt;now i am doing same thing for sd_power_system_off(). but my nrf51822 don&amp;#39;t off for same time that LED takes. can you tell me solution??&lt;/p&gt;
&lt;p&gt;so my main aim is to put nrf51822 in system off mode for more time&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42802?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2016 15:26:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb4109fc-5e88-440b-907d-e3253c5e63f3</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Happy to help. Yes, if you want to put the chip in SYSTEM OFF mode( i.e. the chip can only woken up by changing the pin level of an input pin externally) then the above code should work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42801?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2016 15:10:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5303fbf3-f920-4124-8c98-a8f7d9ece780</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;your answers helped me lot in learning nrf51822. thanks for it. nordic team is very helpful&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42800?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2016 15:07:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b17814b1-eae6-427a-a112-1acf65c25acd</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;void delay_ms(unsigned int k)
{&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;unsigned int i,j;


for(i=0;i&amp;lt;12750; i++)
{

for(j=0;j&amp;lt;i;j++); }
}

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);
				       sd_power_system_off();
             
								delay_ms(10000000);
						   delay_ms(10000000);
            }
            break;
        default:
           
            break;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42799?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2016 15:04:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0c41932-6946-46cd-b76f-015a200ab500</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;one more question. i want to put in ble in sleep mode  using button&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42798?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2016 15:03:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:151ec286-6e0a-4eb0-97a0-5a61fcb86928</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;thanks its working&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42797?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2016 14:59:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c212bd7-1248-444c-81a6-628733d3b7f2</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;You have to set the input pin to generate events on both High-to-Low and Low-to-High transitions(&lt;code&gt;NRF_GPIOTE_POLARITY_TOGGLE&lt;/code&gt;). In the event handler you have to check if the pin is set( i.e. HIGH ) or not and based on that clear or set the LED.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;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:
            //do nothing
            break;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;MAIN:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In main you have to configure the input pin to generate the &lt;code&gt;NRF_GPIOTE_POLARITY_TOGGLE&lt;/code&gt;event when the pin state is changed.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main(void)
{
    
    ret_code_t ret_code;
    
    // Initialize the GPIOTE Peripheral 
    ret_code = nrf_drv_gpiote_init();
    APP_ERROR_CHECK(ret_code);
    
    // Configure LED_3 pin as output
    nrf_drv_gpiote_out_config_t led_config = GPIOTE_CONFIG_OUT_TASK_LOW;
    
    // Initialize LED_3 pin as output
    ret_code =  nrf_drv_gpiote_out_init(LED_3, &amp;amp;led_config);
    APP_ERROR_CHECK(ret_code);
    
    
    
    // Configuration for Interrupt Pin
    nrf_drv_gpiote_in_config_t config =
    {
        .sense = NRF_GPIOTE_POLARITY_TOGGLE, 
        .pull = NRF_GPIO_PIN_PULLUP , 
        .is_watcher = false,
        .hi_accuracy = false
    };
        
    // Initialize Interrupt Pin
    ret_code = nrf_drv_gpiote_in_init(INTERRUPT_PIN, &amp;amp;config, gpiote_evt_handler);
    APP_ERROR_CHECK(ret_code);
    
    // Enable Interrupts from interrupt pin
    nrf_drv_gpiote_in_event_enable(INTERRUPT_PIN,true);
    
    
    while (true)
    {
        // Do nothing.
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42796?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2016 14:54:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:431d3201-713d-4f95-98cd-615bd9393b15</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;i also tried NRF_GPIOTE_POLARITY_TOGGLE. but its not working for me&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42795?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2016 14:25:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64e2aac6-78b0-4a9e-92a8-4a263aec2c02</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;can&amp;#39;t i make another case&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;case NRF_GPIOTE_POLARITY_LOTOHI:
					 nrf_drv_gpiote_out_set(LED_3);
				 break;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;service routine??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42794?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2016 13:50:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a33d79fa-319e-4429-94bc-7bd20f1a3b26</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;when i press button. interrupt generates and LED become on.but i want when button returns to its normal position LED become off. i don&amp;#39;t want to use toggle function&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42793?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2016 13:47:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ef9852e-dbf4-4ac8-b6ba-9ac4e7c89bed</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;i know that. but i want to clear interrupt automatically.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42792?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2016 12:37:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17f7dbcf-de15-4b58-8fde-8ee2081949a6</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The leds on the nRF51 DK are active low, i.e. if the LED pin is high the led is OFF and if the LED pin is low the led is ON. This means that you have to use &lt;code&gt;nrf_drv_gpiote_out_set(LED_3)&lt;/code&gt; to turn off the led.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42791?ContentTypeID=1</link><pubDate>Sun, 17 Jan 2016 13:57:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2484b78-1bd4-4a31-9089-2f9de92c9f64</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;can you tell me how to clear interrupt automatically?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: clear external interrupt</title><link>https://devzone.nordicsemi.com/thread/42790?ContentTypeID=1</link><pubDate>Sun, 17 Jan 2016 13:56:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fd07345-a4f7-46d6-9b96-e742ab4abd57</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;int main(void)
{
uint32_t err_code;
bool erase_bonds;
ret_code_t ret_code;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        // Initialize.
     
        ble_stack_init();
        gap_params_init();
        services_init();
        advertising_init();
    	advertising_start();
        conn_params_init();
        
       
       
         ret_code = nrf_drv_gpiote_init();
       // APP_ERROR_CHECK(ret_code);
        
        // Configure LED_1 pin as output
        nrf_drv_gpiote_out_config_t led_config = GPIOTE_CONFIG_OUT_TASK_LOW;
        
        // Initialize LED_1 pin as output
        ret_code =  nrf_drv_gpiote_out_init(LED_3, &amp;amp;led_config);
      //  APP_ERROR_CHECK(ret_code);
    	    nrf_drv_gpiote_in_config_t config =
        {
            .sense = NRF_GPIOTE_POLARITY_HITOLO,
    			//.sense = NRF_GPIOTE_POLARITY_LOTOHI,
            .pull = NRF_GPIO_PIN_PULLUP , // NRF_GPIO_PIN_NOPULL
    		//.pull = NRF_GPIO_PIN_NOPULL ,
            .is_watcher = false,
            .hi_accuracy = false
        };
            
        // Initialize Interrupt Pin
        ret_code = nrf_drv_gpiote_in_init(INTERRUPT_PIN, &amp;amp;config, gpiote_evt_handler);
      APP_ERROR_CHECK(ret_code);
        
        // Enable Interrupts from interrupt pin
       nrf_drv_gpiote_in_event_enable(INTERRUPT_PIN,true);
        // Enter main loop.
        while(true)
        { 
           	
        }

}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>