Include `pointing_device_send` in docs (#9185)
parent
437446ba8f
commit
573d1fbb92
|
@ -21,7 +21,11 @@ Keep in mind that a report_mouse_t (here "mouseReport") has the following proper
|
||||||
* `mouseReport.h` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing horizontal scrolling (+ right, - left).
|
* `mouseReport.h` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing horizontal scrolling (+ right, - left).
|
||||||
* `mouseReport.buttons` - this is a uint8_t in which the last 5 bits are used. These bits represent the mouse button state - bit 3 is mouse button 5, and bit 7 is mouse button 1.
|
* `mouseReport.buttons` - this is a uint8_t in which the last 5 bits are used. These bits represent the mouse button state - bit 3 is mouse button 5, and bit 7 is mouse button 1.
|
||||||
|
|
||||||
When the mouse report is sent, the x, y, v, and h values are set to 0 (this is done in "pointing_device_send()", which can be overridden to avoid this behavior). This way, button states persist, but movement will only occur once. For further customization, both `pointing_device_init` and `pointing_device_task` can be overridden.
|
Once you have made the necessary changes to the mouse report, you need to send it:
|
||||||
|
|
||||||
|
* `pointing_device_send()` - Sends the mouse report to the host and zeroes out the report.
|
||||||
|
|
||||||
|
When the mouse report is sent, the x, y, v, and h values are set to 0 (this is done in `pointing_device_send()`, which can be overridden to avoid this behavior). This way, button states persist, but movement will only occur once. For further customization, both `pointing_device_init` and `pointing_device_task` can be overridden.
|
||||||
|
|
||||||
In the following example, a custom key is used to click the mouse and scroll 127 units vertically and horizontally, then undo all of that when released - because that's a totally useful function. Listen, this is an example:
|
In the following example, a custom key is used to click the mouse and scroll 127 units vertically and horizontally, then undo all of that when released - because that's a totally useful function. Listen, this is an example:
|
||||||
|
|
||||||
|
@ -38,6 +42,7 @@ case MS_SPECIAL:
|
||||||
currentReport.buttons &= ~MOUSE_BTN1;
|
currentReport.buttons &= ~MOUSE_BTN1;
|
||||||
}
|
}
|
||||||
pointing_device_set_report(currentReport);
|
pointing_device_set_report(currentReport);
|
||||||
|
pointing_device_send();
|
||||||
break;
|
break;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue