Skip to content

Commit

Permalink
refactor(mouse): Tweak behavior inclusion, listener code
Browse files Browse the repository at this point in the history
* Always import mouse keys behavior and their associated listeners.
* Tweak listener code to only add listener nodes when
  listener and the associated input device are enabled.

feat(mouse): Add mouse move and scroll support [WIP]

feat(mouse): Split move/scroll & x/y acceleration

fix(mouse): Bump up default mouse tick duration to prevent crashes

refactor: Use input system for pointer events.

feat(mouse): Add input configs for data mods.

* Add ability to swap X/Y, invert X and Y values, and apply a
  scalar multiplier/divisor.

refactor(mouse): Remove mouse work queue, Kconfig

* Remove now-unused mouse work queue and related mouse main file.
* Move ticks config into a DTS property on the two axis input behavior.

fix(mouse): Fixes for logging.

* Corrected logging for two-axis input timestamps.

refactor: Proper per-device input listeners.

* Buffer data from input devices and only surface to HID once synd'd.

chore: Minor input behavior clean-up.

fix: Testing fixes for listener refactor.

refactor(mouse): Lots of mouse refactors.

* Dedicated mouse source directory.
* Split mouse HID into dedicated USB endpoint and HoG service.
* Enable composite USB device automatically, tweak the
  various default sizes.
* Add PTP bits for multitouch.
* Handle input events for multiple slots before a sync
  event triggers a HID report.

Cirque gen4 driver commit

Commit STP board

Board change to 4 fingers

Update stp_defconfig

Update stp_defconfig

Update stp.keymap

Form Trackpad work

remove work

Modify Pete pointer PR

Update Kconfig

Profile switch single gpio

Event driven lighting

Change LED colour with prof

Swap LEDs

Fix mouse mode

Impeofed switching

Cleanup defconfig

test additional hid service

Update stp_defconfig

Update core-coverage.yml

Studio changes

studio tweaks

Co-Authored-By: Alexander Krikun <[email protected]>
Co-Authored-By: Robert U <[email protected]>
Co-Authored-By: Shawn Meier <[email protected]>
  • Loading branch information
4 people authored and ReFil committed Aug 6, 2024
1 parent e19aff7 commit dcba9d3
Show file tree
Hide file tree
Showing 85 changed files with 4,418 additions and 254 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/zmkfirmware/zmk-dev-arm:3.5
FROM docker.io/zmkfirmware/zmk-dev-arm:3.5-branch

COPY .bashrc tmp
RUN mv /tmp/.bashrc ~/.bashrc
9 changes: 7 additions & 2 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ target_sources_ifdef(CONFIG_ZMK_GPIO_KEY_WAKEUP_TRIGGER app PRIVATE src/gpio_key
target_sources(app PRIVATE src/events/activity_state_changed.c)
target_sources(app PRIVATE src/events/position_state_changed.c)
target_sources(app PRIVATE src/events/sensor_event.c)
target_sources(app PRIVATE src/events/mouse_button_state_changed.c)
target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/events/wpm_state_changed.c)
target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/events/usb_conn_state_changed.c)
target_sources(app PRIVATE src/behaviors/behavior_reset.c)
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/behaviors/behavior_ext_power.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_SOFT_OFF app PRIVATE src/behaviors/behavior_soft_off.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.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 All @@ -64,6 +63,7 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_SENSOR_ROTATE_COMMON app PRIVATE src/behaviors/behavior_sensor_rotate_common.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_MOUSE_KEY_PRESS app PRIVATE src/behaviors/behavior_mouse_key_press.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_STUDIO_UNLOCK app PRIVATE src/behaviors/behavior_studio_unlock.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_INPUT_TWO_AXIS app PRIVATE src/behaviors/behavior_input_two_axis.c)
target_sources(app PRIVATE src/combo.c)
target_sources(app PRIVATE src/behaviors/behavior_tap_dance.c)
target_sources(app PRIVATE src/behavior_queue.c)
Expand All @@ -87,6 +87,7 @@ endif()

target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/behaviors/behavior_rgb_underglow.c)
target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/behaviors/behavior_backlight.c)
target_sources_ifdef(CONFIG_ZMK_STP_INDICATORS app PRIVATE src/behaviors/behavior_stp_indicators.c)

target_sources_ifdef(CONFIG_ZMK_BATTERY_REPORTING app PRIVATE src/events/battery_state_changed.c)
target_sources_ifdef(CONFIG_ZMK_BATTERY_REPORTING app PRIVATE src/battery.c)
Expand All @@ -101,10 +102,14 @@ 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_PROFILESWITCH app PRIVATE src/profile_switch.c)

target_sources_ifdef(CONFIG_ZMK_STP_INDICATORS app PRIVATE src/stp_indicators.c)
target_sources(app PRIVATE src/main.c)

add_subdirectory(src/display/)
add_subdirectory_ifdef(CONFIG_SETTINGS src/settings/)
add_subdirectory(src/mouse/)

if (CONFIG_ZMK_STUDIO)
# For some reason this is failing if run from a different sub-file.
Expand Down
33 changes: 25 additions & 8 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ config BT_PERIPHERAL_PREF_LATENCY
config BT_PERIPHERAL_PREF_TIMEOUT
default 400

config ZMK_PROFILESWITCH
bool "Enable two state profile switch"
default n

#ZMK_BLE
endif

Expand Down Expand Up @@ -363,6 +367,25 @@ config ZMK_RGB_UNDERGLOW_AUTO_OFF_USB
#ZMK_RGB_UNDERGLOW
endif

menuconfig ZMK_STP_INDICATORS
bool "STP Specific indicators"
select LED_STRIP
select ZMK_LOW_PRIORITY_WORK_QUEUE
select ZMK_HID_INDICATORS

if ZMK_STP_INDICATORS

# This default value cuts down on tons of excess .conf files, if you're using GPIO, manually disable this
config SPI
default y

config ZMK_STP_INDICATORS_BRT_MAX
int "RGB underglow maximum brightness in percent"
range 0 100
default 100

endif

menuconfig ZMK_BACKLIGHT
bool "LED backlight"
select LED
Expand Down Expand Up @@ -395,13 +418,7 @@ endif
#Display/LED Options
endmenu

menu "Mouse Options"

config ZMK_MOUSE
bool "Enable ZMK mouse emulation"

#Mouse Options
endmenu
rsource "src/mouse/Kconfig"

menu "Power Management"

Expand Down Expand Up @@ -682,7 +699,7 @@ if ZMK_LOW_PRIORITY_WORK_QUEUE

config ZMK_LOW_PRIORITY_THREAD_STACK_SIZE
int "Low priority thread stack size"
default 768
default 1024

config ZMK_LOW_PRIORITY_THREAD_PRIORITY
int "Low priority thread priority"
Expand Down
6 changes: 6 additions & 0 deletions app/Kconfig.behaviors
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ config ZMK_BEHAVIOR_SOFT_OFF
default y
depends on DT_HAS_ZMK_BEHAVIOR_SOFT_OFF_ENABLED && ZMK_PM_SOFT_OFF

config ZMK_BEHAVIOR_INPUT_TWO_AXIS
bool
default y
depends on DT_HAS_ZMK_BEHAVIOR_INPUT_TWO_AXIS_ENABLED
imply ZMK_MOUSE

config ZMK_BEHAVIOR_SENSOR_ROTATE_COMMON
bool

Expand Down
7 changes: 7 additions & 0 deletions app/boards/arm/stp/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: MIT

config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on BOARD_STP
8 changes: 8 additions & 0 deletions app/boards/arm/stp/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# STP board configuration

# Copyright (c) 2023 Polarity Works
# SPDX-License-Identifier: MIT

config BOARD_STP
bool "stp"
depends on SOC_NRF52840_QIAA
34 changes: 34 additions & 0 deletions app/boards/arm/stp/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) 2021 Polarity Works
# SPDX-License-Identifier: MIT

if BOARD_STP

config BOARD
default "stp"

if USB

config USB_NRFX
default y

config USB_DEVICE_STACK
default y

endif # USB

config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

config ZMK_BATTERY_VOLTAGE_DIVIDER
default y

config ZMK_KEYBOARD_NAME
default "Form"

endif # BOARD_STP
5 changes: 5 additions & 0 deletions app/boards/arm/stp/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: MIT

board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
44 changes: 44 additions & 0 deletions app/boards/arm/stp/pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2022 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/

&pinctrl {
spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 20)>;
};
};

spi3_sleep: spi3_sleep {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 20)>;
low-power-enable;
};
};
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 17)>;
};
};
pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 17)>;
low-power-enable;
};
};
i2c1_default: i2c1_default {
group1 {
psels = <NRF_PSEL(TWIM_SCL, 0, 6)>,
<NRF_PSEL(TWIM_SDA, 0, 8)>;
};
};

i2c1_sleep: i2c1_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SCL, 0, 6)>,
<NRF_PSEL(TWIM_SDA, 0, 8)>;
low-power-enable;
};
};
};
Loading

0 comments on commit dcba9d3

Please sign in to comment.