Apply suggestions from code review

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
This commit is contained in:
Drashna Jaelre 2023-11-21 03:41:05 -08:00 committed by Drashna Jael're
parent bcc63f3a63
commit 69f31be5c1
No known key found for this signature in database
GPG Key ID: DBA1FD3A860D1B11
2 changed files with 6 additions and 6 deletions

View File

@ -376,17 +376,17 @@ To use the SpaceMouse module to control the pointer, add this to your `rules.mk`
POINTING_DEVICE_DRIVER = spacemouse_module POINTING_DEVICE_DRIVER = spacemouse_module
``` ```
The SpaceMouse Module is a UART driven sensor, with 6 axises of motion. The SpaceMouse Module is a UART driven sensor, with 6 axes of motion.
| Setting (`config.h`) | Description | Default | | Setting (`config.h`) | Description | Default |
| ---------------------------- | ------------------------------------------------------------------------------------------- | ------------- | | ---------------------------- | ------------------------------------------------------------------------------------------- | ------------- |
| `SPACEMOUSE_USE_TILT_AXIS` | Uses the tilt axises for movement rather than the shift axises. | _not_defined_ | | `SPACEMOUSE_USE_TILT_AXIS` | Uses the tilt axes for movement rather than the shift axes. | _not_defined_ |
By default, not all of the axises are utilized. If you would like to use more of them, you can do so by using this custom function, which translates the data from the SpaceMouse Module to the pointing device report. By default, not all of the axes are utilized. If you would like to use more of them, you can do so by using this custom function, which translates the data from the SpaceMouse Module to the pointing device report.
```c ```c
void spacemouse_module_handle_axises(spacemouse_data_t *spacemouse_data, report_mouse_t* mouse_report) { void spacemouse_module_handle_axes(spacemouse_data_t *spacemouse_data, report_mouse_t* mouse_report) {
mouse_report->x = CONSTRAIN_HID_XY(spacemouse_data->x); mouse_report->x = CONSTRAIN_HID_XY(spacemouse_data->x);
mouse_report->y = CONSTRAIN_HID_XY(spacemouse_data->y); mouse_report->y = CONSTRAIN_HID_XY(spacemouse_data->y);
mouse_report->h = CONSTRAIN_HID(spacemouse_data->b); mouse_report->h = CONSTRAIN_HID(spacemouse_data->b);

View File

@ -496,7 +496,7 @@ const pointing_device_driver_t pointing_device_driver = {
static bool spacemouse_present = false; static bool spacemouse_present = false;
__attribute__((weak)) void spacemouse_module_handle_axises(spacemouse_data_t* spacemouse_data, report_mouse_t* mouse_report) { __attribute__((weak)) void spacemouse_module_handle_axes(spacemouse_data_t* spacemouse_data, report_mouse_t* mouse_report) {
# ifdef SPACEMOUSE_USE_TILT_AXIS # ifdef SPACEMOUSE_USE_TILT_AXIS
mouse_report->x = CONSTRAIN_HID_XY(spacemouse_data->tilt_x); mouse_report->x = CONSTRAIN_HID_XY(spacemouse_data->tilt_x);
mouse_report->y = CONSTRAIN_HID_XY(spacemouse_data->tilt_y); mouse_report->y = CONSTRAIN_HID_XY(spacemouse_data->tilt_y);
@ -513,7 +513,7 @@ static report_mouse_t spacemouse_get_report(report_mouse_t mouse_report) {
if (data.x || data.y || data.z || data.twist || data.tilt_x || data.tilt_y) { if (data.x || data.y || data.z || data.twist || data.tilt_x || data.tilt_y) {
pd_dprintf("Raw ] X: %d, Y: %d, Z: %d, twist: %d, tilt X: %d, tilt Y: %d\n", data.x, data.y, data.z, data.twist, data.tilt_x, data.tilt_y); pd_dprintf("Raw ] X: %d, Y: %d, Z: %d, twist: %d, tilt X: %d, tilt Y: %d\n", data.x, data.y, data.z, data.twist, data.tilt_x, data.tilt_y);
} }
spacemouse_module_handle_axises(&data, &mouse_report); spacemouse_module_handle_axes(&data, &mouse_report);
} }
return mouse_report; return mouse_report;
} }