Skip to content

Commit

Permalink
refactor: Proper per-device input listeners.
Browse files Browse the repository at this point in the history
* Buffer data from input devices and only surface to HID once synd'd.
  • Loading branch information
petejohanson committed Feb 19, 2024
1 parent 08e6793 commit f2be4a7
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 201 deletions.
3 changes: 1 addition & 2 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ target_sources(app PRIVATE src/activity.c)
target_sources(app PRIVATE src/behavior.c)
target_sources(app PRIVATE src/kscan.c)
target_sources(app PRIVATE src/matrix_transform.c)
target_sources_ifdef(CONFIG_ZMK_MOUSE app PRIVATE src/mouse/input_config.c)
target_sources(app PRIVATE src/sensors.c)
target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/wpm.c)
target_sources(app PRIVATE src/event_manager.c)
Expand All @@ -40,7 +39,7 @@ target_sources(app PRIVATE src/behaviors/behavior_reset.c)
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/behaviors/behavior_ext_power.c)
if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
target_sources(app PRIVATE src/hid.c)
target_sources_ifdef(CONFIG_ZMK_MOUSE app PRIVATE src/mouse/hid_input_listener.c)
target_sources_ifdef(CONFIG_ZMK_MOUSE app PRIVATE src/mouse/input_listener.c)
target_sources(app PRIVATE src/behaviors/behavior_key_press.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_KEY_TOGGLE app PRIVATE src/behaviors/behavior_key_toggle.c)
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
Expand Down
2 changes: 0 additions & 2 deletions app/dts/behaviors.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@
#include <behaviors/backlight.dtsi>
#include <behaviors/macros.dtsi>
#include <behaviors/mouse_key_press.dtsi>
#include <behaviors/mouse_move.dtsi>
#include <behaviors/mouse_scroll.dtsi>
#include <behaviors/macros.dtsi>
5 changes: 5 additions & 0 deletions app/dts/behaviors/mouse_move.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
acceleration-exponent = <1>;
};
};

mmv_input_listener {
compatible = "zmk,input-listener";
device = <&mmv>;
};
};
5 changes: 5 additions & 0 deletions app/dts/behaviors/mouse_scroll.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
acceleration-exponent = <0>;
};
};

msc_input_listener {
compatible = "zmk,input-listener";
device = <&msc>;
};
};
24 changes: 0 additions & 24 deletions app/dts/bindings/zmk,input-configs.yaml

This file was deleted.

21 changes: 21 additions & 0 deletions app/dts/bindings/zmk,input-listener.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
description: |
Listener to subscribe to input events and send HID updates after processing
compatible: "zmk,input-listener"

properties:
device:
type: phandle
required: true
xy-swap:
type: boolean
x-invert:
type: boolean
y-invert:
type: boolean
scale-multiplier:
type: int
default: 1
scale-divisor:
type: int
default: 1
21 changes: 0 additions & 21 deletions app/include/zmk/mouse/input_config.h

This file was deleted.

110 changes: 0 additions & 110 deletions app/src/mouse/hid_input_listener.c

This file was deleted.

42 changes: 0 additions & 42 deletions app/src/mouse/input_config.c

This file was deleted.

Loading

0 comments on commit f2be4a7

Please sign in to comment.