<?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>Using more than 4 buttons with GPIOTE interrupts</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8198/using-more-than-4-buttons-with-gpiote-interrupts</link><description>Hi, 
 I am using GPIOTE interrupts to detect button presses. It works fine but there are only four channels in GPIOTE-&amp;gt;EVENTS_IN[] and each channel can only be assigned to one pin. How should I do if I want to implement more than 4 buttons? 
 Basically</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 09 Apr 2016 07:27:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8198/using-more-than-4-buttons-with-gpiote-interrupts" /><item><title>RE: Using more than 4 buttons with GPIOTE interrupts</title><link>https://devzone.nordicsemi.com/thread/29492?ContentTypeID=1</link><pubDate>Sat, 09 Apr 2016 07:27:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3962916-8905-46bb-94fa-193ab52dce4e</guid><dc:creator>Jeong Hyun Seok</dc:creator><description>&lt;p&gt;could you specify the port event example?
I cannot find any example, yet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using more than 4 buttons with GPIOTE interrupts</title><link>https://devzone.nordicsemi.com/thread/29498?ContentTypeID=1</link><pubDate>Mon, 03 Aug 2015 17:32:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8abd44e6-43cb-4ab8-a9be-3ceb8c247a7a</guid><dc:creator>gammarui</dc:creator><description>&lt;p&gt;I found the error. I was missing extern &amp;quot;C&amp;quot; around my interrupt function, I should have mentioned that I was programming in C++, sorry for that. Anyway, now it finally works :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using more than 4 buttons with GPIOTE interrupts</title><link>https://devzone.nordicsemi.com/thread/29497?ContentTypeID=1</link><pubDate>Tue, 28 Jul 2015 06:43:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9bc7c957-669f-4835-b71d-092420a0e517</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;did you try running this in debugger, click the run button for few seconds and then click stop. Debugger will tell you where the code is stuck, that should give you clear hints.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using more than 4 buttons with GPIOTE interrupts</title><link>https://devzone.nordicsemi.com/thread/29496?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2015 06:30:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e90fdf01-6f7f-4ede-ae81-6ad83bc6ef79</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;sorry for late reply, you need to debug this, where did it get stuck? i cannot see anycode here where it can get stuck. What you have written is a valid code(except that your green led will be toggled for any port event) and should be enough to fulfill your purpose.
The only example i found is in the app_gpiote library, check how they use port events&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nRF51_SDK_9.0.0_5fc2c3a\components\libraries\gpiote\app_gpiote_fast_detect.c
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using more than 4 buttons with GPIOTE interrupts</title><link>https://devzone.nordicsemi.com/thread/29495?ContentTypeID=1</link><pubDate>Fri, 24 Jul 2015 08:00:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72518691-5459-4fbe-9987-c3ea9b4eba40</guid><dc:creator>gammarui</dc:creator><description>&lt;p&gt;Hi Aryan, yes, that is basically all code. Made some modifications and used nrf_gpio_cfg_output and  nrf_gpio_pin_toggle instead of my own gpio functions and added&lt;/p&gt;
&lt;p&gt;NVIC_ClearPendingIRQ(GPIOTE_IRQn);
NVIC_SetPriority(GPIOTE_IRQn, 3);&lt;/p&gt;
&lt;p&gt;before NCIV_EnableIRQ(GPIOTE_IRQn);&lt;/p&gt;
&lt;p&gt;but I still get the same result. I am not using APP_ERROR_CHECK or any softdevice.&lt;/p&gt;
&lt;p&gt;I also have a hard time understanding how it can get stuck. I read that SENSE is used to wake up the nrf, could it be that it does something to the power state of the CPU? Or could it be that the interrupt is called continuously of some reason blocking the execution of the program?&lt;/p&gt;
&lt;p&gt;Can you recommend any good examples where the PORT event is used to read buttons?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using more than 4 buttons with GPIOTE interrupts</title><link>https://devzone.nordicsemi.com/thread/29494?ContentTypeID=1</link><pubDate>Thu, 23 Jul 2015 16:06:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09db3094-0770-447b-acb4-3499c7f88be6</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;is this your full code?, it cannot get stuck here.
Is there any part of your code that has APP_ERROR_CHECK? are you doing anything else apart from this with BLE?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using more than 4 buttons with GPIOTE interrupts</title><link>https://devzone.nordicsemi.com/thread/29493?ContentTypeID=1</link><pubDate>Thu, 23 Jul 2015 14:06:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85362452-c4af-47e0-a493-6893edfe73e7</guid><dc:creator>gammarui</dc:creator><description>&lt;p&gt;Hi Aryan,&lt;/p&gt;
&lt;p&gt;Thanks for your reply. I tried using port but I am having som problems with it. In my test program I want to use one button to toggle a green LED. In a while loop a red LED is blinking. When I press the button the green LED is not toggled and the red LED stops blinking, I interpret that as that the program is stuck somewhere. I can&amp;#39;t figure out why this does not work. Can you see the problem in my code?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void GPIOTE_IRQHandler(void) {
  // If PORT event has been called, clear event and toggle LED
  if (NRF_GPIOTE-&amp;gt;EVENTS_PORT) {
    NRF_GPIOTE-&amp;gt;EVENTS_PORT = 0;

    pinToggle(LED_GREEN);
  }
}

int main() {
  setupLEDPins();

  // Set Menu button as input
  nrf_gpio_cfg_input(BUTTON_MENU_PIN, NRF_GPIO_PIN_NOPULL);

  // Enable sense on the Menu button
  nrf_gpio_cfg_sense_input(BUTTON_MENU_PIN, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW);

  // Set the GPIOTE PORT event as interrupt source
  NRF_GPIOTE-&amp;gt;INTENSET = GPIOTE_INTENSET_PORT_Msk;

  // Enable interrupts for GPIOTE
  NVIC_EnableIRQ(GPIOTE_IRQn);

  // Toggle red LED to show life sign
  while (1) {
    pinToggle(LED_RED);
    delayMs(100);
  }
  return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using more than 4 buttons with GPIOTE interrupts</title><link>https://devzone.nordicsemi.com/thread/29491?ContentTypeID=1</link><pubDate>Fri, 17 Jul 2015 10:33:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:948ae115-cf56-491c-93d0-d65cff2ff2cf</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;instead of using GPIOTE channels use GPIOTE-&amp;gt;PORT event, then you can have 31 buttons ..
There are lot of examples for this. In GPIOTE_IRQHandler, you have to remember previous pin state to see which pin has changed state.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>