Skip to content

Commit

Permalink
feat(mouse): Upgrade PS/2 mouse code to zephyr 3.5
Browse files Browse the repository at this point in the history
PS2 Mouse: Increase init priority to be after UART drivers

PS2 Mouse: Add config option to disable additional error mitigation

Auto Layer: Add automatic layer toggling on mouse movement

PS2 Mouse: Log transmission error reason

Auto Layer: Fixes

Scroll Mode: Initial implementation

PS2 Mouse: Auto lint code

PS2 Mouse: Scroll mode improvements (uncommitted changes from 3 month ago)

Mouse Settings & Scroll Mode: Apply new auto-formatting

Mouse Settings: Silence zephyr 3.5 compile warnings

PS2 Mouse: Move to zephyr 3.5 input system

PS2 Mouse: Add mouse ps2 work queue

PS2 Mouse: Increase err_msg buffer size for zmk_mouse_ps2_send_cmd_resp to avoid truncating

Mouse Settings & Scroll Mode: Update mouse settings and scroll mode behaviors to new labelless behavior init method

PS2 Mouse: Disable restore of mouse PS2 settings

Mouse Auto Layer: Added toggle delay to prevent accidental activations

PS2 Mouse: Added script to generate interrupt priority overrides for zmk-config

PS2 Mouse: Don’t override interrupt priorities in all zmk builds by default

PS2 Mouse: Reset device if invalid self-test result is received

PS2 Mouse: Delay PS2 init sequence to give mouse time to send init data

PS2 Mouse: Remove kconfig settings that are handled by input-config

PS2 Mouse: Log when settings were set successfully

PS2 Mouse: Moved sampling rate and press to select from kconfig to device tree

PS2 Mouse: Added devicetree settings for TP settings

Correct val6 default value

PS2 Mouse: Enable settings restore again

PS2 Mouse: Don’t restore runtime settings if device config is present

Mouse Settings: Added log and reset behavior

Adjust settings log

PS2 Mouse: Fix wrong type for tp press to select var

PS2 Mouse: Replace kconfig enable clicking with devicetree disable clicking

PS2 Mouse: Disable error mitigations by default

PS2 Mouse: Moved axis options from kconfig to devicetree

PS2 Mouse: Removed scroll mode behavior

PS2 Mouse: Move scroll mode from kconfig to devicetree

PS2 Mouse: Removed movement buffer / queue

Remove butter kconfigs

PS2 Mouse: Convert clicking to zephyr 3.5 input system

Mouse Auto Layer: Removed it in preparation for zephyr 3.5 module

PS2 Mouse: Moved mouse_ps2 driver to module
  • Loading branch information
infused-kim committed Feb 11, 2024
1 parent 2794f12 commit 345f201
Show file tree
Hide file tree
Showing 15 changed files with 798 additions and 1,003 deletions.
4 changes: 2 additions & 2 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ target_sources_ifdef(CONFIG_ZMK_USB app PRIVATE src/usb_hid.c)
target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c)
target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/backlight.c)
target_sources_ifdef(CONFIG_ZMK_LOW_PRIORITY_WORK_QUEUE app PRIVATE src/workqueue.c)
target_sources_ifdef(CONFIG_ZMK_MOUSE_PS2 app PRIVATE src/mouse/mouse_ps2.c)
target_sources_ifdef(CONFIG_ZMK_MOUSE_PS2 app PRIVATE src/behaviors/behavior_mouse_setting.c)
target_sources_ifdef(CONFIG_ZMK_INPUT_MOUSE_PS2 app PRIVATE src/behaviors/behavior_mouse_setting.c)

target_sources(app PRIVATE src/main.c)

add_subdirectory(src/display/)
Expand Down
1 change: 0 additions & 1 deletion app/dts/arm/nordic/override.dtsi

This file was deleted.

1 change: 0 additions & 1 deletion app/dts/behaviors/mouse_setting.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
behaviors {
mms: behavior_mouse_setting {
compatible = "zmk,behavior-mouse-setting";
label = "MOUSE_SETTING";
#binding-cells = <1>;
};
};
Expand Down
15 changes: 0 additions & 15 deletions app/dts/bindings/zmk,mouse-ps2.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions app/include/dt-bindings/zmk/mouse_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
#pragma once

#define MS_LOG 0
#define MS_RESET 1

#define MS_TP_SENSITIVITY_INCR 10
#define MS_TP_SENSITIVITY_DECR 11

Expand Down
1 change: 1 addition & 0 deletions app/module/drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ add_subdirectory_ifdef(CONFIG_GPIO gpio)
add_subdirectory_ifdef(CONFIG_KSCAN kscan)
add_subdirectory_ifdef(CONFIG_SENSOR sensor)
add_subdirectory_ifdef(CONFIG_DISPLAY display)
add_subdirectory_ifdef(CONFIG_INPUT input)
1 change: 1 addition & 0 deletions app/module/drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ rsource "gpio/Kconfig"
rsource "kscan/Kconfig"
rsource "sensor/Kconfig"
rsource "display/Kconfig"
rsource "input/Kconfig"
6 changes: 6 additions & 0 deletions app/module/drivers/input/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT

zephyr_library_amend()

zephyr_library_sources_ifdef(CONFIG_ZMK_INPUT_MOUSE_PS2 input_mouse_ps2.c)
19 changes: 19 additions & 0 deletions app/module/drivers/input/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT

DT_COMPAT_ZMK_INPUT_PS2_MOUSE := zmk,input-mouse-ps2

config ZMK_INPUT_MOUSE_PS2
bool
default $(dt_compat_enabled,$(DT_COMPAT_ZMK_INPUT_PS2_MOUSE))
depends on (!ZMK_SPLIT || ZMK_SPLIT_ROLE_CENTRAL)
select ZMK_MOUSE
select PS2

if ZMK_INPUT_MOUSE_PS2

config ZMK_INPUT_MOUSE_PS2_ENABLE_ERROR_MITIGATION
bool "Tries to mitigate transmission errors. Only useful when using a PS2 driver that is prone to miscommunication like the GPIO bitbanging driver."
default n

endif # ZMK_INPUT_MOUSE_PS2
Loading

0 comments on commit 345f201

Please sign in to comment.