<?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 can i set the key on my project board?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65988/how-can-i-set-the-key-on-my-project-board</link><description>I have a project bord which base on nrf9160, two buttons are set in the hardware circuit, corresponding to the pins of P26 and p15 respectively, and P07 is used as the interrupt. Now i find a problem, that is ncsv1.2.0 default P07 as a key on DK board</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Sep 2020 20:40:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65988/how-can-i-set-the-key-on-my-project-board" /><item><title>RE: How can i set the key on my project board?</title><link>https://devzone.nordicsemi.com/thread/270184?ContentTypeID=1</link><pubDate>Thu, 17 Sep 2020 20:40:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3fc9499-21b5-4bce-8063-dee85b44f3e9</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Ok, I see. How have you configured your board files? See &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/application/index.html#custom-board-devicetree-and-soc-definitions"&gt;this link&lt;/a&gt;. Have you based your project on a sample from NCS?&amp;nbsp;The code you have insterted, is this something you have from NCS?&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can i set the key on my project board?</title><link>https://devzone.nordicsemi.com/thread/269962?ContentTypeID=1</link><pubDate>Thu, 17 Sep 2020 01:23:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecd7bf60-ed81-4a9b-ad3d-43a962f1fe8d</guid><dc:creator>duxinglang</dc:creator><description>&lt;p&gt;No, i run the project on my own board, in this board, i use p07 as &lt;span&gt;an interrupt signal pin,&amp;nbsp;However, when the interrupt was triggered, I found that it was actually handled by the&amp;nbsp;button&amp;nbsp;handler function, i want to use my custom key, is not use the default button key(P06,P07,P08P,P09),&amp;nbsp;b&lt;/span&gt;ecause these pins have already been used for other purposes.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void button_handler(u32_t button_state, u32_t has_changed)
{
	int err_code;

	u32_t buttons = (button_state &amp;amp; has_changed);

	keycode = has_changed;
	keytype = button_state/has_changed;
	
	switch(keytype)
	{
	case KEY_DOWN:
		k_timer_start(&amp;amp;g_long_press_timer_id, K_MSEC(TIMER_FOR_LONG_PRESSED), K_NO_WAIT);
		break;
		
	case KEY_UP:
		k_timer_stop(&amp;amp;g_long_press_timer_id);
		break;

	case KEY_LONG_PRESS:
		break;
	}

	key_event_handler(keycode, keytype);
}

static void long_press_timer_handler(struct k_timer *timer)
{
    key_event_handler(keycode, KEY_LONG_PRESS);
}

void key_init(void)
{
	int err;

	printk(&amp;quot;key_init\n&amp;quot;);
	
	err = dk_buttons_init(button_handler);
	if (err)
	{
		printk(&amp;quot;Could not initialize buttons, err code: %d\n&amp;quot;, err);
		return;
	}

	k_timer_init(&amp;amp;g_long_press_timer_id, long_press_timer_handler, NULL);
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can i set the key on my project board?</title><link>https://devzone.nordicsemi.com/thread/269886?ContentTypeID=1</link><pubDate>Wed, 16 Sep 2020 13:15:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7741f221-0ccb-4be5-931e-08395626ada5</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;You are using a nRF9160DK to run your custom project or a sample project?&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrf91_dk/UG/nrf91_DK/board_controller.html"&gt;P06,P07,P08,P09 are controlled by board controller&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>