Merge remote-tracking branch 'zmk/main' into feature/default-layer-setter
This commit is contained in:
commit
3f12a14bdf
122 changed files with 1581 additions and 273 deletions
8
.github/workflows/build-user-config.yml
vendored
8
.github/workflows/build-user-config.yml
vendored
|
@ -65,6 +65,7 @@ jobs:
|
|||
board: ${{ matrix.board }}
|
||||
shield: ${{ matrix.shield }}
|
||||
artifact_name: ${{ matrix.artifact-name }}
|
||||
snippet: ${{ matrix.snippet }}
|
||||
run: |
|
||||
if [ -e zephyr/module.yml ]; then
|
||||
export zmk_load_arg=" -DZMK_EXTRA_MODULES='${GITHUB_WORKSPACE}'"
|
||||
|
@ -75,7 +76,12 @@ jobs:
|
|||
echo "base_dir=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
if [ -n "${snippet}" ]; then
|
||||
extra_west_args="-S \"${snippet}\""
|
||||
fi
|
||||
|
||||
echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV
|
||||
echo "extra_west_args=${extra_west_args}" >> $GITHUB_ENV
|
||||
echo "extra_cmake_args=${shield:+-DSHIELD=\"$shield\"}${zmk_load_arg}" >> $GITHUB_ENV
|
||||
echo "display_name=${shield:+$shield - }${board}" >> $GITHUB_ENV
|
||||
echo "artifact_name=${artifact_name:-${shield:+$shield-}${board}-zmk}" >> $GITHUB_ENV
|
||||
|
@ -120,7 +126,7 @@ jobs:
|
|||
- name: West Build (${{ env.display_name }})
|
||||
working-directory: ${{ env.base_dir }}
|
||||
shell: sh -x {0}
|
||||
run: west build -s zmk/app -d "${{ env.build_dir }}" -b "${{ matrix.board }}" -- -DZMK_CONFIG=${{ env.base_dir }}/${{ inputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}
|
||||
run: west build -s zmk/app -d "${{ env.build_dir }}" -b "${{ matrix.board }}" ${{ env.extra_west_args }} -- -DZMK_CONFIG=${{ env.base_dir }}/${{ inputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}
|
||||
|
||||
- name: ${{ env.display_name }} Kconfig file
|
||||
run: |
|
||||
|
|
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -5,7 +5,14 @@
|
|||
/zephyr
|
||||
/zmk-config
|
||||
/build
|
||||
|
||||
# macOS
|
||||
*.DS_Store
|
||||
|
||||
# Python
|
||||
__pycache__
|
||||
.python-version
|
||||
.venv
|
||||
|
||||
# clangd
|
||||
app/.cache/
|
||||
|
|
|
@ -8,10 +8,6 @@ set(ZEPHYR_EXTRA_MODULES "${ZMK_EXTRA_MODULES};${CMAKE_CURRENT_SOURCE_DIR}/modul
|
|||
find_package(Zephyr REQUIRED HINTS ../zephyr)
|
||||
project(zmk)
|
||||
|
||||
if(CONFIG_ZMK_SLEEP)
|
||||
zephyr_linker_sources(SECTIONS include/linker/zmk-pm-devices.ld)
|
||||
endif()
|
||||
|
||||
zephyr_linker_sources(SECTIONS include/linker/zmk-behaviors.ld)
|
||||
zephyr_linker_sources(RODATA include/linker/zmk-events.ld)
|
||||
|
||||
|
@ -25,11 +21,14 @@ target_sources(app PRIVATE src/stdlib.c)
|
|||
target_sources(app PRIVATE src/activity.c)
|
||||
target_sources(app PRIVATE src/behavior.c)
|
||||
target_sources(app PRIVATE src/kscan.c)
|
||||
target_sources_ifdef(CONFIG_ZMK_KSCAN_SIDEBAND_BEHAVIORS app PRIVATE src/kscan_sideband_behaviors.c)
|
||||
target_sources(app PRIVATE src/matrix_transform.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)
|
||||
target_sources_ifdef(CONFIG_ZMK_PM app PRIVATE src/pm.c)
|
||||
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/ext_power_generic.c)
|
||||
target_sources_ifdef(CONFIG_ZMK_GPIO_KEY_WAKEUP_TRIGGER app PRIVATE src/gpio_key_wakeup_trigger.c)
|
||||
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)
|
||||
|
@ -38,6 +37,7 @@ 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)
|
||||
|
|
50
app/Kconfig
50
app/Kconfig
|
@ -383,6 +383,20 @@ config ZMK_BATTERY_REPORTING
|
|||
select ZMK_LOW_PRIORITY_WORK_QUEUE
|
||||
imply BT_BAS if ZMK_BLE
|
||||
|
||||
if ZMK_BATTERY_REPORTING
|
||||
|
||||
choice ZMK_BATTERY_REPORTING_FETCH_MODE
|
||||
prompt "Battery Reporting Fetch Mode"
|
||||
|
||||
config ZMK_BATTERY_REPORTING_FETCH_MODE_STATE_OF_CHARGE
|
||||
bool "State of charge"
|
||||
|
||||
config ZMK_BATTERY_REPORTING_FETCH_MODE_LITHIUM_VOLTAGE
|
||||
bool "Lithium Voltage"
|
||||
|
||||
endchoice
|
||||
endif
|
||||
|
||||
config ZMK_IDLE_TIMEOUT
|
||||
int "Milliseconds of inactivity before entering idle state (OLED shutoff, etc)"
|
||||
default 30000
|
||||
|
@ -391,6 +405,7 @@ config ZMK_SLEEP
|
|||
bool "Enable deep sleep support"
|
||||
depends on HAS_POWEROFF
|
||||
select POWEROFF
|
||||
select ZMK_PM_DEVICE_SUSPEND_RESUME
|
||||
imply USB
|
||||
|
||||
if ZMK_SLEEP
|
||||
|
@ -409,6 +424,26 @@ config ZMK_EXT_POWER
|
|||
bool "Enable support to control external power output"
|
||||
default y
|
||||
|
||||
config ZMK_PM
|
||||
bool
|
||||
|
||||
config ZMK_PM_DEVICE_SUSPEND_RESUME
|
||||
bool
|
||||
select ZMK_PM
|
||||
|
||||
config ZMK_PM_SOFT_OFF
|
||||
bool "Soft-off support"
|
||||
depends on HAS_POWEROFF
|
||||
select ZMK_PM
|
||||
select PM_DEVICE
|
||||
select ZMK_PM_DEVICE_SUSPEND_RESUME
|
||||
select POWEROFF
|
||||
|
||||
config ZMK_GPIO_KEY_WAKEUP_TRIGGER
|
||||
bool "Hardware supported wakeup (GPIO)"
|
||||
default y
|
||||
depends on DT_HAS_ZMK_GPIO_KEY_WAKEUP_TRIGGER_ENABLED && ZMK_PM_SOFT_OFF
|
||||
|
||||
#Power Management
|
||||
endmenu
|
||||
|
||||
|
@ -485,6 +520,21 @@ config ZMK_KSCAN_EVENT_QUEUE_SIZE
|
|||
|
||||
endif # ZMK_KSCAN
|
||||
|
||||
config ZMK_KSCAN_SIDEBAND_BEHAVIORS
|
||||
bool
|
||||
default y
|
||||
depends on DT_HAS_ZMK_KSCAN_SIDEBAND_BEHAVIORS_ENABLED
|
||||
select KSCAN
|
||||
|
||||
if ZMK_KSCAN_SIDEBAND_BEHAVIORS
|
||||
|
||||
config ZMK_KSCAN_SIDEBAND_BEHAVIORS_INIT_PRIORITY
|
||||
int "Keyboard scan sideband behaviors driver init priority"
|
||||
# The default kscan init priority is 90, so be sure we are initialized later.
|
||||
default 95
|
||||
|
||||
endif # ZMK_KSCAN_SIDEBAND_BEHAVIORS
|
||||
|
||||
menu "Logging"
|
||||
|
||||
config ZMK_LOGGING_MINIMAL
|
||||
|
|
|
@ -12,6 +12,11 @@ config ZMK_BEHAVIOR_MOUSE_KEY_PRESS
|
|||
depends on DT_HAS_ZMK_BEHAVIOR_MOUSE_KEY_PRESS_ENABLED
|
||||
imply ZMK_MOUSE
|
||||
|
||||
config ZMK_BEHAVIOR_SOFT_OFF
|
||||
bool
|
||||
default y
|
||||
depends on DT_HAS_ZMK_BEHAVIOR_SOFT_OFF_ENABLED && ZMK_PM_SOFT_OFF
|
||||
|
||||
config ZMK_BEHAVIOR_SENSOR_ROTATE_COMMON
|
||||
bool
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
/{
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
/{
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -81,6 +81,8 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
debounce-press-ms = <4>;
|
||||
debounce-release-ms = <20>;
|
||||
|
|
|
@ -42,6 +42,7 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,5) R
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-direct";
|
||||
wakeup-source;
|
||||
|
||||
input-gpios =
|
||||
<&pro_micro 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>,
|
||||
<&pro_micro 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>,
|
||||
|
|
|
@ -28,6 +28,7 @@ RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(6,0) RC(6,1) RC(6,2)
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-direct";
|
||||
wakeup-source;
|
||||
|
||||
input-gpios
|
||||
= <&pro_micro 18 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -47,6 +47,7 @@ RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-direct";
|
||||
wakeup-source;
|
||||
|
||||
input-gpios
|
||||
= <&pro_micro 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||
, <&pro_micro 18 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -26,6 +26,7 @@ RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7)
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -35,6 +35,7 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,13) RC(4,12
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) /**/ RC(3,6) RC(3,9
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -32,6 +32,7 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "row2col";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -32,6 +32,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,2) RC(4,9) RC(3,6) RC(3,7)
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -63,6 +63,7 @@ RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
};
|
||||
|
|
|
@ -32,6 +32,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7)
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(3,4) RC(3,5) RC(2,5) RC(2,6) RC(2,7)
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7)
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -33,6 +33,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
/ {
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
= <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
/ {
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
diode-direction = "col2row";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -26,6 +26,7 @@ RC(0,0) RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8)
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
diode-direction = "row2col";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*/
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
*/
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8)
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -38,6 +38,8 @@ RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(3,7)
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -27,6 +27,8 @@ RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(5,0) RC(5,1) RC(5,2) RC(5,3)
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -28,6 +28,8 @@ RC(6,0) RC(6,1) RC(6,2) RC(6,3) RC(6,4) RC(6,5)
|
|||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7)
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "row2col";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "row2col";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
kscan: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "row2col";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
kscan: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
diode-direction = "row2col";
|
||||
|
||||
row-gpios
|
||||
|
|
|
@ -34,6 +34,7 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7)
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "row2col";
|
||||
row-gpios
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
/ {
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-direct";
|
||||
wakeup-source;
|
||||
|
||||
input-gpios
|
||||
= <&pro_micro 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||
|
|
|
@ -31,6 +31,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5)
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -20,4 +20,7 @@ config ZMK_RGB_UNDERGLOW
|
|||
select WS2812_STRIP
|
||||
select SPI
|
||||
|
||||
config ZMK_PM_SOFT_OFF
|
||||
default y if BOARD_NRF52840DK_NRF52840
|
||||
|
||||
endif
|
||||
|
|
|
@ -12,6 +12,15 @@
|
|||
bias-pull-up;
|
||||
};
|
||||
};
|
||||
|
||||
qdec_sleep: qdec_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(QDEC_A, 1, 11)>,
|
||||
<NRF_PSEL(QDEC_B, 1, 10)>;
|
||||
bias-pull-up;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// Set up the QDEC hardware based driver and give it the same label as the deleted node.
|
||||
|
@ -20,6 +29,38 @@ encoder: &qdec0 {
|
|||
led-pre = <0>;
|
||||
steps = <80>;
|
||||
pinctrl-0 = <&qdec_default>;
|
||||
pinctrl-1 = <&qdec_default>;
|
||||
pinctrl-1 = <&qdec_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
hw_soft_off: hw_soft_off {
|
||||
compatible = "zmk,behavior-soft-off";
|
||||
#binding-cells = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
soft_off_direct_kscan: soft_off_direct_kscan {
|
||||
compatible = "zmk,kscan-gpio-direct";
|
||||
input-keys = <&button0>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
soft_off_sideband_behaviors {
|
||||
compatible = "zmk,kscan-sideband-behaviors";
|
||||
kscan = <&soft_off_direct_kscan>;
|
||||
soft_off {
|
||||
row = <0>;
|
||||
column = <0>;
|
||||
bindings = <&hw_soft_off>;
|
||||
};
|
||||
};
|
||||
|
||||
soft_off_wakers {
|
||||
compatible = "zmk,soft-off-wakeup-sources";
|
||||
status = "okay";
|
||||
|
||||
wakeup-sources = <&soft_off_direct_kscan>;
|
||||
};
|
||||
};
|
|
@ -40,7 +40,7 @@ nice_view_spi: &arduino_spi {
|
|||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,kscan = &kscan_matrix_comp;
|
||||
zmk,kscan = &kscan_matrix;
|
||||
zmk,backlight = &backlight;
|
||||
zmk,underglow = &led_strip;
|
||||
zmk,matrix-transform = &matrix_transform;
|
||||
|
@ -74,7 +74,6 @@ nice_view_spi: &arduino_spi {
|
|||
map = <
|
||||
RC(0,0) RC(0,1)
|
||||
RC(1,0) RC(1,1)
|
||||
RC(2,0) RC(2,1) RC(2,2)
|
||||
>;
|
||||
};
|
||||
|
||||
|
@ -86,44 +85,12 @@ nice_view_spi: &arduino_spi {
|
|||
map = <
|
||||
RC(0,0) RC(0,1)
|
||||
RC(0,2) RC(0,3)
|
||||
RC(1,0) RC(1,1) RC(1,2)
|
||||
>;
|
||||
};
|
||||
|
||||
|
||||
kscan_matrix_comp: kscan_matrix_comp {
|
||||
compatible = "zmk,kscan-composite";
|
||||
rows = <1>;
|
||||
columns = <7>;
|
||||
|
||||
matrix {
|
||||
kscan = <&kscan_matrix>;
|
||||
};
|
||||
|
||||
toggle {
|
||||
kscan = <&kscan_sp3t_toggle>;
|
||||
row-offset = <2>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
kscan_direct_comp: kscan_direct_comp {
|
||||
compatible = "zmk,kscan-composite";
|
||||
status = "disabled";
|
||||
|
||||
matrix {
|
||||
kscan = <&kscan_direct>;
|
||||
};
|
||||
|
||||
toggle {
|
||||
kscan = <&kscan_sp3t_toggle>;
|
||||
row-offset = <1>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
kscan_matrix: kscan_matrix {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
|
@ -141,6 +108,7 @@ nice_view_spi: &arduino_spi {
|
|||
|
||||
kscan_direct: kscan_direct {
|
||||
compatible = "zmk,kscan-gpio-direct";
|
||||
wakeup-source;
|
||||
status = "disabled";
|
||||
|
||||
input-gpios
|
||||
|
|
|
@ -9,42 +9,21 @@
|
|||
#include <dt-bindings/zmk/backlight.h>
|
||||
#include <dt-bindings/zmk/bt.h>
|
||||
#include <dt-bindings/zmk/ext_power.h>
|
||||
#include <dt-bindings/zmk/outputs.h>
|
||||
#include <dt-bindings/zmk/rgb.h>
|
||||
|
||||
// Uncomment the following block if using the "Direct Wire" jumper to switch the matrix to a direct wire.
|
||||
// Uncomment the following lines if using the "Direct Wire" jumper to switch the matrix to a direct wire.
|
||||
|
||||
/* :REMOVE ME
|
||||
// &kscan_direct { status = "okay"; };
|
||||
// &kscan_matrix { status = "disabled"; };
|
||||
|
||||
&kscan_direct_comp { status = "okay"; };
|
||||
&kscan_direct { status = "okay"; };
|
||||
&kscan_matrix_comp { status = "disabled"; };
|
||||
&kscan_matrix { status = "disabled"; };
|
||||
// / {
|
||||
// chosen {
|
||||
// zmk,matrix-transform = &direct_matrix_transform;
|
||||
// zmk,kscan = &kscan_direct;
|
||||
// };
|
||||
// };
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,matrix-transform = &direct_matrix_transform;
|
||||
zmk,kscan = &kscan_direct_comp;
|
||||
};
|
||||
};
|
||||
|
||||
REMOVE ME: */
|
||||
|
||||
|
||||
/ {
|
||||
macros {
|
||||
ZMK_MACRO(ble_zero,
|
||||
wait-ms = <1>;
|
||||
tap-ms = <1>;
|
||||
bindings = <&out OUT_BLE &bt BT_SEL 0>;
|
||||
)
|
||||
ZMK_MACRO(ble_one,
|
||||
wait-ms = <1>;
|
||||
tap-ms = <1>;
|
||||
bindings = <&out OUT_BLE &bt BT_SEL 1>;
|
||||
)
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
|
@ -52,8 +31,6 @@ REMOVE ME: */
|
|||
bindings = <
|
||||
&kp A &bl BL_TOG
|
||||
&rgb_ug RGB_EFF &bt BT_CLR
|
||||
|
||||
&out OUT_USB &ble_zero &ble_one
|
||||
>;
|
||||
|
||||
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "zmk_uno.dtsi"
|
||||
|
||||
#include <behaviors.dtsi>
|
||||
#include <dt-bindings/zmk/bt.h>
|
||||
#include <dt-bindings/zmk/outputs.h>
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,matrix-transform = &matrix_transform;
|
||||
|
@ -19,4 +23,37 @@
|
|||
};
|
||||
};
|
||||
|
||||
macros {
|
||||
ZMK_MACRO(ble_zero,
|
||||
wait-ms = <1>;
|
||||
tap-ms = <1>;
|
||||
bindings = <&out OUT_BLE &bt BT_SEL 0>;
|
||||
)
|
||||
ZMK_MACRO(ble_one,
|
||||
wait-ms = <1>;
|
||||
tap-ms = <1>;
|
||||
bindings = <&out OUT_BLE &bt BT_SEL 1>;
|
||||
)
|
||||
};
|
||||
|
||||
endpoint_sideband_behaviors {
|
||||
compatible = "zmk,kscan-sideband-behaviors";
|
||||
kscan = <&kscan_sp3t_toggle>;
|
||||
|
||||
first_toggle_sideband: first_toggle_sideband {
|
||||
column = <0>;
|
||||
bindings = <&out OUT_USB>;
|
||||
};
|
||||
|
||||
second_toggle_sideband: second_toggle_sideband {
|
||||
column = <1>;
|
||||
bindings = <&ble_zero>;
|
||||
};
|
||||
|
||||
third_toggle_sideband: third_toggle_sideband {
|
||||
column = <2>;
|
||||
bindings = <&ble_one>;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -17,16 +17,15 @@
|
|||
|
||||
split_matrix_transform: split_matrix_transform {
|
||||
compatible = "zmk,matrix-transform";
|
||||
rows = <3>;
|
||||
columns = <4>;
|
||||
rows = <4>;
|
||||
columns = <2>;
|
||||
|
||||
map = <
|
||||
RC(0,0) RC(0,1)
|
||||
RC(1,0) RC(1,1)
|
||||
RC(2,0) RC(2,1) RC(2,2)
|
||||
|
||||
RC(3,0) RC(3,1)
|
||||
RC(4,0) RC(4,1)
|
||||
RC(5,0) RC(5,1) RC(5,2)
|
||||
>;
|
||||
};
|
||||
|
||||
|
@ -38,10 +37,9 @@
|
|||
map = <
|
||||
RC(0,0) RC(0,1)
|
||||
RC(0,2) RC(0,3)
|
||||
RC(1,0) RC(1,1) RC(1,2)
|
||||
|
||||
RC(2,0) RC(2,1)
|
||||
RC(2,2) RC(2,3)
|
||||
RC(3,0) RC(3,1) RC(3,2)
|
||||
>;
|
||||
};
|
||||
|
||||
|
|
|
@ -12,38 +12,20 @@
|
|||
#include <dt-bindings/zmk/outputs.h>
|
||||
#include <dt-bindings/zmk/rgb.h>
|
||||
|
||||
// Uncomment the following block if using the "Direct Wire" jumper to switch the matrix to a direct wire.
|
||||
// Uncomment the following lines if using the "Direct Wire" jumper to switch the matrix to a direct wire.
|
||||
|
||||
/* :REMOVE ME
|
||||
|
||||
&kscan_direct_comp { status = "okay"; };
|
||||
&kscan_direct { status = "okay"; };
|
||||
&kscan_matrix_comp { status = "disabled"; };
|
||||
&kscan_matrix { status = "disabled"; };
|
||||
// &kscan_direct { status = "okay"; };
|
||||
// &kscan_matrix { status = "disabled"; };
|
||||
|
||||
// / {
|
||||
// chosen {
|
||||
// zmk,matrix-transform = &split_direct_matrix_transform;
|
||||
// zmk,kscan = &kscan_direct;
|
||||
// };
|
||||
// };
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,matrix-transform = &split_direct_matrix_transform;
|
||||
zmk,kscan = &kscan_direct_comp;
|
||||
};
|
||||
};
|
||||
|
||||
REMOVE ME: */
|
||||
|
||||
|
||||
/ {
|
||||
macros {
|
||||
ZMK_MACRO(ble_zero,
|
||||
wait-ms = <1>;
|
||||
tap-ms = <1>;
|
||||
bindings = <&out OUT_BLE &bt BT_SEL 0>;
|
||||
)
|
||||
ZMK_MACRO(ble_one,
|
||||
wait-ms = <1>;
|
||||
tap-ms = <1>;
|
||||
bindings = <&out OUT_BLE &bt BT_SEL 1>;
|
||||
)
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
@ -53,11 +35,8 @@ REMOVE ME: */
|
|||
&kp A &bl BL_TOG
|
||||
&rgb_ug RGB_EFF &bt BT_CLR
|
||||
|
||||
&out OUT_USB &ble_zero &ble_one
|
||||
|
||||
&kp C &kp D
|
||||
&kp E &kp F
|
||||
&none &none &none
|
||||
>;
|
||||
|
||||
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>;
|
||||
|
|
|
@ -33,6 +33,7 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) R
|
|||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
wakeup-source;
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
|
|
|
@ -20,3 +20,4 @@
|
|||
#include <behaviors/backlight.dtsi>
|
||||
#include <behaviors/macros.dtsi>
|
||||
#include <behaviors/mouse_key_press.dtsi>
|
||||
#include <behaviors/soft_off.dtsi>
|
||||
|
|
15
app/dts/behaviors/soft_off.dtsi
Normal file
15
app/dts/behaviors/soft_off.dtsi
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2023 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
/omit-if-no-ref/ soft_off: keymap_soft_off {
|
||||
compatible = "zmk,behavior-soft-off";
|
||||
#binding-cells = <0>;
|
||||
split-peripheral-off-on-press;
|
||||
};
|
||||
};
|
||||
};
|
17
app/dts/bindings/behaviors/zmk,behavior-soft-off.yaml
Normal file
17
app/dts/bindings/behaviors/zmk,behavior-soft-off.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Copyright (c) 2023 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: Soft-Off Behavior
|
||||
|
||||
compatible: "zmk,behavior-soft-off"
|
||||
|
||||
include: zero_param.yaml
|
||||
|
||||
properties:
|
||||
hold-time-ms:
|
||||
type: int
|
||||
required: false
|
||||
description: Number of milliseconds the behavior must be held before releasing will actually trigger a soft-off.
|
||||
split-peripheral-off-on-press:
|
||||
type: boolean
|
||||
description: When built for a split peripheral, turn off on press, not release
|
30
app/dts/bindings/kscan/zmk,kscan-sideband-behaviors.yaml
Normal file
30
app/dts/bindings/kscan/zmk,kscan-sideband-behaviors.yaml
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Copyright (c) 2023, The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: |
|
||||
kscan sideband behavior runner. Only basic system behaviors should be used,
|
||||
since no keymap processing occurs when using them. Primarily, that means avoiding
|
||||
using tap-holds, sticky keys, etc. as sideband behaviors.
|
||||
|
||||
compatible: "zmk,kscan-sideband-behaviors"
|
||||
|
||||
include: kscan.yaml
|
||||
|
||||
properties:
|
||||
kscan:
|
||||
type: phandle
|
||||
required: true
|
||||
|
||||
child-binding:
|
||||
description: "A sideband behavior tied to a row/column pair"
|
||||
|
||||
properties:
|
||||
row:
|
||||
type: int
|
||||
default: 0
|
||||
column:
|
||||
type: int
|
||||
required: true
|
||||
bindings:
|
||||
type: phandle-array
|
||||
required: true
|
18
app/dts/bindings/zmk,gpio-key-wakeup-trigger.yaml
Normal file
18
app/dts/bindings/zmk,gpio-key-wakeup-trigger.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Copyright (c) 2023 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: |
|
||||
Driver for a dedicated key for waking the device from sleep
|
||||
|
||||
compatible: "zmk,gpio-key-wakeup-trigger"
|
||||
|
||||
include: base.yaml
|
||||
|
||||
properties:
|
||||
trigger:
|
||||
type: phandle
|
||||
required: true
|
||||
description: The GPIO key that triggers wake via interrupt
|
||||
extra-gpios:
|
||||
type: phandle-array
|
||||
description: Optional set of pins that should be set active before sleeping.
|
14
app/dts/bindings/zmk,soft-off-wakeup-sources.yaml
Normal file
14
app/dts/bindings/zmk,soft-off-wakeup-sources.yaml
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Copyright (c) 2023 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: |
|
||||
Description of all possible wakeup-sources from a forced
|
||||
soft-off state.
|
||||
|
||||
compatible: "zmk,soft-off-wakeup-sources"
|
||||
|
||||
properties:
|
||||
wakeup-sources:
|
||||
type: phandles
|
||||
required: true
|
||||
description: List of wakeup-sources that should be enabled to wake the system from forced soft-off state.
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2023 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <zephyr/linker/linker-defs.h>
|
||||
|
||||
ITERABLE_SECTION_RAM(zmk_pm_device_slots, 4)
|
|
@ -73,3 +73,5 @@ int zmk_endpoints_send_report(uint16_t usage_page);
|
|||
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||
int zmk_endpoints_send_mouse_report();
|
||||
#endif // IS_ENABLE(CONFIG_ZMK_MOUSE)
|
||||
|
||||
void zmk_endpoints_clear_current(void);
|
||||
|
|
12
app/include/zmk/pm.h
Normal file
12
app/include/zmk/pm.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2023 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
int zmk_pm_suspend_devices(void);
|
||||
void zmk_pm_resume_devices(void);
|
||||
|
||||
int zmk_pm_soft_off(void);
|
|
@ -47,14 +47,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
|||
#define USES_POLLING DT_INST_FOREACH_STATUS_OKAY(WITHOUT_INTR) > 0
|
||||
#define USES_INTERRUPT DT_INST_FOREACH_STATUS_OKAY(WITH_INTR) > 0
|
||||
|
||||
#if USES_POLLING && USES_INTERRUPT
|
||||
#define USES_POLL_AND_INTR 1
|
||||
#else
|
||||
#define USES_POLL_AND_INTR 0
|
||||
#endif
|
||||
|
||||
#define COND_ANY_POLLING(code) COND_CODE_1(USES_POLLING, code, ())
|
||||
#define COND_POLL_AND_INTR(code) COND_CODE_1(USES_POLL_AND_INTR, code, ())
|
||||
#define COND_THIS_INTERRUPT(n, code) COND_CODE_1(INST_INTR_DEFINED(n), code, ())
|
||||
|
||||
#define KSCAN_INTR_CFG_INIT(inst_idx) GPIO_DT_SPEC_GET(DT_DRV_INST(inst_idx), interrupt_gpios)
|
||||
|
@ -410,7 +403,7 @@ static const struct kscan_driver_api kscan_charlieplex_api = {
|
|||
}, \
|
||||
.debounce_scan_period_ms = DT_INST_PROP(n, debounce_scan_period_ms), \
|
||||
COND_ANY_POLLING((.poll_period_ms = DT_INST_PROP(n, poll_period_ms), )) \
|
||||
COND_POLL_AND_INTR((.use_interrupt = INST_INTR_DEFINED(n), )) \
|
||||
COND_THIS_INTERRUPT(n, (.use_interrupt = INST_INTR_DEFINED(n), )) \
|
||||
COND_THIS_INTERRUPT(n, (.interrupt = KSCAN_INTR_CFG_INIT(n), ))}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(n, &kscan_charlieplex_init, NULL, &kscan_charlieplex_data_##n, \
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <zephyr/drivers/kscan.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/pm/device.h>
|
||||
#include <zephyr/sys/util.h>
|
||||
|
||||
#include <zmk/debounce.h>
|
||||
|
@ -41,9 +42,14 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
|||
#define COND_POLL_OR_INTERRUPTS(pollcode, intcode) \
|
||||
COND_CODE_1(CONFIG_ZMK_KSCAN_DIRECT_POLLING, pollcode, intcode)
|
||||
|
||||
#define INST_INPUTS_LEN(n) DT_INST_PROP_LEN(n, input_gpios)
|
||||
#define KSCAN_DIRECT_INPUT_CFG_INIT(idx, inst_idx) \
|
||||
#define INST_INPUTS_LEN(n) \
|
||||
COND_CODE_1(DT_INST_NODE_HAS_PROP(n, input_gpios), (DT_INST_PROP_LEN(n, input_gpios)), \
|
||||
(DT_INST_PROP_LEN(n, input_keys)))
|
||||
|
||||
#define KSCAN_GPIO_DIRECT_INPUT_CFG_INIT(idx, inst_idx) \
|
||||
KSCAN_GPIO_GET_BY_IDX(DT_DRV_INST(inst_idx), input_gpios, idx)
|
||||
#define KSCAN_KEY_DIRECT_INPUT_CFG_INIT(idx, inst_idx) \
|
||||
KSCAN_GPIO_GET_BY_IDX(DT_INST_PROP_BY_IDX(inst_idx, input_keys, idx), gpios, 0)
|
||||
|
||||
struct kscan_direct_irq_callback {
|
||||
const struct device *dev;
|
||||
|
@ -318,6 +324,21 @@ static int kscan_direct_init(const struct device *dev) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if IS_ENABLED(CONFIG_PM_DEVICE)
|
||||
|
||||
static int kscan_direct_pm_action(const struct device *dev, enum pm_device_action action) {
|
||||
switch (action) {
|
||||
case PM_DEVICE_ACTION_SUSPEND:
|
||||
return kscan_direct_disable(dev);
|
||||
case PM_DEVICE_ACTION_RESUME:
|
||||
return kscan_direct_enable(dev);
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // IS_ENABLED(CONFIG_PM_DEVICE)
|
||||
|
||||
static const struct kscan_driver_api kscan_direct_api = {
|
||||
.config = kscan_direct_configure,
|
||||
.enable_callback = kscan_direct_enable,
|
||||
|
@ -331,7 +352,9 @@ static const struct kscan_driver_api kscan_direct_api = {
|
|||
"ZMK_KSCAN_DEBOUNCE_RELEASE_MS or debounce-release-ms is too large"); \
|
||||
\
|
||||
static struct kscan_gpio kscan_direct_inputs_##n[] = { \
|
||||
LISTIFY(INST_INPUTS_LEN(n), KSCAN_DIRECT_INPUT_CFG_INIT, (, ), n)}; \
|
||||
COND_CODE_1(DT_INST_NODE_HAS_PROP(n, input_gpios), \
|
||||
(LISTIFY(INST_INPUTS_LEN(n), KSCAN_GPIO_DIRECT_INPUT_CFG_INIT, (, ), n)), \
|
||||
(LISTIFY(INST_INPUTS_LEN(n), KSCAN_KEY_DIRECT_INPUT_CFG_INIT, (, ), n)))}; \
|
||||
\
|
||||
static struct zmk_debounce_state kscan_direct_state_##n[INST_INPUTS_LEN(n)]; \
|
||||
\
|
||||
|
@ -354,7 +377,9 @@ static const struct kscan_driver_api kscan_direct_api = {
|
|||
.toggle_mode = DT_INST_PROP(n, toggle_mode), \
|
||||
}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(n, &kscan_direct_init, NULL, &kscan_direct_data_##n, \
|
||||
PM_DEVICE_DT_INST_DEFINE(n, kscan_direct_pm_action); \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(n, &kscan_direct_init, PM_DEVICE_DT_INST_GET(n), &kscan_direct_data_##n, \
|
||||
&kscan_direct_config_##n, POST_KERNEL, CONFIG_KSCAN_INIT_PRIORITY, \
|
||||
&kscan_direct_api);
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <zephyr/devicetree.h>
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
#include <zephyr/drivers/kscan.h>
|
||||
#include <zephyr/pm/device.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/sys/__assert.h>
|
||||
|
@ -421,6 +422,21 @@ static int kscan_matrix_init(const struct device *dev) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if IS_ENABLED(CONFIG_PM_DEVICE)
|
||||
|
||||
static int kscan_matrix_pm_action(const struct device *dev, enum pm_device_action action) {
|
||||
switch (action) {
|
||||
case PM_DEVICE_ACTION_SUSPEND:
|
||||
return kscan_matrix_disable(dev);
|
||||
case PM_DEVICE_ACTION_RESUME:
|
||||
return kscan_matrix_enable(dev);
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // IS_ENABLED(CONFIG_PM_DEVICE)
|
||||
|
||||
static const struct kscan_driver_api kscan_matrix_api = {
|
||||
.config = kscan_matrix_configure,
|
||||
.enable_callback = kscan_matrix_enable,
|
||||
|
@ -465,7 +481,9 @@ static const struct kscan_driver_api kscan_matrix_api = {
|
|||
.diode_direction = INST_DIODE_DIR(n), \
|
||||
}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(n, &kscan_matrix_init, NULL, &kscan_matrix_data_##n, \
|
||||
PM_DEVICE_DT_INST_DEFINE(n, kscan_matrix_pm_action); \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(n, &kscan_matrix_init, PM_DEVICE_DT_INST_GET(n), &kscan_matrix_data_##n, \
|
||||
&kscan_matrix_config_##n, POST_KERNEL, CONFIG_KSCAN_INIT_PRIORITY, \
|
||||
&kscan_matrix_api);
|
||||
|
||||
|
|
|
@ -10,7 +10,11 @@ include: kscan.yaml
|
|||
properties:
|
||||
input-gpios:
|
||||
type: phandle-array
|
||||
required: true
|
||||
required: false
|
||||
input-keys:
|
||||
type: phandles
|
||||
required: false
|
||||
description: List of gpio-key references
|
||||
debounce-period:
|
||||
type: int
|
||||
required: false
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include <zephyr/device.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/pm/device.h>
|
||||
#include <zephyr/pm/device_runtime.h>
|
||||
#include <zephyr/sys/poweroff.h>
|
||||
|
||||
#include <zephyr/logging/log.h>
|
||||
|
@ -20,69 +18,14 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
|||
#include <zmk/events/position_state_changed.h>
|
||||
#include <zmk/events/sensor_event.h>
|
||||
|
||||
#include <zmk/pm.h>
|
||||
|
||||
#include <zmk/activity.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
|
||||
#include <zmk/usb.h>
|
||||
#endif
|
||||
|
||||
// Reimplement some of the device work from Zephyr PM to work with the new `sys_poweroff` API.
|
||||
// TODO: Tweak this to smarter runtime PM of subsystems on sleep.
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
TYPE_SECTION_START_EXTERN(const struct device *, zmk_pm_device_slots);
|
||||
|
||||
#if !defined(CONFIG_PM_DEVICE_RUNTIME_EXCLUSIVE)
|
||||
/* Number of devices successfully suspended. */
|
||||
static size_t zmk_num_susp;
|
||||
|
||||
static int zmk_pm_suspend_devices(void) {
|
||||
const struct device *devs;
|
||||
size_t devc;
|
||||
|
||||
devc = z_device_get_all_static(&devs);
|
||||
|
||||
zmk_num_susp = 0;
|
||||
|
||||
for (const struct device *dev = devs + devc - 1; dev >= devs; dev--) {
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Ignore uninitialized devices, busy devices, wake up sources, and
|
||||
* devices with runtime PM enabled.
|
||||
*/
|
||||
if (!device_is_ready(dev) || pm_device_is_busy(dev) || pm_device_state_is_locked(dev) ||
|
||||
pm_device_wakeup_is_enabled(dev) || pm_device_runtime_is_enabled(dev)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = pm_device_action_run(dev, PM_DEVICE_ACTION_SUSPEND);
|
||||
/* ignore devices not supporting or already at the given state */
|
||||
if ((ret == -ENOSYS) || (ret == -ENOTSUP) || (ret == -EALREADY)) {
|
||||
continue;
|
||||
} else if (ret < 0) {
|
||||
LOG_ERR("Device %s did not enter %s state (%d)", dev->name,
|
||||
pm_device_state_str(PM_DEVICE_STATE_SUSPENDED), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
TYPE_SECTION_START(zmk_pm_device_slots)[zmk_num_susp] = dev;
|
||||
zmk_num_susp++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void zmk_pm_resume_devices(void) {
|
||||
for (int i = (zmk_num_susp - 1); i >= 0; i--) {
|
||||
pm_device_action_run(TYPE_SECTION_START(zmk_pm_device_slots)[i], PM_DEVICE_ACTION_RESUME);
|
||||
}
|
||||
|
||||
zmk_num_susp = 0;
|
||||
}
|
||||
#endif /* !CONFIG_PM_DEVICE_RUNTIME_EXCLUSIVE */
|
||||
#endif /* CONFIG_PM_DEVICE */
|
||||
|
||||
bool is_usb_power_present(void) {
|
||||
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
|
||||
return zmk_usb_is_powered();
|
||||
|
|
|
@ -34,11 +34,29 @@ static const struct device *const battery = DEVICE_DT_GET(DT_CHOSEN(zmk_battery)
|
|||
static const struct device *battery;
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_FETCH_MODE_LITHIUM_VOLTAGE)
|
||||
static uint8_t lithium_ion_mv_to_pct(int16_t bat_mv) {
|
||||
// Simple linear approximation of a battery based off adafruit's discharge graph:
|
||||
// https://learn.adafruit.com/li-ion-and-lipoly-batteries/voltages
|
||||
|
||||
if (bat_mv >= 4200) {
|
||||
return 100;
|
||||
} else if (bat_mv <= 3450) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return bat_mv * 2 / 15 - 459;
|
||||
}
|
||||
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_FETCH_MODE_LITHIUM_VOLTAGE)
|
||||
|
||||
static int zmk_battery_update(const struct device *battery) {
|
||||
struct sensor_value state_of_charge;
|
||||
int rc;
|
||||
|
||||
int rc = sensor_sample_fetch_chan(battery, SENSOR_CHAN_GAUGE_STATE_OF_CHARGE);
|
||||
#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_FETCH_MODE_STATE_OF_CHARGE)
|
||||
|
||||
rc = sensor_sample_fetch_chan(battery, SENSOR_CHAN_GAUGE_STATE_OF_CHARGE);
|
||||
if (rc != 0) {
|
||||
LOG_DBG("Failed to fetch battery values: %d", rc);
|
||||
return rc;
|
||||
|
@ -50,6 +68,28 @@ static int zmk_battery_update(const struct device *battery) {
|
|||
LOG_DBG("Failed to get battery state of charge: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
#elif IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_FETCH_MODE_LITHIUM_VOLTAGE)
|
||||
rc = sensor_sample_fetch_chan(battery, SENSOR_CHAN_VOLTAGE);
|
||||
if (rc != 0) {
|
||||
LOG_DBG("Failed to fetch battery values: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
struct sensor_value voltage;
|
||||
rc = sensor_channel_get(battery, SENSOR_CHAN_VOLTAGE, &voltage);
|
||||
|
||||
if (rc != 0) {
|
||||
LOG_DBG("Failed to get battery voltage: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
uint16_t mv = voltage.val1 * 1000 + (voltage.val2 / 1000);
|
||||
state_of_charge.val1 = lithium_ion_mv_to_pct(mv);
|
||||
|
||||
LOG_DBG("State of change %d from %d mv", state_of_charge.val1, mv);
|
||||
#else
|
||||
#error "Not a supported reporting fetch mode"
|
||||
#endif
|
||||
|
||||
if (last_state_of_charge != state_of_charge.val1) {
|
||||
last_state_of_charge = state_of_charge.val1;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue