Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pointing] Add uart based SpaceMouse Module support #22519

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix lint
Re-fix lint?!
  • Loading branch information
drashna committed Jun 10, 2024
commit 8b9ada2640210817e3166129db010bb22f7e6ba4
16 changes: 8 additions & 8 deletions drivers/sensors/spacemouse_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
#define SPACEMOUSE_LENGTH_PACKET (SPACEMOUSE_LENGTH_HEADER + SPACEMOUSE_LENGTH_DATA + SPACEMOUSE_LENGTH_CHECKSUM + SPACEMOUSE_LENGTH_FOOTER)

enum spacemouse_commands {
SPACEMOUSE_CMD_REQUEST_DATA = 0xAC,
SPACEMOUSE_CMD_SET_ZERO_POSITION = 0xAD,
SPACEMOUSE_CMD_AUTO_DATA_ON = 0xAE,
SPACEMOUSE_CMD_AUTO_DATA_OFF = 0xAF,
SPACEMOUSE_CMD_END = 0x8D,
SPACEMOUSE_DATA_REQUEST_START = 0x96,
SPACEMOUSE_CMD_REQUEST_DATA = 0xAC,
SPACEMOUSE_CMD_SET_ZERO_POSITION = 0xAD,
SPACEMOUSE_CMD_AUTO_DATA_ON = 0xAE,
SPACEMOUSE_CMD_AUTO_DATA_OFF = 0xAF,
SPACEMOUSE_CMD_END = 0x8D,
SPACEMOUSE_DATA_REQUEST_START = 0x96,
};

typedef struct {
Expand All @@ -41,6 +41,6 @@ typedef struct {
int16_t tilt_y;
} spacemouse_data_t;

bool spacemouse_send_command(uint8_t cmd);
bool spacemouse_init(void);
bool spacemouse_send_command(uint8_t cmd);
bool spacemouse_init(void);
spacemouse_data_t spacemouse_get_data(void);
10 changes: 5 additions & 5 deletions quantum/pointing_device/pointing_device_drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) {
static uint16_t x = 0, y = 0, last_scale = 0;

# if defined(CIRQUE_PINNACLE_TAP_ENABLE)
mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, false, POINTING_DEVICE_BUTTON1);
mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, false, POINTING_DEVICE_BUTTON1);
# endif
# ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
cursor_glide_t glide_report = {0};
Expand Down Expand Up @@ -496,14 +496,14 @@ const pointing_device_driver_t pointing_device_driver = {

static bool spacemouse_present = false;

__attribute__((weak)) void spacemouse_module_handle_axises(spacemouse_data_t *spacemouse_data, report_mouse_t* mouse_report) {
#ifdef SPACEMOUSE_USE_TILT_AXIS
__attribute__((weak)) void spacemouse_module_handle_axises(spacemouse_data_t* spacemouse_data, report_mouse_t* mouse_report) {
drashna marked this conversation as resolved.
Show resolved Hide resolved
# ifdef SPACEMOUSE_USE_TILT_AXIS
mouse_report->x = CONSTRAIN_HID_XY(spacemouse_data->tilt_x);
mouse_report->y = CONSTRAIN_HID_XY(spacemouse_data->tilt_y);
#else
# else
mouse_report->x = CONSTRAIN_HID_XY(spacemouse_data->x);
mouse_report->y = CONSTRAIN_HID_XY(spacemouse_data->y);
#endif
# endif
}

static report_mouse_t spacemouse_get_report(report_mouse_t mouse_report) {
Expand Down