<?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>Lets just stick to GPIO?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10590/lets-just-stick-to-gpio</link><description>Lets just stick to GPIO 
 
 
 I am trying to initialize multiple input buttons and multiple output LEDS. 
 
 
 I am trying to glow the LEDS with corresponding buttons. ex:- button 0 glows led0 and so on. 
 // Here i can only initialize single input</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Dec 2015 09:56:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10590/lets-just-stick-to-gpio" /><item><title>RE: Lets just stick to GPIO?</title><link>https://devzone.nordicsemi.com/thread/39420?ContentTypeID=1</link><pubDate>Thu, 03 Dec 2015 09:56:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7383ea2-65ea-4bd4-a5f4-3d64adf69c2b</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;&lt;strong&gt;Do not&lt;/strong&gt; change the entire question! This will make it hard for other people to read the post, or the whole answer will have to be edited (like in this case). If you are editing your question (adding information etc) this should be done with &amp;quot;EDIT: {new info}&amp;quot;. If you are just formatting the question, there is no need to state it. If you are changing the whole question to something else, please post another one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lets just stick to GPIO?</title><link>https://devzone.nordicsemi.com/thread/39421?ContentTypeID=1</link><pubDate>Wed, 02 Dec 2015 12:03:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87dc0921-5db1-4753-afc2-df8966ecaf27</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;This should fix your example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main(void)
{
    //BSP_LED0 and BSP_BUTTON_0 is defined in boards.h file
    
    nrf_gpio_cfg_output(BSP_LED_0);
    nrf_gpio_cfg_input(BSP_BUTTON_0, NRF_GPIO_PIN_PULLUP);
    
    while (true)
    {
        if(nrf_gpio_pin_read(BSP_BUTTON_0) == 0)
        {
            nrf_gpio_pin_toggle(BSP_LED_0);
            nrf_delay_ms(500);
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A better solution is to use PPI, this code will set that up:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void button_led_ppi_init()
{
    uint32_t gpiote_event_addr;
    uint32_t gpiote_task_addr;
    nrf_ppi_channel_t ppi_channel;
    ret_code_t err_code;
    
    //init GPIOTE driver
    if(!nrf_drv_gpiote_is_init())
    {
        err_code = nrf_drv_gpiote_init();
        APP_ERROR_CHECK(err_code);
    }
    
    //LED
    nrf_drv_gpiote_out_config_t config = GPIOTE_CONFIG_OUT_TASK_TOGGLE(true);

    err_code = nrf_drv_gpiote_out_init(BSP_LED_0, &amp;amp;config);
    APP_ERROR_CHECK(err_code);
    
    nrf_drv_gpiote_out_task_enable(BSP_LED_0);
    
    //BUTTON
    nrf_drv_gpiote_in_config_t event_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
    event_config.pull = NRF_GPIO_PIN_PULLUP;
    
    err_code = nrf_drv_gpiote_in_init(BSP_BUTTON_0, &amp;amp;event_config, NULL);
    APP_ERROR_CHECK(err_code);
    
    nrf_drv_gpiote_in_event_enable(BSP_BUTTON_0, true);
    
    //PPI
    err_code = nrf_drv_ppi_channel_alloc(&amp;amp;ppi_channel);
    APP_ERROR_CHECK(err_code);
    
    gpiote_task_addr = nrf_drv_gpiote_out_task_addr_get(BSP_LED_0);
    gpiote_event_addr = nrf_drv_gpiote_in_event_addr_get(BSP_BUTTON_0);
    
    err_code = nrf_drv_ppi_channel_assign(ppi_channel, gpiote_event_addr, gpiote_task_addr);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_ppi_channel_enable(ppi_channel);
    APP_ERROR_CHECK(err_code);
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>