<?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 are keyboard key release events sent in example code?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4375/how-are-keyboard-key-release-events-sent-in-example-code</link><description>Hello, 
 I&amp;#39;m trying to understand how the ble_app_hids_keyboard example works. So far, I have hooked up a few more buttons to the board and can type hello. 
 Now, I would like to have it function more like a real keyboard - including being able to hold</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 12 Nov 2014 15:32:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4375/how-are-keyboard-key-release-events-sent-in-example-code" /><item><title>RE: how are keyboard key release events sent in example code?</title><link>https://devzone.nordicsemi.com/thread/15542?ContentTypeID=1</link><pubDate>Wed, 12 Nov 2014 15:32:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:093be4ed-6c63-42fb-93b2-52c7de8d86f7</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This example is a bit complex, especially when it&amp;#39;s only purpose is to say &amp;quot;hello&amp;quot; via button press.&lt;/p&gt;
&lt;p&gt;First off, you will get an interrupt when the button is pressed, triggering function &amp;quot;button_event_handler&amp;quot;, which saves which byte is currently being sent (p_key), and passed on to function send_keys().&lt;/p&gt;
&lt;p&gt;Send_keys() will send, over-the-air, the first ASCII letter packed into a HID-acceptable format, which is done by calling &amp;quot;send_key_scan_press_release()&amp;quot;.&lt;/p&gt;
&lt;p&gt;If this function returns w/o errors, you will queue a &amp;quot;release key&amp;quot; (all zeros) via function &amp;quot;buffer_enqueue()&amp;quot;, and then it&amp;#39;ll return.&lt;/p&gt;
&lt;p&gt;Once the initial ASCII byte is successfully transferred over-the-air, you will get a event back from the SoftDevice, BLE_EVT_TX_COMPLETE in function on_ble_evt(), which then sends the previously enqueued release keys.&lt;/p&gt;
&lt;p&gt;If you are developing a keyboard application with the nRF51x22, I would recommend that you look at the &lt;a href="https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRFready-Desktop-2-Reference-Design"&gt;nRFready Desktop 2 reference design&lt;/a&gt; and how the scanning of the keyboard matrix is done there.
The ble_app_hids_keyboard example does not give any insight towards setting up a keyboard matrix. It&amp;#39;s purpose is to show the setup of the HoG (HID over GATT) profile as a keyboard.&lt;/p&gt;
&lt;p&gt;Cheers,
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>