<?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 to Create an HID mouse application using nRF52DK board and few extra buttons?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38429/how-to-create-an-hid-mouse-application-using-nrf52dk-board-and-few-extra-buttons</link><description>Hi, 
 I have gone through the &amp;quot;ble_app_hids_mouse&amp;quot; example program. So far the program seems to work great, but how do we take control of the buttons since the function used only translates button press to mouse x-y translations. Please hep. Later i would</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 05 Sep 2018 12:33:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38429/how-to-create-an-hid-mouse-application-using-nrf52dk-board-and-few-extra-buttons" /><item><title>RE: How to Create an HID mouse application using nRF52DK board and few extra buttons?</title><link>https://devzone.nordicsemi.com/thread/148259?ContentTypeID=1</link><pubDate>Wed, 05 Sep 2018 12:33:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e7fb39f-93af-4b52-8def-de21280251b1</guid><dc:creator>hari911</dc:creator><description>&lt;p&gt;great, got the stuff working.&lt;/p&gt;
&lt;p&gt;Thanks Sigurd.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Hari&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Create an HID mouse application using nRF52DK board and few extra buttons?</title><link>https://devzone.nordicsemi.com/thread/148258?ContentTypeID=1</link><pubDate>Tue, 04 Sep 2018 13:19:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a01ff8eb-9db2-4642-996c-232c46fdb23d</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This post &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/9854/click-in-hid-mouse-example/36575#36575"&gt;here &lt;/a&gt;shows you how to add this functionality.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The function updated to SDK 15 looks like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void mouse_click_send(uint8_t x, uint8_t y, uint8_t z) 
{ 
    uint32_t err_code; uint8_t buffer[3]; 
    if (m_in_boot_mode) return; 

    buffer[0] = x; // Left button (bit 0) pressed
    buffer[1] = y; // Scroll value (-127, 128)
    buffer[2] = z; // Sideways scroll value (-127, 128)

    err_code = ble_hids_inp_rep_send(&amp;amp;m_hids,INPUT_REP_BUTTONS_INDEX, INPUT_REP_BUTTONS_LEN, buffer,m_conn_handle);
    if ((err_code != NRF_SUCCESS) &amp;amp;&amp;amp;
        (err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp;
        (err_code != NRF_ERROR_RESOURCES) &amp;amp;&amp;amp;
        (err_code != NRF_ERROR_BUSY) &amp;amp;&amp;amp;
        (err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING)
       )
    {
                    APP_ERROR_CHECK(err_code);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is the list of values:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0x00 - No buttons pressed

0x01 - Left button pressed

0x02 - Right button pressed

0x03 - Both left and right button pressed&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To make a left click you call mouse_click_send(1,0,0); don&amp;#39;t forget to release the key press by calling: mouse_click_send(0,0,0);&lt;/p&gt;
&lt;p&gt;You can test this on with button 4 (BSP_KEY_3) in bsp_event_handler() function like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;case BSP_EVENT_KEY_3:
if (m_conn_handle != BLE_CONN_HANDLE_INVALID)
{
//mouse_movement_send(0, MOVEMENT_SPEED);
mouse_click_send(1,0,0); //Click
mouse_click_send(0,0,0); //Release
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>