<?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>Understanding hid mouse example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38280/understanding-hid-mouse-example</link><description>Hi, 
 I&amp;#39;m trying to understand mouse_movement_send() function in HID mouse example. Can you please explain what is exactly happening inside this function? 
 I also didnt understand the following lines- 
 buffer[0] = x_delta &amp;amp; 0x00ff; buffer[1] = ((y_delta</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 07 Sep 2018 15:23:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38280/understanding-hid-mouse-example" /><item><title>RE: Understanding hid mouse example</title><link>https://devzone.nordicsemi.com/thread/147844?ContentTypeID=1</link><pubDate>Fri, 07 Sep 2018 15:23:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd7cc82f-2107-4b23-a36c-60c1bfdab922</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You need to look at the full else block in order to understand what is going on.&lt;/p&gt;
&lt;p&gt;What I read from the code, is that the mouse movement HID report has two 12 bit fields for x and y movement. The lines that you posted takes the 12 least significant bits from each of x_delta and y_delta, and packs them after each other in a 24 bit buffer (i.e. a buffer of three bytes).&lt;/p&gt;
&lt;p&gt;&amp;lt;&amp;lt; and &amp;gt;&amp;gt; are bitwise shift operators, which are commonly used for bit manipulation in C. I recommend reading up on &amp;quot;bitwise operators&amp;quot; and &amp;quot;bit manipulation&amp;quot;, in order to understand what is going on. (A web search for those terms should point you to pages teaching you all about them.)&lt;/p&gt;
&lt;p&gt;I am sorry but we do not have any step-by-step code walk-through of the HID examples.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>