Choose the matching HID profile in the tool, then send a complete report with the layout below. After each USB send, check USB_Result.
Select Boot mouse and use exactly three bytes:
|
Byte |
Meaning |
|
0 |
Bits 0–2: left, right and middle button; other bits zero |
|
1 |
Signed relative X movement, −127 to +127 |
|
2 |
Signed relative Y movement, −127 to +127 |
For no buttons, +5 X and −5 Y:
Clear TXReport
TXReport[1] = 5
TXReport[2] = 251 ' Two's-complement byte for -5
USB_WriteWait(3, 20)
Check USB_Result after sending. X and Y tell the PC how far to move from the current position; they are not screen coordinates. Sending the same report again moves the pointer again. Set the movement bytes to zero when no movement is wanted. Set a button bit to zero to release it.
When the library repeats an idle report, it keeps the button state but clears the X/Y movement. An idle timeout therefore does not repeat the last move.
Select Joystick, clear the report, fill the current state and send six bytes:
|
Bytes |
Meaning |
|
0, 1, 2, 3 |
Signed X, Y, Z and Rz; each −127 to +127, zero centred |
|
4 |
Button bits 0–7 represent buttons 1–8 |
|
5 |
Button bits 0–7 represent buttons 9–16 |
Send a complete state when an axis or button changes. Returning a button bit to zero releases it. Unlike mouse movement, joystick axes describe positions, so the same report keeps the same position.
Select Consumer control. Put one 16-bit Consumer usage in bytes 0–1, low byte first, and send two bytes. The descriptor permits usages 0–1023. Common examples are $00E9 Volume Increment, $00EA Volume Decrement, $00E2 Mute and $00CD Play/Pause; see the USB-IF HID Usage Tables for other usages. Send an all-zero report to release the control, using the same press/release checks as the keyboard. How an action is handled depends on the host and application.
Created with the Personal Edition of HelpNDoc: Revolutionize Your Documentation Output with a Help Authoring Tool