forked from zmkfirmware/zmk
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! feat(mouse): Add mouse move and scroll support
- Loading branch information
1 parent
a072dd7
commit c562284
Showing
79 changed files
with
234 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,9 @@ | ||
|
||
/* | ||
* Copyright (c) 2023 The ZMK Contributors | ||
* Copyright (c) 2024 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
#pragma once | ||
|
||
#include <zephyr/dt-bindings/dt-util.h> | ||
|
||
/* Mouse press behavior */ | ||
/* Left click */ | ||
#define MB1 BIT(0) | ||
#define LCLK (MB1) | ||
|
||
/* Right click */ | ||
#define MB2 BIT(1) | ||
#define RCLK (MB2) | ||
|
||
/* Middle click */ | ||
#define MB3 BIT(2) | ||
#define MCLK (MB3) | ||
|
||
#define MB4 BIT(3) | ||
#define MB5 BIT(4) | ||
|
||
#ifndef ZMK_MOUSE_DEFAULT_MOVE_VAL | ||
#define ZMK_MOUSE_DEFAULT_MOVE_VAL 600 | ||
#endif | ||
|
||
#ifndef ZMK_MOUSE_DEFAULT_SCRL_VAL | ||
#define ZMK_MOUSE_DEFAULT_SCRL_VAL 10 | ||
#endif | ||
|
||
/* Mouse move behavior */ | ||
#define MOVE_Y(vert) ((vert) & 0xFFFF) | ||
#define MOVE_Y_DECODE(encoded) (int16_t)((encoded) & 0x0000FFFF) | ||
#define MOVE_X(hor) (((hor) & 0xFFFF) << 16) | ||
#define MOVE_X_DECODE(encoded) (int16_t)(((encoded) & 0xFFFF0000) >> 16) | ||
|
||
#define MOVE(hor, vert) (MOVE_X(hor) + MOVE_Y(vert)) | ||
|
||
#define MOVE_UP MOVE_Y(-ZMK_MOUSE_DEFAULT_MOVE_VAL) | ||
#define MOVE_DOWN MOVE_Y(ZMK_MOUSE_DEFAULT_MOVE_VAL) | ||
#define MOVE_LEFT MOVE_X(-ZMK_MOUSE_DEFAULT_MOVE_VAL) | ||
#define MOVE_RIGHT MOVE_X(ZMK_MOUSE_DEFAULT_MOVE_VAL) | ||
|
||
#define SCRL_UP MOVE_Y(ZMK_MOUSE_DEFAULT_SCRL_VAL) | ||
#define SCRL_DOWN MOVE_Y(-ZMK_MOUSE_DEFAULT_SCRL_VAL) | ||
#define SCRL_LEFT MOVE_X(-ZMK_MOUSE_DEFAULT_SCRL_VAL) | ||
#define SCRL_RIGHT MOVE_X(ZMK_MOUSE_DEFAULT_SCRL_VAL) | ||
#include "pointing.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2023 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
#pragma once | ||
|
||
#include <zephyr/dt-bindings/dt-util.h> | ||
|
||
/* Mouse press behavior */ | ||
/* Left click */ | ||
#define MB1 BIT(0) | ||
#define LCLK (MB1) | ||
|
||
/* Right click */ | ||
#define MB2 BIT(1) | ||
#define RCLK (MB2) | ||
|
||
/* Middle click */ | ||
#define MB3 BIT(2) | ||
#define MCLK (MB3) | ||
|
||
#define MB4 BIT(3) | ||
#define MB5 BIT(4) | ||
|
||
#ifndef ZMK_POINTING_DEFAULT_MOVE_VAL | ||
#define ZMK_POINTING_DEFAULT_MOVE_VAL 600 | ||
#endif | ||
|
||
#ifndef ZMK_POINTING_DEFAULT_SCRL_VAL | ||
#define ZMK_POINTING_DEFAULT_SCRL_VAL 10 | ||
#endif | ||
|
||
/* Mouse move behavior */ | ||
#define MOVE_Y(vert) ((vert) & 0xFFFF) | ||
#define MOVE_Y_DECODE(encoded) (int16_t)((encoded) & 0x0000FFFF) | ||
#define MOVE_X(hor) (((hor) & 0xFFFF) << 16) | ||
#define MOVE_X_DECODE(encoded) (int16_t)(((encoded) & 0xFFFF0000) >> 16) | ||
|
||
#define MOVE(hor, vert) (MOVE_X(hor) + MOVE_Y(vert)) | ||
|
||
#define MOVE_UP MOVE_Y(-ZMK_POINTING_DEFAULT_MOVE_VAL) | ||
#define MOVE_DOWN MOVE_Y(ZMK_POINTING_DEFAULT_MOVE_VAL) | ||
#define MOVE_LEFT MOVE_X(-ZMK_POINTING_DEFAULT_MOVE_VAL) | ||
#define MOVE_RIGHT MOVE_X(ZMK_POINTING_DEFAULT_MOVE_VAL) | ||
|
||
#define SCRL_UP MOVE_Y(ZMK_POINTING_DEFAULT_SCRL_VAL) | ||
#define SCRL_DOWN MOVE_Y(-ZMK_POINTING_DEFAULT_SCRL_VAL) | ||
#define SCRL_LEFT MOVE_X(-ZMK_POINTING_DEFAULT_SCRL_VAL) | ||
#define SCRL_RIGHT MOVE_X(ZMK_POINTING_DEFAULT_SCRL_VAL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) 2024 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <zmk/hid.h> | ||
#include <zmk/endpoints.h> | ||
|
||
struct zmk_pointing_resolution_multipliers { | ||
uint8_t wheel; | ||
uint8_t hor_wheel; | ||
}; | ||
|
||
struct zmk_pointing_resolution_multipliers | ||
zmk_pointing_resolution_multipliers_get_current_profile(void); | ||
struct zmk_pointing_resolution_multipliers | ||
zmk_pointing_resolution_multipliers_get_profile(struct zmk_endpoint_instance endpoint); | ||
void zmk_pointing_resolution_multipliers_set_profile( | ||
struct zmk_pointing_resolution_multipliers multipliers, struct zmk_endpoint_instance endpoint); | ||
|
||
void zmk_pointing_resolution_multipliers_process_report( | ||
struct zmk_hid_mouse_resolution_feature_report_body *report, | ||
struct zmk_endpoint_instance endpoint); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.