forked from kofal.net/zmk
feat(mouse): Add mouse move and scroll support (#2477)
* feat(mouse): Add mouse move and scroll support
* Use Zephyr input subsystem for all pointers.
* Input processors for modifying events, e.g. scaling, swapping
codes, temporary (mouse) layers, etc.
* Mouse move/scroll behaviors.
* Infrastructure in place for physical pointer input devices.
* feat: Add input split support.
* docs: Add initial pointer docs.
---------
Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
Co-authored-by: Alexander Krikun <krikun98@gmail.com>
Co-authored-by: Robert U <urob@users.noreply.github.com>
Co-authored-by: Shawn Meier <ftc@users.noreply.github.com>
Co-authored-by: Chris Andreae <chris@andreae.gen.nz>
Co-authored-by: Anant Thazhemadam <47104651+thazhemadam@users.noreply.github.com>
Co-authored-by: Erik Tollerud <erik.tollerud@gmail.com>
Co-authored-by: Nicolas Munnich <98408764+Nick-Munnich@users.noreply.github.com>
This commit is contained in:
67
app/include/drivers/input_processor.h
Normal file
67
app/include/drivers/input_processor.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2024 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <zephyr/types.h>
|
||||
#include <stddef.h>
|
||||
#include <zephyr/sys/util.h>
|
||||
#include <string.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/input/input.h>
|
||||
|
||||
struct zmk_input_processor_entry {
|
||||
const struct device *dev;
|
||||
uint32_t param1;
|
||||
uint32_t param2;
|
||||
bool track_remainders;
|
||||
};
|
||||
|
||||
#define ZMK_INPUT_PROCESSOR_ENTRY_AT_IDX(idx, n) \
|
||||
{ \
|
||||
.dev = DEVICE_DT_GET(DT_PHANDLE_BY_IDX(n, input_processors, idx)), \
|
||||
.param1 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(n, input_processors, idx, param1), (0), \
|
||||
(DT_PHA_BY_IDX(n, input_processors, idx, param1))), \
|
||||
.param2 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(n, input_processors, idx, param2), (0), \
|
||||
(DT_PHA_BY_IDX(n, input_processors, idx, param2))), \
|
||||
.track_remainders = \
|
||||
COND_CODE_1(DT_PROP(DT_PHANDLE_BY_IDX(n, input_processors, idx), track_remainders), \
|
||||
(true), (false)), \
|
||||
}
|
||||
|
||||
struct zmk_input_processor_state {
|
||||
int16_t *remainder;
|
||||
};
|
||||
|
||||
// TODO: Need the ability to store remainders? Some data passed in?
|
||||
typedef int (*zmk_input_processor_handle_event_callback_t)(const struct device *dev,
|
||||
struct input_event *event,
|
||||
uint32_t param1, uint32_t param2,
|
||||
struct zmk_input_processor_state *state);
|
||||
|
||||
__subsystem struct zmk_input_processor_driver_api {
|
||||
zmk_input_processor_handle_event_callback_t handle_event;
|
||||
};
|
||||
|
||||
__syscall int zmk_input_processor_handle_event(const struct device *dev, struct input_event *event,
|
||||
uint32_t param1, uint32_t param2,
|
||||
struct zmk_input_processor_state *state);
|
||||
|
||||
static inline int z_impl_zmk_input_processor_handle_event(const struct device *dev,
|
||||
struct input_event *event,
|
||||
uint32_t param1, uint32_t param2,
|
||||
struct zmk_input_processor_state *state) {
|
||||
const struct zmk_input_processor_driver_api *api =
|
||||
(const struct zmk_input_processor_driver_api *)dev->api;
|
||||
|
||||
if (api->handle_event == NULL) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
return api->handle_event(dev, event, param1, param2, state);
|
||||
}
|
||||
|
||||
#include <syscalls/input_processor.h>
|
||||
12
app/include/dt-bindings/input.h
Normal file
12
app/include/dt-bindings/input.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) 2024 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define ZMK_INPUT_EXPLICIT_CODE(type, code) ((type << 16) & code)
|
||||
|
||||
#define ZMK_INPUT_EXPLICIT_CODE_TYPE(val) ((val >> 16) & 0xFF)
|
||||
#define ZMK_INPUT_EXPLICIT_CODE_CODE(val) (val & 0xFFFF)
|
||||
11
app/include/dt-bindings/zmk/input_transform.h
Normal file
11
app/include/dt-bindings/zmk/input_transform.h
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2024 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <zephyr/dt-bindings/dt-util.h>
|
||||
|
||||
#define INPUT_TRANSFORM_XY_SWAP BIT(0)
|
||||
#define INPUT_TRANSFORM_X_INVERT BIT(1)
|
||||
#define INPUT_TRANSFORM_Y_INVERT BIT(2)
|
||||
@@ -1,24 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2020 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)
|
||||
#include "pointing.h"
|
||||
50
app/include/dt-bindings/zmk/pointing.h
Normal file
50
app/include/dt-bindings/zmk/pointing.h
Normal file
@@ -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)
|
||||
@@ -70,8 +70,8 @@ struct zmk_endpoint_instance zmk_endpoints_selected(void);
|
||||
|
||||
int zmk_endpoints_send_report(uint16_t usage_page);
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#if IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
int zmk_endpoints_send_mouse_report();
|
||||
#endif // IS_ENABLE(CONFIG_ZMK_MOUSE)
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
|
||||
void zmk_endpoints_clear_current(void);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <zmk/hid.h>
|
||||
#include <zmk/event_manager.h>
|
||||
#include <zmk/mouse.h>
|
||||
#include <zmk/pointing.h>
|
||||
|
||||
struct zmk_mouse_button_state_changed {
|
||||
zmk_mouse_button_t buttons;
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#include <zephyr/usb/class/usb_hid.h>
|
||||
|
||||
#include <zmk/keys.h>
|
||||
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#include <zmk/mouse.h>
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#if IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
#include <zmk/pointing.h>
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
|
||||
#include <dt-bindings/zmk/hid_usage.h>
|
||||
#include <dt-bindings/zmk/hid_usage_pages.h>
|
||||
@@ -77,6 +77,30 @@
|
||||
#define ZMK_HID_REPORT_ID_CONSUMER 0x02
|
||||
#define ZMK_HID_REPORT_ID_MOUSE 0x03
|
||||
|
||||
#ifndef HID_ITEM_TAG_PUSH
|
||||
#define HID_ITEM_TAG_PUSH 0xA
|
||||
#endif
|
||||
|
||||
#ifndef HID_ITEM_TAG_POP
|
||||
#define HID_ITEM_TAG_POP 0xB
|
||||
#endif
|
||||
|
||||
#define HID_PUSH HID_ITEM(HID_ITEM_TAG_PUSH, HID_ITEM_TYPE_GLOBAL, 0)
|
||||
|
||||
#define HID_POP HID_ITEM(HID_ITEM_TAG_POP, HID_ITEM_TYPE_GLOBAL, 0)
|
||||
|
||||
#ifndef HID_PHYSICAL_MIN8
|
||||
#define HID_PHYSICAL_MIN8(a) HID_ITEM(HID_ITEM_TAG_PHYSICAL_MIN, HID_ITEM_TYPE_GLOBAL, 1), a
|
||||
#endif
|
||||
|
||||
#ifndef HID_PHYSICAL_MAX8
|
||||
#define HID_PHYSICAL_MAX8(a) HID_ITEM(HID_ITEM_TAG_PHYSICAL_MAX, HID_ITEM_TYPE_GLOBAL, 1), a
|
||||
#endif
|
||||
|
||||
#define HID_USAGE16(a, b) HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 2), a, b
|
||||
|
||||
#define HID_USAGE16_SINGLE(a) HID_USAGE16((a & 0xFF), ((a >> 8) & 0xFF))
|
||||
|
||||
static const uint8_t zmk_hid_report_desc[] = {
|
||||
HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP),
|
||||
HID_USAGE(HID_USAGE_GD_KEYBOARD),
|
||||
@@ -161,7 +185,7 @@ static const uint8_t zmk_hid_report_desc[] = {
|
||||
HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_ARRAY | ZMK_HID_MAIN_VAL_ABS),
|
||||
HID_END_COLLECTION,
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#if IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
HID_USAGE_PAGE(HID_USAGE_GD),
|
||||
HID_USAGE(HID_USAGE_GD_MOUSE),
|
||||
HID_COLLECTION(HID_COLLECTION_APPLICATION),
|
||||
@@ -184,15 +208,51 @@ static const uint8_t zmk_hid_report_desc[] = {
|
||||
HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP),
|
||||
HID_USAGE(HID_USAGE_GD_X),
|
||||
HID_USAGE(HID_USAGE_GD_Y),
|
||||
HID_LOGICAL_MIN16(0xFF, -0x7F),
|
||||
HID_LOGICAL_MAX16(0xFF, 0x7F),
|
||||
HID_REPORT_SIZE(0x10),
|
||||
HID_REPORT_COUNT(0x02),
|
||||
HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_REL),
|
||||
HID_COLLECTION(HID_COLLECTION_LOGICAL),
|
||||
#if IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
|
||||
HID_USAGE(HID_USAGE_GD_RESOLUTION_MULTIPLIER),
|
||||
HID_LOGICAL_MIN8(0x00),
|
||||
HID_LOGICAL_MAX8(0x0F),
|
||||
HID_PHYSICAL_MIN8(0x01),
|
||||
HID_PHYSICAL_MAX8(0x10),
|
||||
HID_REPORT_SIZE(0x04),
|
||||
HID_REPORT_COUNT(0x01),
|
||||
HID_PUSH,
|
||||
HID_FEATURE(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_ABS),
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
|
||||
HID_USAGE(HID_USAGE_GD_WHEEL),
|
||||
HID_LOGICAL_MIN8(-0x7F),
|
||||
HID_LOGICAL_MAX8(0x7F),
|
||||
HID_REPORT_SIZE(0x08),
|
||||
HID_REPORT_COUNT(0x03),
|
||||
HID_LOGICAL_MIN16(0xFF, -0x7F),
|
||||
HID_LOGICAL_MAX16(0xFF, 0x7F),
|
||||
HID_PHYSICAL_MIN8(0x00),
|
||||
HID_PHYSICAL_MAX8(0x00),
|
||||
HID_REPORT_SIZE(0x10),
|
||||
HID_REPORT_COUNT(0x01),
|
||||
HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_REL),
|
||||
HID_END_COLLECTION,
|
||||
HID_COLLECTION(HID_COLLECTION_LOGICAL),
|
||||
#if IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
|
||||
HID_USAGE(HID_USAGE_GD_RESOLUTION_MULTIPLIER),
|
||||
HID_POP,
|
||||
HID_FEATURE(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_ABS),
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
|
||||
HID_USAGE_PAGE(HID_USAGE_CONSUMER),
|
||||
HID_USAGE16_SINGLE(HID_USAGE_CONSUMER_AC_PAN),
|
||||
HID_LOGICAL_MIN16(0xFF, -0x7F),
|
||||
HID_LOGICAL_MAX16(0xFF, 0x7F),
|
||||
HID_PHYSICAL_MIN8(0x00),
|
||||
HID_PHYSICAL_MAX8(0x00),
|
||||
HID_REPORT_SIZE(0x10),
|
||||
HID_REPORT_COUNT(0x01),
|
||||
HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_REL),
|
||||
HID_END_COLLECTION,
|
||||
HID_END_COLLECTION,
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
HID_END_COLLECTION,
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_USB_BOOT)
|
||||
@@ -255,12 +315,13 @@ struct zmk_hid_consumer_report {
|
||||
struct zmk_hid_consumer_report_body body;
|
||||
} __packed;
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#if IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
struct zmk_hid_mouse_report_body {
|
||||
zmk_mouse_button_flags_t buttons;
|
||||
int8_t d_x;
|
||||
int8_t d_y;
|
||||
int8_t d_wheel;
|
||||
int16_t d_x;
|
||||
int16_t d_y;
|
||||
int16_t d_scroll_y;
|
||||
int16_t d_scroll_x;
|
||||
} __packed;
|
||||
|
||||
struct zmk_hid_mouse_report {
|
||||
@@ -268,7 +329,21 @@ struct zmk_hid_mouse_report {
|
||||
struct zmk_hid_mouse_report_body body;
|
||||
} __packed;
|
||||
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#if IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
|
||||
|
||||
struct zmk_hid_mouse_resolution_feature_report_body {
|
||||
uint8_t wheel_res : 4;
|
||||
uint8_t hwheel_res : 4;
|
||||
} __packed;
|
||||
|
||||
struct zmk_hid_mouse_resolution_feature_report {
|
||||
uint8_t report_id;
|
||||
struct zmk_hid_mouse_resolution_feature_report_body body;
|
||||
} __packed;
|
||||
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
|
||||
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
|
||||
zmk_mod_flags_t zmk_hid_get_explicit_mods(void);
|
||||
int zmk_hid_register_mod(zmk_mod_t modifier);
|
||||
@@ -296,13 +371,18 @@ int zmk_hid_press(uint32_t usage);
|
||||
int zmk_hid_release(uint32_t usage);
|
||||
bool zmk_hid_is_pressed(uint32_t usage);
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#if IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
int zmk_hid_mouse_button_press(zmk_mouse_button_t button);
|
||||
int zmk_hid_mouse_button_release(zmk_mouse_button_t button);
|
||||
int zmk_hid_mouse_buttons_press(zmk_mouse_button_flags_t buttons);
|
||||
int zmk_hid_mouse_buttons_release(zmk_mouse_button_flags_t buttons);
|
||||
void zmk_hid_mouse_movement_set(int16_t x, int16_t y);
|
||||
void zmk_hid_mouse_scroll_set(int8_t x, int8_t y);
|
||||
void zmk_hid_mouse_movement_update(int16_t x, int16_t y);
|
||||
void zmk_hid_mouse_scroll_update(int8_t x, int8_t y);
|
||||
void zmk_hid_mouse_clear(void);
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
|
||||
struct zmk_hid_keyboard_report *zmk_hid_get_keyboard_report(void);
|
||||
struct zmk_hid_consumer_report *zmk_hid_get_consumer_report(void);
|
||||
@@ -311,6 +391,6 @@ struct zmk_hid_consumer_report *zmk_hid_get_consumer_report(void);
|
||||
zmk_hid_boot_report_t *zmk_hid_get_boot_report();
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#if IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
struct zmk_hid_mouse_report *zmk_hid_get_mouse_report();
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
int zmk_hog_send_keyboard_report(struct zmk_hid_keyboard_report_body *body);
|
||||
int zmk_hog_send_consumer_report(struct zmk_hid_consumer_report_body *body);
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#if IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
int zmk_hog_send_mouse_report(struct zmk_hid_mouse_report_body *body);
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
|
||||
14
app/include/zmk/input.h
Normal file
14
app/include/zmk/input.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright (c) 2024 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <dt-bindings/zmk/input.h>
|
||||
|
||||
struct zmk_input_explicit_code {
|
||||
uint8_t type;
|
||||
uint16_t code;
|
||||
};
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) 2021 The ZMK Contributors
|
||||
* Copyright (c) 2023 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <dt-bindings/zmk/mouse.h>
|
||||
#include <dt-bindings/zmk/pointing.h>
|
||||
|
||||
typedef uint8_t zmk_mouse_button_flags_t;
|
||||
typedef uint16_t zmk_mouse_button_t;
|
||||
10
app/include/zmk/pointing/input_split.h
Normal file
10
app/include/zmk/pointing/input_split.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2024 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
int zmk_input_split_report_peripheral_event(uint8_t reg, uint8_t type, uint16_t code, int32_t value,
|
||||
bool sync);
|
||||
26
app/include/zmk/pointing/resolution_multipliers.h
Normal file
26
app/include/zmk/pointing/resolution_multipliers.h
Normal file
@@ -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);
|
||||
@@ -31,8 +31,17 @@ struct zmk_split_run_behavior_payload {
|
||||
char behavior_dev[ZMK_SPLIT_RUN_BEHAVIOR_DEV_LEN];
|
||||
} __packed;
|
||||
|
||||
struct zmk_split_input_event_payload {
|
||||
uint8_t type;
|
||||
uint16_t code;
|
||||
uint32_t value;
|
||||
uint8_t sync;
|
||||
} __packed;
|
||||
|
||||
int zmk_split_bt_position_pressed(uint8_t position);
|
||||
int zmk_split_bt_position_released(uint8_t position);
|
||||
int zmk_split_bt_sensor_triggered(uint8_t sensor_index,
|
||||
const struct zmk_sensor_channel_data channel_data[],
|
||||
size_t channel_data_size);
|
||||
|
||||
int zmk_split_bt_report_input(uint8_t reg, uint8_t type, uint16_t code, int32_t value, bool sync);
|
||||
|
||||
@@ -19,3 +19,4 @@
|
||||
#define ZMK_SPLIT_BT_CHAR_SENSOR_STATE_UUID ZMK_BT_SPLIT_UUID(0x00000003)
|
||||
#define ZMK_SPLIT_BT_UPDATE_HID_INDICATORS_UUID ZMK_BT_SPLIT_UUID(0x00000004)
|
||||
#define ZMK_SPLIT_BT_SELECT_PHYS_LAYOUT_UUID ZMK_BT_SPLIT_UUID(0x00000005)
|
||||
#define ZMK_SPLIT_BT_INPUT_EVENT_UUID ZMK_BT_SPLIT_UUID(0x00000006)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
int zmk_usb_hid_send_keyboard_report(void);
|
||||
int zmk_usb_hid_send_consumer_report(void);
|
||||
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#if IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
int zmk_usb_hid_send_mouse_report(void);
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
|
||||
void zmk_usb_hid_set_protocol(uint8_t protocol);
|
||||
|
||||
Reference in New Issue
Block a user