forked from zmkfirmware/zmk
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mouse keys): add events, smoothing and acceleration
- Loading branch information
1 parent
728f42e
commit 8fc5962
Showing
33 changed files
with
653 additions
and
268 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/ { | ||
behaviors { | ||
/omit-if-no-ref/ mwh: msc: behavior_mouse_scroll { | ||
compatible = "zmk,behavior-mouse-scroll"; | ||
label = "MOUSE_SCROLL"; | ||
#binding-cells = <1>; | ||
delay-ms = <0>; | ||
time-to-max-speed-ms = <1000>; | ||
acceleration-exponent = <0>; | ||
}; | ||
}; | ||
}; |
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,13 @@ | ||
description: Mouse scroll | ||
|
||
compatible: "zmk,behavior-mouse-scroll" | ||
|
||
include: one_param.yaml | ||
|
||
properties: | ||
delay-ms: | ||
type: int | ||
time-to-max-speed-ms: | ||
type: int | ||
acceleration-exponent: | ||
type: int |
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,27 @@ | ||
|
||
/* | ||
* Copyright (c) 2020 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <zephyr.h> | ||
#include <zmk/hid.h> | ||
#include <zmk/event_manager.h> | ||
#include <zmk/mouse.h> | ||
|
||
struct zmk_mouse_button_state_changed { | ||
zmk_mouse_button_t buttons; | ||
bool state; | ||
int64_t timestamp; | ||
}; | ||
|
||
ZMK_EVENT_DECLARE(zmk_mouse_button_state_changed); | ||
|
||
static inline struct zmk_mouse_button_state_changed_event * | ||
zmk_mouse_button_state_changed_from_encoded(uint32_t encoded, bool pressed, int64_t timestamp) { | ||
return new_zmk_mouse_button_state_changed((struct zmk_mouse_button_state_changed){ | ||
.buttons = HID_USAGE_ID(encoded), .state = pressed, .timestamp = timestamp}); | ||
} |
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,33 @@ | ||
|
||
/* | ||
* Copyright (c) 2020 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <zephyr.h> | ||
#include <zmk/event_manager.h> | ||
#include <zmk/mouse.h> | ||
|
||
struct zmk_mouse_move_state_changed { | ||
struct vector2d max_speed; | ||
struct mouse_config config; | ||
bool state; | ||
int64_t timestamp; | ||
}; | ||
|
||
ZMK_EVENT_DECLARE(zmk_mouse_move_state_changed); | ||
|
||
static inline struct zmk_mouse_move_state_changed_event * | ||
zmk_mouse_move_state_changed_from_encoded(uint32_t encoded, struct mouse_config config, | ||
bool pressed, int64_t timestamp) { | ||
struct vector2d max_speed = (struct vector2d){ | ||
.x = MOVE_HOR_DECODE(encoded), | ||
.y = MOVE_VERT_DECODE(encoded), | ||
}; | ||
|
||
return new_zmk_mouse_move_state_changed((struct zmk_mouse_move_state_changed){ | ||
.max_speed = max_speed, .config = config, .state = pressed, .timestamp = timestamp}); | ||
} |
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,34 @@ | ||
|
||
/* | ||
* Copyright (c) 2020 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <zephyr.h> | ||
#include <zmk/event_manager.h> | ||
#include <zmk/mouse.h> | ||
#include <dt-bindings/zmk/mouse.h> | ||
|
||
struct zmk_mouse_scroll_state_changed { | ||
struct vector2d max_speed; | ||
struct mouse_config config; | ||
bool state; | ||
int64_t timestamp; | ||
}; | ||
|
||
ZMK_EVENT_DECLARE(zmk_mouse_scroll_state_changed); | ||
|
||
static inline struct zmk_mouse_scroll_state_changed_event * | ||
zmk_mouse_scroll_state_changed_from_encoded(uint32_t encoded, struct mouse_config config, | ||
bool pressed, int64_t timestamp) { | ||
struct vector2d max_speed = (struct vector2d){ | ||
.x = SCROLL_HOR_DECODE(encoded), | ||
.y = SCROLL_VERT_DECODE(encoded), | ||
}; | ||
|
||
return new_zmk_mouse_scroll_state_changed((struct zmk_mouse_scroll_state_changed){ | ||
.max_speed = max_speed, .config = config, .state = pressed, .timestamp = timestamp}); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
/* | ||
* Copyright (c) 2020 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <dt-bindings/zmk/mouse.h> | ||
#include <zephyr.h> | ||
#include <zmk/event_manager.h> | ||
#include <zmk/mouse.h> | ||
|
||
struct zmk_mouse_tick { | ||
struct vector2d max_move; | ||
struct vector2d max_scroll; | ||
struct mouse_config move_config; | ||
struct mouse_config scroll_config; | ||
int64_t timestamp; | ||
}; | ||
|
||
ZMK_EVENT_DECLARE(zmk_mouse_tick); | ||
|
||
static inline struct zmk_mouse_tick_event *zmk_mouse_tick(struct vector2d max_move, | ||
struct vector2d max_scroll, | ||
struct mouse_config move_config, | ||
struct mouse_config scroll_config) { | ||
return new_zmk_mouse_tick((struct zmk_mouse_tick){ | ||
.max_move = max_move, | ||
.max_scroll = max_scroll, | ||
.move_config = move_config, | ||
.scroll_config = scroll_config, | ||
.timestamp = k_uptime_get(), | ||
}); | ||
} |
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.