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.
- Loading branch information
Showing
5 changed files
with
84 additions
and
11 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
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> | ||
|
||
struct zmk_mouse_state_changed { | ||
uint32_t x; | ||
uint32_t y; | ||
bool state; | ||
int64_t timestamp; | ||
}; | ||
|
||
ZMK_EVENT_DECLARE(zmk_mouse_state_changed); | ||
|
||
static inline struct zmk_mouse_state_changed_event * | ||
zmk_mouse_state_changed_from_encoded(uint32_t encoded, bool pressed, | ||
int64_t timestamp) { | ||
|
||
uint32_t x = (binding->param1 & 0xFFFF0000) >> 16; | ||
uint32_t y = binding->param1 & 0x0000FFFF; | ||
LOG_DBG("x: 0x%02X y: 0x%02X", x, y); | ||
zmk_hid_mouse_movement_release(x, y); | ||
|
||
return new_zmk_mouse_state_changed((struct zmk_mouse_state_changed){ | ||
.x = x, .y = y, .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
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,10 @@ | ||
/* | ||
* Copyright (c) 2020 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include <kernel.h> | ||
#include <zmk/events/mouse_state_changed.h> | ||
|
||
ZMK_EVENT_IMPL(zmk_mouse_state_changed); |
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