SWRA715 December   2021 CC2642R , CC2652R

 

  1.   Trademarks
  2. 1Introduction
  3. 2Bluetooth Low Energy Introduction
  4. 3HOGP Introduction
    1. 3.1 HID Roles
    2. 3.2 HID Host
    3. 3.3 HID Device
  5. 4Project Description and Walkthrough
    1. 4.1  General Project Discussion
    2. 4.2  Report Map Discussion
    3. 4.3  Hid_input struct/union Discussion
    4. 4.4  Mouse Operation
    5. 4.5  Keyboard Operation
    6. 4.6  Consumer Report Operation
    7. 4.7  Connection Interval
    8. 4.8  Notification System
    9. 4.9  PDU Size and Number of PDUs per Connection Event
    10. 4.10 Notification Payload Discussion
      1. 4.10.1 Mouse Notification
      2. 4.10.2 Keyboard Notification
      3. 4.10.3 Consumer Report Notification
    11. 4.11 Throughput Discussion
    12. 4.12 Overall Block Diagrams
  6. 5Demo Usage
    1. 5.1 Hardware/Software Used
    2. 5.2 Mouse Demo Usage
    3. 5.3 Keyboard and Consumer Report Demo Usage
  7. 6Summary

Mouse Operation

The hid_emu_kbd implements HID mouse operations. The mouse operation is implemented through the use of the hid_input union. The mouse input data that this program is considering is the mouse buttons, the relative horizontal (x) position, the relative vertical (y) position, and the mouse wheel. The buttons member of the mouse structure and it consists of 8 bits. In the report map, the USAGE_MINIMUM and USAGE_MAXIMUM fields mark that the left mouse button, middle mouse button, and right mouse button are the buttons that the mouse will implement. Bit 0 corresponds to the right mouse button, bit 1 corresponds to the middle mouse button, and bit 2 corresponds to the left mouse button. Additional buttons may be added if the use-case requires it. To indicate a button being pressed, the relevant bit should be set and to signify a button not being pressed the relevant bit should be cleared.

The mouse movement portion of the mouse operation is a bit more complicated. A relative movement value is provided to the deltaX and deltaY members. Both of these members are signed 16-bit values each. This can be seen in the report map as well as the data type used for the deltaX and deltaY members. The values accepted range from -255 to 254. The mouse section of the report map is shown in Figure 4-1.

Once the mouse data has been packaged in a hid_input variable within the mouse structure, the HidEmuKbd_sendMouseInput() function may be called to send the actual mouse input to the HID Host. Its parameter would be the hid_input variable. In this project, this is all done in the demo portion within the HidEmuKbd_mouseTaskFxn() function through the use of events, messages, and semaphores. This can be changed and modified as needed.