massive update
This commit is contained in:
commit
b23d780274
159 changed files with 10271 additions and 25459 deletions
|
@ -1,4 +1,4 @@
|
||||||
FROM zmkfirmware/zmk-dev-arm:2.4
|
FROM zmkfirmware/zmk-dev-arm:2.5
|
||||||
|
|
||||||
COPY .bashrc tmp
|
COPY .bashrc tmp
|
||||||
RUN mv /tmp/.bashrc ~/.bashrc
|
RUN mv /tmp/.bashrc ~/.bashrc
|
||||||
|
|
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
|
@ -14,12 +14,13 @@ jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: zmkfirmware/zmk-build-arm:2.4
|
image: zmkfirmware/zmk-build-arm:2.5
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
board:
|
board:
|
||||||
- bluemicro840_v1
|
- bluemicro840_v1
|
||||||
- nice_nano
|
- nice_nano
|
||||||
|
- nice_nano_v2
|
||||||
- nrfmicro_13
|
- nrfmicro_13
|
||||||
- proton_c
|
- proton_c
|
||||||
shield:
|
shield:
|
||||||
|
@ -69,11 +70,11 @@ jobs:
|
||||||
- board: planck_rev6
|
- board: planck_rev6
|
||||||
- board: proton_c
|
- board: proton_c
|
||||||
shield: clueboard_california
|
shield: clueboard_california
|
||||||
- board: nice_nano
|
- board: nice_nano_v2
|
||||||
shield: kyria_left
|
shield: kyria_left
|
||||||
cmake-args: -DCONFIG_ZMK_DISPLAY=y
|
cmake-args: -DCONFIG_ZMK_DISPLAY=y
|
||||||
skip-archive: true
|
skip-archive: true
|
||||||
- board: nice_nano
|
- board: nice_nano_v2
|
||||||
shield: kyria_right
|
shield: kyria_right
|
||||||
cmake-args: -DCONFIG_ZMK_DISPLAY=y
|
cmake-args: -DCONFIG_ZMK_DISPLAY=y
|
||||||
skip-archive: true
|
skip-archive: true
|
||||||
|
|
2
.github/workflows/clang-format-lint.yml
vendored
2
.github/workflows/clang-format-lint.yml
vendored
|
@ -23,7 +23,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: DoozyX/clang-format-lint-action@v0.11
|
- uses: DoozyX/clang-format-lint-action@v0.12
|
||||||
with:
|
with:
|
||||||
source: "./app"
|
source: "./app"
|
||||||
extensions: "h,c"
|
extensions: "h,c"
|
||||||
|
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -16,7 +16,7 @@ jobs:
|
||||||
integration_test:
|
integration_test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: zmkfirmware/zmk-build-arm:2.4
|
image: zmkfirmware/zmk-build-arm:2.5
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
|
@ -60,7 +60,7 @@ representative at an online or offline event.
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
reported to the community leaders responsible for enforcement at
|
reported to the community leaders responsible for enforcement at
|
||||||
conduct@zmkfirmware.dev.
|
conduct@zmk.dev.
|
||||||
All complaints will be reviewed and investigated promptly and fairly.
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
All community leaders are obligated to respect the privacy and security of the
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
|
|
@ -7,7 +7,7 @@ you have any questions, please come join us on the
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
|
||||||
All community members are expected to abide by the [Code of Conduct][code-of-conduct].
|
All community members are expected to abide by the [Code of Conduct][code-of-conduct].
|
||||||
For any and all conduct inquiries or concerns, please contact conduct@zmkfirmware.dev.
|
For any and all conduct inquiries or concerns, please contact conduct@zmk.dev.
|
||||||
|
|
||||||
[code-of-conduct]: https://github.com/zmkfirmware/zmk/blob/main/CODE_OF_CONDUCT.md
|
[code-of-conduct]: https://github.com/zmkfirmware/zmk/blob/main/CODE_OF_CONDUCT.md
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ ZMK project.
|
||||||
|
|
||||||
### Before Submitting a Report
|
### Before Submitting a Report
|
||||||
|
|
||||||
- Review the [Frequently Asked Questions](https://zmkfirmware.dev/docs/faq).
|
- Review the [Frequently Asked Questions](https://zmk.dev/docs/faq).
|
||||||
- Check the [Troubleshooting Guide](https://zmkfirmware.dev/docs/troubleshooting) for answers.
|
- Check the [Troubleshooting Guide](https://zmk.dev/docs/troubleshooting) for answers.
|
||||||
- Search the [open issues](https://github.com/zmkfirmware/zmk/issues) for an existing report that
|
- Search the [open issues](https://github.com/zmkfirmware/zmk/issues) for an existing report that
|
||||||
matches your problem.
|
matches your problem.
|
||||||
|
|
||||||
|
@ -47,10 +47,10 @@ To open a report:
|
||||||
- Head to https://github.com/zmkfirmware/zmk/issues/new
|
- Head to https://github.com/zmkfirmware/zmk/issues/new
|
||||||
- Provide an accurate summary of the issue in the title.
|
- Provide an accurate summary of the issue in the title.
|
||||||
- Provide as much detail as you can about the issue including:
|
- Provide as much detail as you can about the issue including:
|
||||||
- What [board/shield](https://zmkfirmware.dev/docs/faq#what-is-a-board) you are using.
|
- What [board/shield](https://zmk.dev/docs/faq#what-is-a-board) you are using.
|
||||||
- A link to the user repository, if you used it to build your firmware.
|
- A link to the user repository, if you used it to build your firmware.
|
||||||
- Exact steps to reproduce the problem.
|
- Exact steps to reproduce the problem.
|
||||||
- Any relevant screenshots or [logs](https://zmkfirmware.dev/docs/dev-guide-usb-logging)
|
- Any relevant screenshots or [logs](https://zmk.dev/docs/dev-guide-usb-logging)
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ You can setup git to run prettier automatically when you commit by installing th
|
||||||
### Development Setup
|
### Development Setup
|
||||||
|
|
||||||
To get your development environment setup going, start at the
|
To get your development environment setup going, start at the
|
||||||
[basic setup](https://zmkfirmware.dev/docs/dev-setup) docs, and make sure you can build and flash
|
[basic setup](https://zmk.dev/docs/dev-setup) docs, and make sure you can build and flash
|
||||||
your own locally built firmware.
|
your own locally built firmware.
|
||||||
|
|
||||||
### Formatting
|
### Formatting
|
||||||
|
@ -124,4 +124,4 @@ When opening a pull request with your changes, please:
|
||||||
- Requested testing by reviewers or testers.
|
- Requested testing by reviewers or testers.
|
||||||
- Screenshots or logs that support understanding the change.
|
- Screenshots or logs that support understanding the change.
|
||||||
|
|
||||||
[discord-invite]: https://zmkfirmware.dev/community/discord/invite
|
[discord-invite]: https://zmk.dev/community/discord/invite
|
||||||
|
|
10
README.md
10
README.md
|
@ -1,13 +1,13 @@
|
||||||
# Zephyr™ Mechanical Keyboard (ZMK) Firmware
|
# Zephyr™ Mechanical Keyboard (ZMK) Firmware
|
||||||
|
|
||||||
[](https://zmkfirmware.dev/community/discord/invite)
|
[](https://zmk.dev/community/discord/invite)
|
||||||
[](https://github.com/zmkfirmware/zmk/actions)
|
[](https://github.com/zmkfirmware/zmk/actions)
|
||||||
[](CODE_OF_CONDUCT.md)
|
[](CODE_OF_CONDUCT.md)
|
||||||
|
|
||||||
[ZMK Firmware](https://zmkfirmware.dev/) is an open source (MIT) keyboard firmware built on the [Zephyr™ Project](https://www.zephyrproject.org/) Real Time Operating System (RTOS). ZMK's goal is to provide a modern, wireless, and powerful firmware free of licensing issues.
|
[ZMK Firmware](https://zmk.dev/) is an open source (MIT) keyboard firmware built on the [Zephyr™ Project](https://www.zephyrproject.org/) Real Time Operating System (RTOS). ZMK's goal is to provide a modern, wireless, and powerful firmware free of licensing issues.
|
||||||
|
|
||||||
Check out the website to learn more: https://zmkfirmware.dev/
|
Check out the website to learn more: https://zmk.dev/
|
||||||
|
|
||||||
You can also come join our [ZMK Discord Server](https://zmkfirmware.dev/community/discord/invite)
|
You can also come join our [ZMK Discord Server](https://zmk.dev/community/discord/invite)
|
||||||
|
|
||||||
To review features, check out the [feature overview](https://zmkfirmware.dev/docs/). ZMK is under active development, and new features are listed with the [enhancement label](https://github.com/zmkfirmware/zmk/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement) in GitHub. Please feel free to add 👍 to the issue description of any requests to upvote the feature.
|
To review features, check out the [feature overview](https://zmk.dev/docs/). ZMK is under active development, and new features are listed with the [enhancement label](https://github.com/zmkfirmware/zmk/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement) in GitHub. Please feel free to add 👍 to the issue description of any requests to upvote the feature.
|
||||||
|
|
10
app/Kconfig
10
app/Kconfig
|
@ -263,11 +263,8 @@ config ZMK_SLEEP
|
||||||
|
|
||||||
if ZMK_SLEEP
|
if ZMK_SLEEP
|
||||||
|
|
||||||
config SYS_POWER_DEEP_SLEEP_STATES
|
|
||||||
default y
|
|
||||||
|
|
||||||
choice SYS_PM_POLICY
|
choice SYS_PM_POLICY
|
||||||
default SYS_PM_POLICY_APP
|
default PM_POLICY_APP
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config DEVICE_POWER_MANAGEMENT
|
config DEVICE_POWER_MANAGEMENT
|
||||||
|
@ -422,6 +419,11 @@ config ZMK_WPM
|
||||||
config SENSOR
|
config SENSOR
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
choice CBPRINTF_IMPLEMENTATION
|
||||||
|
default CBPRINTF_NANO
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
module = ZMK
|
module = ZMK
|
||||||
module-str = zmk
|
module-str = zmk
|
||||||
source "subsys/logging/Kconfig.template.log_config"
|
source "subsys/logging/Kconfig.template.log_config"
|
||||||
|
|
|
@ -11,6 +11,9 @@ CONFIG_FPU=y
|
||||||
# enable GPIO
|
# enable GPIO
|
||||||
CONFIG_GPIO=y
|
CONFIG_GPIO=y
|
||||||
|
|
||||||
|
# Enable pinmux
|
||||||
|
CONFIG_PINMUX=y
|
||||||
|
|
||||||
# Needed to reduce this to size that will fit on F072
|
# Needed to reduce this to size that will fit on F072
|
||||||
CONFIG_HEAP_MEM_POOL_SIZE=1024
|
CONFIG_HEAP_MEM_POOL_SIZE=1024
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
, <7 0 &gpio0 24 0> /* D6/A7 D7*/
|
, <7 0 &gpio0 24 0> /* D6/A7 D7*/
|
||||||
, <8 0 &gpio0 10 0> /* D8/A8 B4*/
|
, <8 0 &gpio0 10 0> /* D8/A8 B4*/
|
||||||
, <9 0 &gpio1 6 0> /* D9/A9 B5*/
|
, <9 0 &gpio1 6 0> /* D9/A9 B5*/
|
||||||
, <10 0 &gpio1 13 0> /* D10/A10 B6*/
|
, <10 0 &gpio1 11 0> /* D10/A10 B6*/
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
leds {
|
leds {
|
||||||
compatible = "gpio-leds";
|
compatible = "gpio-leds";
|
||||||
blue_led: led_0 {
|
blue_led: led_0 {
|
||||||
gpios = <&gpio0 42 GPIO_ACTIVE_HIGH>;
|
gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
|
||||||
label = "Blue LED";
|
label = "Blue LED";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -29,6 +29,7 @@
|
||||||
ext-power {
|
ext-power {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
label = "EXT_POWER";
|
||||||
|
init-delay-ms = <20>;
|
||||||
control-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
control-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
8
app/boards/arm/nice60/CMakeLists.txt
Normal file
8
app/boards/arm/nice60/CMakeLists.txt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py
|
||||||
|
-c
|
||||||
|
-b 0x1000
|
||||||
|
-f 0xADA52840
|
||||||
|
-o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2
|
||||||
|
${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin
|
||||||
|
)
|
8
app/boards/arm/nice60/Kconfig
Normal file
8
app/boards/arm/nice60/Kconfig
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Copyright (c) 2021 Nick Winans
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
config BOARD_ENABLE_DCDC
|
||||||
|
bool "Enable DCDC mode"
|
||||||
|
select SOC_DCDC_NRF52X
|
||||||
|
default y
|
||||||
|
depends on BOARD_NICE60
|
6
app/boards/arm/nice60/Kconfig.board
Normal file
6
app/boards/arm/nice60/Kconfig.board
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Copyright (c) 2021 Nick Winans
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
config BOARD_NICE60
|
||||||
|
bool "nice!60"
|
||||||
|
depends on SOC_NRF52840_QIAA
|
31
app/boards/arm/nice60/Kconfig.defconfig
Normal file
31
app/boards/arm/nice60/Kconfig.defconfig
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# Copyright (c) 2021 Nick Winans
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
if BOARD_NICE60
|
||||||
|
|
||||||
|
config ZMK_KEYBOARD_NAME
|
||||||
|
default "nice!60"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
endif # BOARD_NICE60
|
9
app/boards/arm/nice60/README.md
Normal file
9
app/boards/arm/nice60/README.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# nice!60
|
||||||
|

|
||||||
|
|
||||||
|
The nice!60 is a hotswap 60% made by Nice Keyboards. https://nicekeyboards.com/nice-60
|
||||||
|
|
||||||
|
## Building nice!60 ZMK firmware
|
||||||
|
```
|
||||||
|
west build -p -b nice60
|
||||||
|
```
|
7
app/boards/arm/nice60/board.cmake
Normal file
7
app/boards/arm/nice60/board.cmake
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Copyright (c) 2021 Nick Winans
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
set(OPENOCD_NRF5_SUBFAMILY nrf52)
|
||||||
|
board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
|
||||||
|
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||||
|
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
|
172
app/boards/arm/nice60/nice60.dts
Normal file
172
app/boards/arm/nice60/nice60.dts
Normal file
|
@ -0,0 +1,172 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 Nick Winans
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/dts-v1/;
|
||||||
|
#include <nordic/nrf52840_qiaa.dtsi>
|
||||||
|
#include <dt-bindings/zmk/matrix_transform.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "nice!60";
|
||||||
|
compatible = "nice,60";
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
zephyr,code-partition = &code_partition;
|
||||||
|
zephyr,sram = &sram0;
|
||||||
|
zephyr,flash = &flash0;
|
||||||
|
zmk,kscan = &kscan0;
|
||||||
|
zmk,matrix_transform = &default_transform;
|
||||||
|
zmk,underglow = &led_strip;
|
||||||
|
};
|
||||||
|
|
||||||
|
default_transform: keymap_transform_0 {
|
||||||
|
compatible = "zmk,matrix-transform";
|
||||||
|
columns = <14>;
|
||||||
|
rows = <5>;
|
||||||
|
map = <
|
||||||
|
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11) RC(0,12) RC(0,13)
|
||||||
|
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) RC(1,9) RC(1,10) RC(1,11) RC(1,12) RC(1,13)
|
||||||
|
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(2,9) RC(2,10) RC(2,11) RC(2,13)
|
||||||
|
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,13)
|
||||||
|
RC(4,0) RC(4,1) RC(4,2) RC(4,5) RC(4,9) RC(4,10) RC(4,11) RC(4,13)
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
kscan0: kscan {
|
||||||
|
compatible = "zmk,kscan-gpio-matrix";
|
||||||
|
label = "KSCAN";
|
||||||
|
|
||||||
|
diode-direction = "col2row";
|
||||||
|
row-gpios
|
||||||
|
= <&gpio1 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&gpio1 13 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&gpio1 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&gpio1 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&gpio1 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
;
|
||||||
|
col-gpios
|
||||||
|
= <&gpio1 15 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio0 29 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio0 31 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio0 30 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio0 28 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio0 2 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio0 3 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio1 3 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio1 7 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio1 4 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio1 6 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio1 5 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio1 1 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&gpio1 2 GPIO_ACTIVE_HIGH>
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
blue_led: led_0 {
|
||||||
|
gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
|
||||||
|
label = "Blue LED";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ext-power {
|
||||||
|
compatible = "zmk,ext-power-generic";
|
||||||
|
label = "EXT_POWER";
|
||||||
|
control-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
|
|
||||||
|
vbatt {
|
||||||
|
compatible = "zmk,battery-voltage-divider";
|
||||||
|
label = "BATTERY";
|
||||||
|
io-channels = <&adc 2>;
|
||||||
|
output-ohms = <2000000>;
|
||||||
|
full-ohms = <(2000000 + 806000)>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&adc {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&gpiote {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&gpio0 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&gpio1 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&spi0 {
|
||||||
|
compatible = "nordic,nrf-spim";
|
||||||
|
/* Cannot be used together with i2c0. */
|
||||||
|
status = "okay";
|
||||||
|
sck-pin = <12>;
|
||||||
|
mosi-pin = <27>;
|
||||||
|
miso-pin = <13>;
|
||||||
|
|
||||||
|
led_strip: ws2812@0 {
|
||||||
|
compatible = "worldsemi,ws2812-spi";
|
||||||
|
label = "WS2812";
|
||||||
|
|
||||||
|
/* SPI */
|
||||||
|
reg = <0>; /* ignored, but necessary for SPI bindings */
|
||||||
|
spi-max-frequency = <4000000>;
|
||||||
|
|
||||||
|
/* WS2812 */
|
||||||
|
chain-length = <12>; /* LED strip length */
|
||||||
|
spi-one-frame = <0x70>;
|
||||||
|
spi-zero-frame = <0x40>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&usbd {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&flash0 {
|
||||||
|
/*
|
||||||
|
* For more information, see:
|
||||||
|
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html
|
||||||
|
*/
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
sd_partition: partition@0 {
|
||||||
|
label = "mbr";
|
||||||
|
reg = <0x00000000 0x00001000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
code_partition: partition@1000 {
|
||||||
|
label = "code_partition";
|
||||||
|
reg = <0x00001000 0x000d3000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The flash starting at 0x000d4000 and ending at
|
||||||
|
* 0x000f3fff is reserved for use by the application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Storage partition will be used by FCB/LittleFS/NVS
|
||||||
|
* if enabled.
|
||||||
|
*/
|
||||||
|
storage_partition: partition@d4000 {
|
||||||
|
label = "storage";
|
||||||
|
reg = <0x000d4000 0x00020000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
boot_partition: partition@f4000 {
|
||||||
|
label = "adafruit_boot";
|
||||||
|
reg = <0x000f4000 0x0000c000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
50
app/boards/arm/nice60/nice60.keymap
Normal file
50
app/boards/arm/nice60/nice60.keymap
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 Nick Winans
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <behaviors.dtsi>
|
||||||
|
#include <dt-bindings/zmk/keys.h>
|
||||||
|
#include <dt-bindings/zmk/rgb.h>
|
||||||
|
#include <dt-bindings/zmk/bt.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
keymap {
|
||||||
|
compatible = "zmk,keymap";
|
||||||
|
|
||||||
|
default_layer {
|
||||||
|
// ------------------------------------------------------------------------------------------
|
||||||
|
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP |
|
||||||
|
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | "|" |
|
||||||
|
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER |
|
||||||
|
// | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT |
|
||||||
|
// | CTL | WIN | ALT | SPACE | ALT | WIN | MO(1) | CTL |
|
||||||
|
// ------------------------------------------------------------------------------------------
|
||||||
|
bindings = <
|
||||||
|
&gresc &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC
|
||||||
|
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH
|
||||||
|
&kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET
|
||||||
|
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT
|
||||||
|
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &kp RGUI &mo 1 &kp RCTRL
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
rgb_layer {
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// | BT CLR | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | EFFECT REV |
|
||||||
|
// | BT 1 | | UP | | HUEUP | SATUP | BRIUP | SPDUP | | | | | | |
|
||||||
|
// | BT 2 | LT | DN | RT | HUEDN | SATDN | BRIDN | SPDDN | | | | | EFFECT FORW |
|
||||||
|
// | BT 3 | | | | | | | | | | | |
|
||||||
|
// | BT 4 | | | TOG RGB | PRT SCR | | | DEL |
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
bindings = <
|
||||||
|
&bt BT_CLR &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &rgb_ug RGB_EFR
|
||||||
|
&bt BT_SEL 0 &trans &kp UP &trans &rgb_ug RGB_HUI &rgb_ug RGB_SAI &rgb_ug RGB_BRI &rgb_ug RGB_SPI &trans &trans &trans &trans &trans &trans
|
||||||
|
&bt BT_SEL 1 &kp LEFT &kp DOWN &kp RIGHT &rgb_ug RGB_HUD &rgb_ug RGB_SAD &rgb_ug RGB_BRD &rgb_ug RGB_SPD &trans &trans &trans &trans &rgb_ug RGB_EFF
|
||||||
|
&bt BT_SEL 2 &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
||||||
|
&bt BT_SEL 3 &trans &trans &rgb_ug RGB_TOG &kp PSCRN &trans &trans &kp DEL
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
14
app/boards/arm/nice60/nice60.yaml
Normal file
14
app/boards/arm/nice60/nice60.yaml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
identifier: nice60
|
||||||
|
name: nice!60
|
||||||
|
type: mcu
|
||||||
|
arch: arm
|
||||||
|
toolchain:
|
||||||
|
- zephyr
|
||||||
|
- gnuarmemb
|
||||||
|
supported:
|
||||||
|
- adc
|
||||||
|
- usb_device
|
||||||
|
- ble
|
||||||
|
- ieee802154
|
||||||
|
- pwm
|
||||||
|
- watchdog
|
27
app/boards/arm/nice60/nice60_defconfig
Normal file
27
app/boards/arm/nice60/nice60_defconfig
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Copyright (c) 2021 Nick Winans
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
CONFIG_SOC_SERIES_NRF52X=y
|
||||||
|
CONFIG_SOC_NRF52840_QIAA=y
|
||||||
|
CONFIG_BOARD_NICE60=y
|
||||||
|
|
||||||
|
# Enable MPU
|
||||||
|
CONFIG_ARM_MPU=y
|
||||||
|
|
||||||
|
# enable GPIO
|
||||||
|
CONFIG_GPIO=y
|
||||||
|
|
||||||
|
CONFIG_USE_DT_CODE_PARTITION=y
|
||||||
|
|
||||||
|
CONFIG_MPU_ALLOW_FLASH_WRITE=y
|
||||||
|
CONFIG_NVS=y
|
||||||
|
CONFIG_SETTINGS_NVS=y
|
||||||
|
CONFIG_FLASH=y
|
||||||
|
CONFIG_FLASH_PAGE_LAYOUT=y
|
||||||
|
CONFIG_FLASH_MAP=y
|
||||||
|
|
||||||
|
CONFIG_ZMK_RGB_UNDERGLOW=y
|
||||||
|
CONFIG_WS2812_STRIP=y
|
||||||
|
|
||||||
|
CONFIG_ZMK_RGB_UNDERGLOW_HUE_START=160
|
||||||
|
CONFIG_ZMK_RGB_UNDERGLOW_EFF_START=3
|
|
@ -4,4 +4,4 @@ config BOARD_ENABLE_DCDC
|
||||||
bool "Enable DCDC mode"
|
bool "Enable DCDC mode"
|
||||||
select SOC_DCDC_NRF52X
|
select SOC_DCDC_NRF52X
|
||||||
default y
|
default y
|
||||||
depends on BOARD_NICE_NANO
|
depends on (BOARD_NICE_NANO || BOARD_NICE_NANO_V2)
|
||||||
|
|
|
@ -7,3 +7,7 @@ config BOARD_NICE_NANO
|
||||||
bool "nice!nano"
|
bool "nice!nano"
|
||||||
depends on SOC_NRF52840_QIAA
|
depends on SOC_NRF52840_QIAA
|
||||||
|
|
||||||
|
config BOARD_NICE_NANO_V2
|
||||||
|
bool "nice!nano v2"
|
||||||
|
depends on SOC_NRF52840_QIAA
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright (c) 2020 Pete Johanson
|
# Copyright (c) 2021 The ZMK Contributors
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
if BOARD_NICE_NANO
|
if BOARD_NICE_NANO || BOARD_NICE_NANO_V2
|
||||||
|
|
||||||
config BOARD
|
config BOARD
|
||||||
default "nice_nano"
|
default "nice_nano"
|
||||||
|
@ -28,4 +28,4 @@ config ZMK_USB
|
||||||
config ZMK_BATTERY_VOLTAGE_DIVIDER
|
config ZMK_BATTERY_VOLTAGE_DIVIDER
|
||||||
default y
|
default y
|
||||||
|
|
||||||
endif # BOARD_NICE_NANO
|
endif # BOARD_NICE_NANO || BOARD_NICE_NANO_V2
|
||||||
|
|
|
@ -1,31 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 Pete Johanson
|
* Copyright (c) 2021 The ZMK Contributors
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/dts-v1/;
|
/dts-v1/;
|
||||||
#include <nordic/nrf52840_qiaa.dtsi>
|
#include "nice_nano.dtsi"
|
||||||
#include "arduino_pro_micro_pins.dtsi"
|
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
model = "nice!nano";
|
|
||||||
compatible = "nice,nano";
|
|
||||||
|
|
||||||
chosen {
|
|
||||||
zephyr,code-partition = &code_partition;
|
|
||||||
zephyr,sram = &sram0;
|
|
||||||
zephyr,flash = &flash0;
|
|
||||||
};
|
|
||||||
|
|
||||||
leds {
|
|
||||||
compatible = "gpio-leds";
|
|
||||||
blue_led: led_0 {
|
|
||||||
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
|
|
||||||
label = "Blue LED";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
ext-power {
|
ext-power {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
label = "EXT_POWER";
|
||||||
|
@ -40,76 +22,3 @@
|
||||||
full-ohms = <(2000000 + 806000)>;
|
full-ohms = <(2000000 + 806000)>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
&adc {
|
|
||||||
status = "okay";
|
|
||||||
};
|
|
||||||
|
|
||||||
&gpiote {
|
|
||||||
status = "okay";
|
|
||||||
};
|
|
||||||
|
|
||||||
&gpio0 {
|
|
||||||
status = "okay";
|
|
||||||
};
|
|
||||||
|
|
||||||
&gpio1 {
|
|
||||||
status = "okay";
|
|
||||||
};
|
|
||||||
|
|
||||||
&i2c0 {
|
|
||||||
compatible = "nordic,nrf-twi";
|
|
||||||
sda-pin = <17>;
|
|
||||||
scl-pin = <20>;
|
|
||||||
};
|
|
||||||
|
|
||||||
&uart0 {
|
|
||||||
compatible = "nordic,nrf-uarte";
|
|
||||||
tx-pin = <6>;
|
|
||||||
rx-pin = <8>;
|
|
||||||
};
|
|
||||||
|
|
||||||
&usbd {
|
|
||||||
status = "okay";
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
&flash0 {
|
|
||||||
/*
|
|
||||||
* For more information, see:
|
|
||||||
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html
|
|
||||||
*/
|
|
||||||
partitions {
|
|
||||||
compatible = "fixed-partitions";
|
|
||||||
#address-cells = <1>;
|
|
||||||
#size-cells = <1>;
|
|
||||||
|
|
||||||
sd_partition: partition@0 {
|
|
||||||
label = "softdevice";
|
|
||||||
reg = <0x00000000 0x00026000>;
|
|
||||||
};
|
|
||||||
code_partition: partition@26000 {
|
|
||||||
label = "code_partition";
|
|
||||||
reg = <0x00026000 0x000c6000>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The flash starting at 0x000ec000 and ending at
|
|
||||||
* 0x000f3fff is reserved for use by the application.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Storage partition will be used by FCB/LittleFS/NVS
|
|
||||||
* if enabled.
|
|
||||||
*/
|
|
||||||
storage_partition: partition@ec000 {
|
|
||||||
label = "storage";
|
|
||||||
reg = <0x000ec000 0x00008000>;
|
|
||||||
};
|
|
||||||
|
|
||||||
boot_partition: partition@f4000 {
|
|
||||||
label = "adafruit_boot";
|
|
||||||
reg = <0x000f4000 0x0000c000>;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
100
app/boards/arm/nice_nano/nice_nano.dtsi
Normal file
100
app/boards/arm/nice_nano/nice_nano.dtsi
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nordic/nrf52840_qiaa.dtsi>
|
||||||
|
#include "arduino_pro_micro_pins.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "nice!nano";
|
||||||
|
compatible = "nice,nano";
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
zephyr,code-partition = &code_partition;
|
||||||
|
zephyr,sram = &sram0;
|
||||||
|
zephyr,flash = &flash0;
|
||||||
|
};
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
blue_led: led_0 {
|
||||||
|
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
|
||||||
|
label = "Blue LED";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&adc {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&gpiote {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&gpio0 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&gpio1 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&i2c0 {
|
||||||
|
compatible = "nordic,nrf-twi";
|
||||||
|
sda-pin = <17>;
|
||||||
|
scl-pin = <20>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&uart0 {
|
||||||
|
compatible = "nordic,nrf-uarte";
|
||||||
|
tx-pin = <6>;
|
||||||
|
rx-pin = <8>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&usbd {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
&flash0 {
|
||||||
|
/*
|
||||||
|
* For more information, see:
|
||||||
|
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html
|
||||||
|
*/
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
sd_partition: partition@0 {
|
||||||
|
label = "softdevice";
|
||||||
|
reg = <0x00000000 0x00026000>;
|
||||||
|
};
|
||||||
|
code_partition: partition@26000 {
|
||||||
|
label = "code_partition";
|
||||||
|
reg = <0x00026000 0x000c6000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The flash starting at 0x000ec000 and ending at
|
||||||
|
* 0x000f3fff is reserved for use by the application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Storage partition will be used by FCB/LittleFS/NVS
|
||||||
|
* if enabled.
|
||||||
|
*/
|
||||||
|
storage_partition: partition@ec000 {
|
||||||
|
label = "storage";
|
||||||
|
reg = <0x000ec000 0x00008000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
boot_partition: partition@f4000 {
|
||||||
|
label = "adafruit_boot";
|
||||||
|
reg = <0x000f4000 0x0000c000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
26
app/boards/arm/nice_nano/nice_nano_v2.dts
Normal file
26
app/boards/arm/nice_nano/nice_nano_v2.dts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/dts-v1/;
|
||||||
|
#include "nice_nano.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
ext-power {
|
||||||
|
compatible = "zmk,ext-power-generic";
|
||||||
|
label = "EXT_POWER";
|
||||||
|
control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
|
||||||
|
init-delay-ms = <10>;
|
||||||
|
};
|
||||||
|
|
||||||
|
vbatt {
|
||||||
|
compatible = "zmk,battery-voltage-divider";
|
||||||
|
label = "BATTERY";
|
||||||
|
io-channels = <&adc (0x0D - 1)>;
|
||||||
|
// Multiply ADC result by 5
|
||||||
|
full-ohms = <5>;
|
||||||
|
output-ohms = <1>;
|
||||||
|
};
|
||||||
|
};
|
15
app/boards/arm/nice_nano/nice_nano_v2.yaml
Normal file
15
app/boards/arm/nice_nano/nice_nano_v2.yaml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
identifier: nice_nano_v2
|
||||||
|
name: nice!nano v2
|
||||||
|
type: mcu
|
||||||
|
arch: arm
|
||||||
|
toolchain:
|
||||||
|
- zephyr
|
||||||
|
- gnuarmemb
|
||||||
|
- xtools
|
||||||
|
supported:
|
||||||
|
- adc
|
||||||
|
- usb_device
|
||||||
|
- ble
|
||||||
|
- ieee802154
|
||||||
|
- pwm
|
||||||
|
- watchdog
|
20
app/boards/arm/nice_nano/nice_nano_v2_defconfig
Normal file
20
app/boards/arm/nice_nano/nice_nano_v2_defconfig
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
CONFIG_SOC_SERIES_NRF52X=y
|
||||||
|
CONFIG_SOC_NRF52840_QIAA=y
|
||||||
|
CONFIG_BOARD_NICE_NANO_V2=y
|
||||||
|
|
||||||
|
# Enable MPU
|
||||||
|
CONFIG_ARM_MPU=y
|
||||||
|
|
||||||
|
# enable GPIO
|
||||||
|
CONFIG_GPIO=y
|
||||||
|
|
||||||
|
CONFIG_USE_DT_CODE_PARTITION=y
|
||||||
|
|
||||||
|
CONFIG_MPU_ALLOW_FLASH_WRITE=y
|
||||||
|
CONFIG_NVS=y
|
||||||
|
CONFIG_SETTINGS_NVS=y
|
||||||
|
CONFIG_FLASH=y
|
||||||
|
CONFIG_FLASH_PAGE_LAYOUT=y
|
||||||
|
CONFIG_FLASH_MAP=y
|
|
@ -1,7 +0,0 @@
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
if(CONFIG_PINMUX)
|
|
||||||
zephyr_library()
|
|
||||||
zephyr_library_sources(pinmux.c)
|
|
||||||
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
|
|
||||||
endif()
|
|
|
@ -48,5 +48,5 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
pro_micro_i2c: &i2c1 {};
|
pro_micro_i2c: &i2c1 {};
|
||||||
pro_micro_spi: &spi1 {};
|
pro_micro_spi: &spi2 {};
|
||||||
pro_micro_serial: &usart1 {};
|
pro_micro_serial: &usart1 {};
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2017 I-SENSE group of ICCS
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <kernel.h>
|
|
||||||
#include <device.h>
|
|
||||||
#include <init.h>
|
|
||||||
#include <drivers/pinmux.h>
|
|
||||||
#include <sys/sys_io.h>
|
|
||||||
|
|
||||||
#include <pinmux/stm32/pinmux_stm32.h>
|
|
||||||
|
|
||||||
/* pin assignments for STM32F3DISCOVERY board */
|
|
||||||
static const struct pin_config pinconf[] = {
|
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(usart1), okay) && CONFIG_SERIAL
|
|
||||||
{STM32_PIN_PC4, STM32F3_PINMUX_FUNC_PC4_USART1_TX},
|
|
||||||
{STM32_PIN_PC5, STM32F3_PINMUX_FUNC_PC5_USART1_RX},
|
|
||||||
#endif
|
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(usart2), okay) && CONFIG_SERIAL
|
|
||||||
{STM32_PIN_PA2, STM32F3_PINMUX_FUNC_PA2_USART2_TX},
|
|
||||||
{STM32_PIN_PA3, STM32F3_PINMUX_FUNC_PA3_USART2_RX},
|
|
||||||
#endif
|
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) && CONFIG_I2C
|
|
||||||
{STM32_PIN_PB6, STM32F3_PINMUX_FUNC_PB6_I2C1_SCL},
|
|
||||||
{STM32_PIN_PB7, STM32F3_PINMUX_FUNC_PB7_I2C1_SDA},
|
|
||||||
#endif
|
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c2), okay) && CONFIG_I2C
|
|
||||||
{STM32_PIN_PA9, STM32F3_PINMUX_FUNC_PA9_I2C2_SCL},
|
|
||||||
{STM32_PIN_PA10, STM32F3_PINMUX_FUNC_PA10_I2C2_SDA},
|
|
||||||
#endif
|
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(spi1), okay) && CONFIG_SPI
|
|
||||||
#ifdef CONFIG_SPI_STM32_USE_HW_SS
|
|
||||||
{STM32_PIN_PA4, STM32F3_PINMUX_FUNC_PA4_SPI1_NSS},
|
|
||||||
#endif /* CONFIG_SPI_STM32_USE_HW_SS */
|
|
||||||
{STM32_PIN_PA5, STM32F3_PINMUX_FUNC_PA5_SPI1_SCK},
|
|
||||||
{STM32_PIN_PA6, STM32F3_PINMUX_FUNC_PA6_SPI1_MISO},
|
|
||||||
{STM32_PIN_PA7, STM32F3_PINMUX_FUNC_PA7_SPI1_MOSI},
|
|
||||||
#endif
|
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(spi2), okay) && CONFIG_SPI
|
|
||||||
#ifdef CONFIG_SPI_STM32_USE_HW_SS
|
|
||||||
{STM32_PIN_PB12, STM32F3_PINMUX_FUNC_PB12_SPI2_NSS},
|
|
||||||
#endif /* CONFIG_SPI_STM32_USE_HW_SS */
|
|
||||||
{STM32_PIN_PB13, STM32F3_PINMUX_FUNC_PB13_SPI2_SCK},
|
|
||||||
{STM32_PIN_PB14, STM32F3_PINMUX_FUNC_PB14_SPI2_MISO},
|
|
||||||
{STM32_PIN_PB15, STM32F3_PINMUX_FUNC_PB15_SPI2_MOSI},
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_USB_DC_STM32
|
|
||||||
{STM32_PIN_PA11, STM32F3_PINMUX_FUNC_PA11_USB_DM},
|
|
||||||
{STM32_PIN_PA12, STM32F3_PINMUX_FUNC_PA12_USB_DP},
|
|
||||||
#endif /* CONFIG_USB_DC_STM32 */
|
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(can1), okay) && CONFIG_CAN
|
|
||||||
{STM32_PIN_PD0, STM32F3_PINMUX_FUNC_PD0_CAN1_RX},
|
|
||||||
{STM32_PIN_PD1, STM32F3_PINMUX_FUNC_PD1_CAN1_TX},
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
static int pinmux_stm32_init(const struct device *port) {
|
|
||||||
ARG_UNUSED(port);
|
|
||||||
|
|
||||||
stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1, CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
/dts-v1/;
|
/dts-v1/;
|
||||||
#include <st/f3/stm32f303Xc.dtsi>
|
#include <st/f3/stm32f303Xc.dtsi>
|
||||||
|
#include <st/f3/stm32f303c(b-c)tx-pinctrl.dtsi>
|
||||||
#include "arduino_pro_micro_pins.dtsi"
|
#include "arduino_pro_micro_pins.dtsi"
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
|
@ -26,6 +27,18 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&usart1 {
|
||||||
|
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&spi2 {
|
||||||
|
pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&i2c1 {
|
||||||
|
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
|
||||||
|
};
|
||||||
|
|
||||||
&usb {
|
&usb {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,3 +6,5 @@ CONFIG_ZMK_BLE=n
|
||||||
CONFIG_LOG=y
|
CONFIG_LOG=y
|
||||||
CONFIG_LOG_BACKEND_SHOW_COLOR=n
|
CONFIG_LOG_BACKEND_SHOW_COLOR=n
|
||||||
CONFIG_ZMK_LOG_LEVEL_DBG=y
|
CONFIG_ZMK_LOG_LEVEL_DBG=y
|
||||||
|
CONFIG_DEBUG=y
|
||||||
|
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
if SHIELD_CRADIO_LEFT
|
if SHIELD_CRADIO_LEFT
|
||||||
|
|
||||||
config ZMK_KEYBOARD_NAME
|
config ZMK_KEYBOARD_NAME
|
||||||
default "cradio left"
|
default "Cradio"
|
||||||
|
|
||||||
config ZMK_SPLIT_BLE_ROLE_CENTRAL
|
config ZMK_SPLIT_BLE_ROLE_CENTRAL
|
||||||
default y
|
default y
|
||||||
|
@ -14,11 +14,11 @@ endif
|
||||||
if SHIELD_CRADIO_RIGHT
|
if SHIELD_CRADIO_RIGHT
|
||||||
|
|
||||||
config ZMK_KEYBOARD_NAME
|
config ZMK_KEYBOARD_NAME
|
||||||
default "cradio right"
|
default "Cradio_Right"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if SHIELD_CRADIO_LEFT || SHIELD_CRADIO_RIGHT
|
if SHIELD_CRADIO_RIGHT || SHIELD_CRADIO_LEFT
|
||||||
|
|
||||||
config ZMK_SPLIT
|
config ZMK_SPLIT
|
||||||
default y
|
default y
|
||||||
|
|
1
app/boards/shields/cradio/README.md
Normal file
1
app/boards/shields/cradio/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Cradio is a firmware for a few 34 key keyboards, including Cradio, Hypergolic and Sweep.
|
0
app/boards/shields/cradio/cradio.conf
Normal file
0
app/boards/shields/cradio/cradio.conf
Normal file
|
@ -7,9 +7,10 @@
|
||||||
#include <dt-bindings/zmk/matrix_transform.h>
|
#include <dt-bindings/zmk/matrix_transform.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
|
|
||||||
chosen {
|
chosen {
|
||||||
zmk,kscan = &kscan0;
|
zmk,kscan = &kscan0;
|
||||||
//zmk,matrix_transform = &default_transform;
|
zmk,matrix_transform = &default_transform;
|
||||||
};
|
};
|
||||||
|
|
||||||
default_transform: keymap_transform_0 {
|
default_transform: keymap_transform_0 {
|
||||||
|
@ -22,6 +23,7 @@
|
||||||
RC(0,10) RC(0,11) RC(0,12) RC(0,13) RC(0,14) RC(0,31) RC(0,30) RC(0,29) RC(0,28) RC(0,27)
|
RC(0,10) RC(0,11) RC(0,12) RC(0,13) RC(0,14) RC(0,31) RC(0,30) RC(0,29) RC(0,28) RC(0,27)
|
||||||
RC(0,15) RC(0,16) RC(0,33) RC(0,32)
|
RC(0,15) RC(0,16) RC(0,33) RC(0,32)
|
||||||
>;
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
kscan0: kscan {
|
kscan0: kscan {
|
||||||
compatible = "zmk,kscan-gpio-direct";
|
compatible = "zmk,kscan-gpio-direct";
|
||||||
|
@ -46,5 +48,5 @@
|
||||||
, <&pro_micro_d 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
, <&pro_micro_d 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,33 +9,92 @@
|
||||||
#include <dt-bindings/zmk/bt.h>
|
#include <dt-bindings/zmk/bt.h>
|
||||||
|
|
||||||
|
|
||||||
|
&mt {
|
||||||
|
// flavor = "tap-preferred";
|
||||||
|
// tapping_term_ms = <200>;
|
||||||
|
};
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
|
|
||||||
|
combos {
|
||||||
|
compatible = "zmk,combos";
|
||||||
|
combo_esc {
|
||||||
|
timeout-ms = <50>;
|
||||||
|
key-positions = <0 1>;
|
||||||
|
bindings = <&kp ESC>;
|
||||||
|
};
|
||||||
|
|
||||||
|
combo_tab {
|
||||||
|
timeout-ms = <50>;
|
||||||
|
key-positions = <10 11>;
|
||||||
|
bindings = <&kp TAB>;
|
||||||
|
};
|
||||||
|
|
||||||
|
combo_ralt {
|
||||||
|
timeout-ms = <50>;
|
||||||
|
key-positions = <17 16>;
|
||||||
|
bindings = <&kp RALT>;
|
||||||
|
};
|
||||||
|
|
||||||
|
combo_lalt {
|
||||||
|
timeout-ms = <50>;
|
||||||
|
key-positions = <11 12>;
|
||||||
|
bindings = <&kp LALT>;
|
||||||
|
};
|
||||||
|
|
||||||
|
combo_lgui {
|
||||||
|
timeout-ms = <50>;
|
||||||
|
key-positions = <12 13>;
|
||||||
|
bindings = <&kp LGUI>;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
combo_rgui {
|
||||||
|
timeout-ms = <50>;
|
||||||
|
key-positions = <17 18>;
|
||||||
|
bindings = <&kp RGUI>;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
keymap {
|
keymap {
|
||||||
compatible = "zmk,keymap";
|
compatible = "zmk,keymap";
|
||||||
|
|
||||||
default_layer {
|
default_layer {
|
||||||
bindings = <
|
bindings = <
|
||||||
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
|
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
|
||||||
&kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI
|
&kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp QUOT
|
||||||
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH
|
&mt LSFT Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT &mt LSFT RET
|
||||||
&mo 1 &kp LCTRL &kp SPACE &mo 2
|
&mo 1 &kp LCTL &kp SPC &mo 2
|
||||||
>;
|
|
||||||
};
|
|
||||||
upper_layer {
|
|
||||||
bindings = <
|
|
||||||
&kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0
|
|
||||||
&bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp H &kp J &kp K &kp L &kp SEMI
|
|
||||||
&kp LSHFT &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
|
||||||
&mo 1 &kp LCTRL &kp SPACE &mo 2
|
|
||||||
>;
|
>;
|
||||||
};
|
};
|
||||||
|
|
||||||
lower_layer {
|
left_layer {
|
||||||
bindings = <
|
bindings = <
|
||||||
&kp EXCL &kp AT &kp HASH &kp DOLLAR &kp PRCNT &kp CARET &kp AMPS &kp KP_MULTIPLY &kp LPAR &kp RPAR
|
&kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0
|
||||||
&trans &trans &trans &trans &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp PIPE
|
&kp TAB &kp LC(S) &kp DQT &kp PIPE2 &kp HASH &kp MINUS &kp EQL &kp LBKT &kp RBKT &kp DEL
|
||||||
&trans &trans &trans &trans &trans &trans &trans &trans &kp BSLH &kp TILDE
|
&kp ESC &kp TILDE &kp NON_US_BSLH &kp NON_US_HASH &kp TILDE2 &kp MINUS &kp GRAVE &kp LBKT &kp RBKT &kp DEL
|
||||||
&mo 1 &kp LCTRL &kp SPACE &mo 2
|
&mo 1 &kp LGUI &kp RGUI &mo 2
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
right_layer {
|
||||||
|
bindings = <
|
||||||
|
&kp BANG &kp ATSN &kp HASH &kp DLLR &kp PRCT &kp CRRT &kp AMPS &kp KMLT &kp LPRN &kp RPRN
|
||||||
|
&kp HASH &kp QMARK &kp FSLH &kp COLN &kp SCLN &kp MINUS &kp KP_EQUAL &kp LBRC &kp RBRC &kp BKSP
|
||||||
|
&kp LSFT &kp KPLS &kp LBKT &kp RBKT &kp BSLH &kp UNDER &kp LEFT &kp DOWN &kp UP &kp RIGHT
|
||||||
|
&mo 3 &kp LCTL &kp SPC &mo 2
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
tri_layer {
|
||||||
|
bindings = <
|
||||||
|
&kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &trans &trans &trans &trans &trans
|
||||||
|
&kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &trans &kp PG_UP &kp K_VOL_UP &kp K_MUTE &trans
|
||||||
|
&bt BT_CLR &bt BT_NXT &bt BT_PRV &kp F6 &kp F7 &trans &kp PG_DN &kp K_VOL_DN &trans &trans
|
||||||
|
&trans &trans &trans &trans
|
||||||
>;
|
>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
# Copyright (c) 2020 The ZMK Contributors
|
# Copyright (c) 2020 The ZMK Contributors
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
#define RSE 2
|
#define RSE 2
|
||||||
#define ADJ 3
|
#define ADJ 3
|
||||||
|
|
||||||
|
< { quick_tap_ms = <200>; };
|
||||||
|
&mt { quick_tap_ms = <200>; };
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
keymap {
|
keymap {
|
||||||
compatible = "zmk,keymap";
|
compatible = "zmk,keymap";
|
||||||
|
@ -26,7 +29,7 @@
|
||||||
bindings = <
|
bindings = <
|
||||||
&kp LWIN &kp GRAVE &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &mt RWIN RBKT
|
&kp LWIN &kp GRAVE &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &mt RWIN RBKT
|
||||||
&kp LCTRL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &mt RCTRL SQT
|
&kp LCTRL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &mt RCTRL SQT
|
||||||
&kp LALT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp BSLH
|
&kp LALT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &mt RALT BSLH
|
||||||
< RSE TAB &mt LSHFT SPACE < LWR RET < LWR ESC &mt RSHFT BSPC < RSE DEL
|
< RSE TAB &mt LSHFT SPACE < LWR RET < LWR ESC &mt RSHFT BSPC < RSE DEL
|
||||||
>;
|
>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,6 @@ config ZMK_KEYBOARD_NAME
|
||||||
config ZMK_USB
|
config ZMK_USB
|
||||||
default y
|
default y
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
if ZMK_DISPLAY
|
if ZMK_DISPLAY
|
||||||
|
|
||||||
|
@ -46,3 +45,5 @@ choice LVGL_COLOR_DEPTH
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
endif # LVGL
|
endif # LVGL
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
|
@ -6,7 +6,6 @@ if SHIELD_TIDBIT
|
||||||
config ZMK_KEYBOARD_NAME
|
config ZMK_KEYBOARD_NAME
|
||||||
default "tidbit"
|
default "tidbit"
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
if ZMK_DISPLAY
|
if ZMK_DISPLAY
|
||||||
|
|
||||||
|
@ -43,3 +42,5 @@ choice LVGL_COLOR_DEPTH
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
endif # LVGL
|
endif # LVGL
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
|
@ -108,6 +108,6 @@ static const struct kscan_composite_config kscan_composite_config = {};
|
||||||
|
|
||||||
static struct kscan_composite_data kscan_composite_data;
|
static struct kscan_composite_data kscan_composite_data;
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(kscan_composite, DT_INST_LABEL(0), kscan_composite_init, &kscan_composite_data,
|
DEVICE_DT_INST_DEFINE(0, kscan_composite_init, device_pm_control_nop, &kscan_composite_data,
|
||||||
&kscan_composite_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
&kscan_composite_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||||
&mock_driver_api);
|
&mock_driver_api);
|
||||||
|
|
|
@ -113,6 +113,8 @@ struct kscan_gpio_item_config {
|
||||||
&kscan_gpio_output_configs_##n(dev)[bit]; \
|
&kscan_gpio_output_configs_##n(dev)[bit]; \
|
||||||
gpio_pin_set(out_dev, out_cfg->pin, state); \
|
gpio_pin_set(out_dev, out_cfg->pin, state); \
|
||||||
} \
|
} \
|
||||||
|
/* Let the col settle before reading the rows */ \
|
||||||
|
k_usleep(1); \
|
||||||
\
|
\
|
||||||
for (int i = 0; i < INST_MATRIX_INPUTS(n); i++) { \
|
for (int i = 0; i < INST_MATRIX_INPUTS(n); i++) { \
|
||||||
/* Get the input device (port) */ \
|
/* Get the input device (port) */ \
|
||||||
|
@ -246,9 +248,9 @@ struct kscan_gpio_item_config {
|
||||||
.cols = {UTIL_LISTIFY(INST_DEMUX_GPIOS(n), _KSCAN_GPIO_OUTPUT_CFG_INIT, n)}, \
|
.cols = {UTIL_LISTIFY(INST_DEMUX_GPIOS(n), _KSCAN_GPIO_OUTPUT_CFG_INIT, n)}, \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
DEVICE_AND_API_INIT(kscan_gpio_##n, DT_INST_LABEL(n), kscan_gpio_init_##n, \
|
DEVICE_DT_INST_DEFINE(n, kscan_gpio_init_##n, device_pm_control_nop, &kscan_gpio_data_##n, \
|
||||||
&kscan_gpio_data_##n, &kscan_gpio_config_##n, APPLICATION, \
|
&kscan_gpio_config_##n, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY, \
|
||||||
CONFIG_APPLICATION_INIT_PRIORITY, &gpio_driver_api_##n);
|
&gpio_driver_api_##n);
|
||||||
|
|
||||||
DT_INST_FOREACH_STATUS_OKAY(GPIO_INST_INIT)
|
DT_INST_FOREACH_STATUS_OKAY(GPIO_INST_INIT)
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ static int kscan_gpio_config_interrupts(const struct device *dev, gpio_flags_t f
|
||||||
int err = gpio_pin_interrupt_configure(dev, cfg->pin, flags);
|
int err = gpio_pin_interrupt_configure(dev, cfg->pin, flags);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
LOG_ERR("Unable to enable matrix GPIO interrupt");
|
LOG_ERR("Unable to enable direct GPIO interrupt");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,9 +238,9 @@ static const struct kscan_driver_api gpio_driver_api = {
|
||||||
.inputs = {UTIL_LISTIFY(INST_INPUT_LEN(n), KSCAN_DIRECT_INPUT_ITEM, n)}, \
|
.inputs = {UTIL_LISTIFY(INST_INPUT_LEN(n), KSCAN_DIRECT_INPUT_ITEM, n)}, \
|
||||||
.num_of_inputs = INST_INPUT_LEN(n), \
|
.num_of_inputs = INST_INPUT_LEN(n), \
|
||||||
.debounce_period = DT_INST_PROP(n, debounce_period)}; \
|
.debounce_period = DT_INST_PROP(n, debounce_period)}; \
|
||||||
DEVICE_AND_API_INIT(kscan_gpio_##n, DT_INST_LABEL(n), kscan_gpio_init_##n, \
|
DEVICE_DT_INST_DEFINE(n, kscan_gpio_init_##n, device_pm_control_nop, &kscan_gpio_data_##n, \
|
||||||
&kscan_gpio_data_##n, &kscan_gpio_config_##n, POST_KERNEL, \
|
&kscan_gpio_config_##n, POST_KERNEL, CONFIG_ZMK_KSCAN_INIT_PRIORITY, \
|
||||||
CONFIG_ZMK_KSCAN_INIT_PRIORITY, &gpio_driver_api);
|
&gpio_driver_api);
|
||||||
|
|
||||||
DT_INST_FOREACH_STATUS_OKAY(GPIO_INST_INIT)
|
DT_INST_FOREACH_STATUS_OKAY(GPIO_INST_INIT)
|
||||||
|
|
||||||
|
|
|
@ -298,9 +298,9 @@ static int kscan_gpio_config_interrupts(const struct device **devices,
|
||||||
.rows = {UTIL_LISTIFY(INST_MATRIX_ROWS(n), _KSCAN_GPIO_ROW_CFG_INIT, n)}, \
|
.rows = {UTIL_LISTIFY(INST_MATRIX_ROWS(n), _KSCAN_GPIO_ROW_CFG_INIT, n)}, \
|
||||||
.cols = {UTIL_LISTIFY(INST_MATRIX_COLS(n), _KSCAN_GPIO_COL_CFG_INIT, n)}, \
|
.cols = {UTIL_LISTIFY(INST_MATRIX_COLS(n), _KSCAN_GPIO_COL_CFG_INIT, n)}, \
|
||||||
}; \
|
}; \
|
||||||
DEVICE_AND_API_INIT(kscan_gpio_##n, DT_INST_LABEL(n), kscan_gpio_init_##n, \
|
DEVICE_DT_INST_DEFINE(n, kscan_gpio_init_##n, device_pm_control_nop, &kscan_gpio_data_##n, \
|
||||||
&kscan_gpio_data_##n, &kscan_gpio_config_##n, APPLICATION, \
|
&kscan_gpio_config_##n, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY, \
|
||||||
CONFIG_APPLICATION_INIT_PRIORITY, &gpio_driver_api_##n);
|
&gpio_driver_api_##n);
|
||||||
|
|
||||||
DT_INST_FOREACH_STATUS_OKAY(GPIO_INST_INIT)
|
DT_INST_FOREACH_STATUS_OKAY(GPIO_INST_INIT)
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,8 @@ static int kscan_mock_configure(const struct device *dev, kscan_callback_t callb
|
||||||
static struct kscan_mock_data kscan_mock_data_##n; \
|
static struct kscan_mock_data kscan_mock_data_##n; \
|
||||||
static const struct kscan_mock_config_##n kscan_mock_config_##n = { \
|
static const struct kscan_mock_config_##n kscan_mock_config_##n = { \
|
||||||
.events = DT_INST_PROP(n, events), .exit_after = DT_INST_PROP(n, exit_after)}; \
|
.events = DT_INST_PROP(n, events), .exit_after = DT_INST_PROP(n, exit_after)}; \
|
||||||
DEVICE_AND_API_INIT(kscan_mock_##n, DT_INST_LABEL(n), kscan_mock_init_##n, \
|
DEVICE_DT_INST_DEFINE(n, kscan_mock_init_##n, device_pm_control_nop, &kscan_mock_data_##n, \
|
||||||
&kscan_mock_data_##n, &kscan_mock_config_##n, APPLICATION, \
|
&kscan_mock_config_##n, APPLICATION, \
|
||||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &mock_driver_api_##n);
|
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &mock_driver_api_##n);
|
||||||
|
|
||||||
DT_INST_FOREACH_STATUS_OKAY(MOCK_INST_INIT)
|
DT_INST_FOREACH_STATUS_OKAY(MOCK_INST_INIT)
|
||||||
|
|
|
@ -93,7 +93,7 @@ static int bvd_sample_fetch(const struct device *dev, enum sensor_channel chan)
|
||||||
&val);
|
&val);
|
||||||
|
|
||||||
uint16_t millivolts = val * (uint64_t)drv_cfg->full_ohm / drv_cfg->output_ohm;
|
uint16_t millivolts = val * (uint64_t)drv_cfg->full_ohm / drv_cfg->output_ohm;
|
||||||
LOG_DBG("ADC raw %d ~ %d mV => %d mV\n", drv_data->adc_raw, val, millivolts);
|
LOG_DBG("ADC raw %d ~ %d mV => %d mV", drv_data->adc_raw, val, millivolts);
|
||||||
uint8_t percent = lithium_ion_mv_to_pct(millivolts);
|
uint8_t percent = lithium_ion_mv_to_pct(millivolts);
|
||||||
LOG_DBG("Percent: %d", percent);
|
LOG_DBG("Percent: %d", percent);
|
||||||
|
|
||||||
|
@ -217,5 +217,5 @@ static const struct bvd_config bvd_cfg = {
|
||||||
.full_ohm = DT_INST_PROP(0, full_ohms),
|
.full_ohm = DT_INST_PROP(0, full_ohms),
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(bvd_dev, DT_INST_LABEL(0), &bvd_init, &bvd_data, &bvd_cfg, POST_KERNEL,
|
DEVICE_DT_INST_DEFINE(0, &bvd_init, device_pm_control_nop, &bvd_data, &bvd_cfg, POST_KERNEL,
|
||||||
CONFIG_SENSOR_INIT_PRIORITY, &bvd_api);
|
CONFIG_SENSOR_INIT_PRIORITY, &bvd_api);
|
||||||
|
|
|
@ -142,7 +142,7 @@ int ec11_init(const struct device *dev) {
|
||||||
.b_flags = DT_INST_GPIO_FLAGS(n, b_gpios), \
|
.b_flags = DT_INST_GPIO_FLAGS(n, b_gpios), \
|
||||||
COND_CODE_0(DT_INST_NODE_HAS_PROP(n, resolution), (1), (DT_INST_PROP(n, resolution))), \
|
COND_CODE_0(DT_INST_NODE_HAS_PROP(n, resolution), (1), (DT_INST_PROP(n, resolution))), \
|
||||||
}; \
|
}; \
|
||||||
DEVICE_AND_API_INIT(ec11_##n, DT_INST_LABEL(n), ec11_init, &ec11_data_##n, &ec11_cfg_##n, \
|
DEVICE_DT_INST_DEFINE(n, ec11_init, device_pm_control_nop, &ec11_data_##n, &ec11_cfg_##n, \
|
||||||
POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &ec11_driver_api);
|
POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &ec11_driver_api);
|
||||||
|
|
||||||
DT_INST_FOREACH_STATUS_OKAY(EC11_INST)
|
DT_INST_FOREACH_STATUS_OKAY(EC11_INST)
|
|
@ -768,6 +768,7 @@
|
||||||
|
|
||||||
/* Keyboard Left Shift */
|
/* Keyboard Left Shift */
|
||||||
#define LEFT_SHIFT (HID_USAGE(HID_USAGE_KEY, HID_USAGE_KEY_KEYBOARD_LEFTSHIFT))
|
#define LEFT_SHIFT (HID_USAGE(HID_USAGE_KEY, HID_USAGE_KEY_KEYBOARD_LEFTSHIFT))
|
||||||
|
#define LSHIFT (LEFT_SHIFT)
|
||||||
#define LSHFT (LEFT_SHIFT)
|
#define LSHFT (LEFT_SHIFT)
|
||||||
#define LSFT (LEFT_SHIFT) // WARNING: DEPRECATED (DO NOT USE)
|
#define LSFT (LEFT_SHIFT) // WARNING: DEPRECATED (DO NOT USE)
|
||||||
|
|
||||||
|
@ -792,6 +793,7 @@
|
||||||
|
|
||||||
/* Keyboard Right Shift */
|
/* Keyboard Right Shift */
|
||||||
#define RIGHT_SHIFT (HID_USAGE(HID_USAGE_KEY, HID_USAGE_KEY_KEYBOARD_RIGHTSHIFT))
|
#define RIGHT_SHIFT (HID_USAGE(HID_USAGE_KEY, HID_USAGE_KEY_KEYBOARD_RIGHTSHIFT))
|
||||||
|
#define RSHIFT (RIGHT_SHIFT)
|
||||||
#define RSHFT (RIGHT_SHIFT)
|
#define RSHFT (RIGHT_SHIFT)
|
||||||
#define RSFT (RIGHT_SHIFT) // WARNING: DEPRECATED (DO NOT USE)
|
#define RSFT (RIGHT_SHIFT) // WARNING: DEPRECATED (DO NOT USE)
|
||||||
|
|
||||||
|
|
9
app/include/zmk/battery.h
Normal file
9
app/include/zmk/battery.h
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
uint8_t zmk_battery_state_of_charge();
|
|
@ -17,7 +17,7 @@ testcases=$(find $path -name native_posix.keymap -exec dirname \{\} \;)
|
||||||
num_cases=$(echo "$testcases" | wc -l)
|
num_cases=$(echo "$testcases" | wc -l)
|
||||||
if [ $num_cases -gt 1 ]; then
|
if [ $num_cases -gt 1 ]; then
|
||||||
echo "" > ./build/tests/pass-fail.log
|
echo "" > ./build/tests/pass-fail.log
|
||||||
echo "$testcases" | xargs -L 1 -P 4 ./run-test.sh
|
echo "$testcases" | xargs -L 1 -P ${J:-4} ./run-test.sh
|
||||||
err=$?
|
err=$?
|
||||||
sort -k2 ./build/tests/pass-fail.log
|
sort -k2 ./build/tests/pass-fail.log
|
||||||
exit $err
|
exit $err
|
||||||
|
|
|
@ -15,10 +15,15 @@
|
||||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
|
|
||||||
#include <zmk/event_manager.h>
|
#include <zmk/event_manager.h>
|
||||||
|
#include <zmk/battery.h>
|
||||||
#include <zmk/events/battery_state_changed.h>
|
#include <zmk/events/battery_state_changed.h>
|
||||||
|
|
||||||
const struct device *battery;
|
const struct device *battery;
|
||||||
|
|
||||||
|
static uint8_t last_state_of_charge = 0;
|
||||||
|
|
||||||
|
uint8_t zmk_battery_state_of_charge() { return last_state_of_charge; }
|
||||||
|
|
||||||
static int zmk_battery_update(const struct device *battery) {
|
static int zmk_battery_update(const struct device *battery) {
|
||||||
struct sensor_value state_of_charge;
|
struct sensor_value state_of_charge;
|
||||||
|
|
||||||
|
@ -36,17 +41,23 @@ static int zmk_battery_update(const struct device *battery) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DBG("Setting BAS GATT battery level to %d.", state_of_charge.val1);
|
if (last_state_of_charge != state_of_charge.val1) {
|
||||||
|
last_state_of_charge = state_of_charge.val1;
|
||||||
|
|
||||||
rc = bt_bas_set_battery_level(state_of_charge.val1);
|
LOG_DBG("Setting BAS GATT battery level to %d.", last_state_of_charge);
|
||||||
|
|
||||||
|
rc = bt_bas_set_battery_level(last_state_of_charge);
|
||||||
|
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
LOG_WRN("Failed to set BAS GATT battery level (err %d)", rc);
|
LOG_WRN("Failed to set BAS GATT battery level (err %d)", rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ZMK_EVENT_RAISE(new_zmk_battery_state_changed(
|
rc = ZMK_EVENT_RAISE(new_zmk_battery_state_changed(
|
||||||
(struct zmk_battery_state_changed){.state_of_charge = state_of_charge.val1}));
|
(struct zmk_battery_state_changed){.state_of_charge = last_state_of_charge}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zmk_battery_work(struct k_work *work) {
|
static void zmk_battery_work(struct k_work *work) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ static const struct behavior_driver_api behavior_bt_driver_api = {
|
||||||
.binding_released = on_keymap_binding_released,
|
.binding_released = on_keymap_binding_released,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(behavior_bt, DT_INST_LABEL(0), behavior_bt_init, NULL, NULL, APPLICATION,
|
DEVICE_DT_INST_DEFINE(0, behavior_bt_init, device_pm_control_nop, NULL, NULL, APPLICATION,
|
||||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_bt_driver_api);
|
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_bt_driver_api);
|
||||||
|
|
||||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
|
@ -73,7 +73,7 @@ static const struct behavior_driver_api behavior_ext_power_driver_api = {
|
||||||
.binding_released = on_keymap_binding_released,
|
.binding_released = on_keymap_binding_released,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(behavior_ext_power, DT_INST_LABEL(0), behavior_ext_power_init, NULL, NULL,
|
DEVICE_DT_INST_DEFINE(0, behavior_ext_power_init, device_pm_control_nop, NULL, NULL, APPLICATION,
|
||||||
APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY, &behavior_ext_power_driver_api);
|
CONFIG_APPLICATION_INIT_PRIORITY, &behavior_ext_power_driver_api);
|
||||||
|
|
||||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
||||||
|
|
|
@ -449,11 +449,7 @@ static int on_hold_tap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||||
// if this behavior was queued we have to adjust the timer to only
|
// if this behavior was queued we have to adjust the timer to only
|
||||||
// wait for the remaining time.
|
// wait for the remaining time.
|
||||||
int32_t tapping_term_ms_left = (hold_tap->timestamp + cfg->tapping_term_ms) - k_uptime_get();
|
int32_t tapping_term_ms_left = (hold_tap->timestamp + cfg->tapping_term_ms) - k_uptime_get();
|
||||||
if (tapping_term_ms_left > 0) {
|
|
||||||
k_delayed_work_submit(&hold_tap->work, K_MSEC(tapping_term_ms_left));
|
k_delayed_work_submit(&hold_tap->work, K_MSEC(tapping_term_ms_left));
|
||||||
} else {
|
|
||||||
decide_hold_tap(hold_tap, HT_TIMER_EVENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ZMK_BEHAVIOR_OPAQUE;
|
return ZMK_BEHAVIOR_OPAQUE;
|
||||||
}
|
}
|
||||||
|
@ -609,7 +605,7 @@ static struct behavior_hold_tap_data behavior_hold_tap_data;
|
||||||
.flavor = DT_ENUM_IDX(DT_DRV_INST(n), flavor), \
|
.flavor = DT_ENUM_IDX(DT_DRV_INST(n), flavor), \
|
||||||
.retro_tap = DT_INST_PROP(n, retro_tap), \
|
.retro_tap = DT_INST_PROP(n, retro_tap), \
|
||||||
}; \
|
}; \
|
||||||
DEVICE_AND_API_INIT(behavior_hold_tap_##n, DT_INST_LABEL(n), behavior_hold_tap_init, \
|
DEVICE_DT_INST_DEFINE(n, behavior_hold_tap_init, device_pm_control_nop, \
|
||||||
&behavior_hold_tap_data, &behavior_hold_tap_config_##n, APPLICATION, \
|
&behavior_hold_tap_data, &behavior_hold_tap_config_##n, APPLICATION, \
|
||||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_hold_tap_driver_api);
|
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_hold_tap_driver_api);
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@ static const struct behavior_driver_api behavior_key_press_driver_api = {
|
||||||
.binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released};
|
.binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released};
|
||||||
|
|
||||||
#define KP_INST(n) \
|
#define KP_INST(n) \
|
||||||
DEVICE_AND_API_INIT(behavior_key_press_##n, DT_INST_LABEL(n), behavior_key_press_init, NULL, \
|
DEVICE_DT_INST_DEFINE(n, behavior_key_press_init, device_pm_control_nop, NULL, NULL, \
|
||||||
NULL, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
|
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
|
||||||
&behavior_key_press_driver_api);
|
&behavior_key_press_driver_api);
|
||||||
|
|
||||||
DT_INST_FOREACH_STATUS_OKAY(KP_INST)
|
DT_INST_FOREACH_STATUS_OKAY(KP_INST)
|
||||||
|
|
|
@ -90,9 +90,10 @@ static int behavior_mod_morph_init(const struct device *dev) { return 0; }
|
||||||
.mods = DT_INST_PROP(n, mods), \
|
.mods = DT_INST_PROP(n, mods), \
|
||||||
}; \
|
}; \
|
||||||
static struct behavior_mod_morph_data behavior_mod_morph_data_##n = {}; \
|
static struct behavior_mod_morph_data behavior_mod_morph_data_##n = {}; \
|
||||||
DEVICE_AND_API_INIT(behavior_mod_morph_##n, DT_INST_LABEL(n), behavior_mod_morph_init, \
|
DEVICE_DT_INST_DEFINE(n, behavior_mod_morph_init, device_pm_control_nop, \
|
||||||
&behavior_mod_morph_data_##n, &behavior_mod_morph_config_##n, APPLICATION, \
|
&behavior_mod_morph_data_##n, &behavior_mod_morph_config_##n, \
|
||||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_mod_morph_driver_api);
|
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
|
||||||
|
&behavior_mod_morph_driver_api);
|
||||||
|
|
||||||
DT_INST_FOREACH_STATUS_OKAY(KP_INST)
|
DT_INST_FOREACH_STATUS_OKAY(KP_INST)
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,6 @@ static const struct behavior_mo_config behavior_mo_config = {};
|
||||||
|
|
||||||
static struct behavior_mo_data behavior_mo_data;
|
static struct behavior_mo_data behavior_mo_data;
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(behavior_mo, DT_INST_LABEL(0), behavior_mo_init, &behavior_mo_data,
|
DEVICE_DT_INST_DEFINE(0, behavior_mo_init, device_pm_control_nop, &behavior_mo_data,
|
||||||
&behavior_mo_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
&behavior_mo_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||||
&behavior_mo_driver_api);
|
&behavior_mo_driver_api);
|
||||||
|
|
|
@ -34,7 +34,7 @@ static const struct behavior_driver_api behavior_none_driver_api = {
|
||||||
.binding_released = on_keymap_binding_released,
|
.binding_released = on_keymap_binding_released,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(behavior_none, DT_INST_LABEL(0), behavior_none_init, NULL, NULL, APPLICATION,
|
DEVICE_DT_INST_DEFINE(0, behavior_none_init, device_pm_control_nop, NULL, NULL, APPLICATION,
|
||||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_none_driver_api);
|
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_none_driver_api);
|
||||||
|
|
||||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
|
@ -42,7 +42,7 @@ static const struct behavior_driver_api behavior_outputs_driver_api = {
|
||||||
.binding_pressed = on_keymap_binding_pressed,
|
.binding_pressed = on_keymap_binding_pressed,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(behavior_out, DT_INST_LABEL(0), behavior_out_init, NULL, NULL, APPLICATION,
|
DEVICE_DT_INST_DEFINE(0, behavior_out_init, device_pm_control_nop, NULL, NULL, APPLICATION,
|
||||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_outputs_driver_api);
|
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_outputs_driver_api);
|
||||||
|
|
||||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
||||||
|
|
|
@ -41,7 +41,7 @@ static const struct behavior_driver_api behavior_reset_driver_api = {
|
||||||
#define RST_INST(n) \
|
#define RST_INST(n) \
|
||||||
static const struct behavior_reset_config behavior_reset_config_##n = { \
|
static const struct behavior_reset_config behavior_reset_config_##n = { \
|
||||||
.type = DT_INST_PROP(n, type)}; \
|
.type = DT_INST_PROP(n, type)}; \
|
||||||
DEVICE_AND_API_INIT(behavior_reset_##n, DT_INST_LABEL(n), behavior_reset_init, NULL, \
|
DEVICE_DT_INST_DEFINE(n, behavior_reset_init, device_pm_control_nop, NULL, \
|
||||||
&behavior_reset_config_##n, APPLICATION, \
|
&behavior_reset_config_##n, APPLICATION, \
|
||||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_reset_driver_api);
|
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_reset_driver_api);
|
||||||
|
|
||||||
|
|
|
@ -136,8 +136,8 @@ static const struct behavior_driver_api behavior_rgb_underglow_driver_api = {
|
||||||
.binding_released = on_keymap_binding_released,
|
.binding_released = on_keymap_binding_released,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(behavior_rgb_underglow, DT_INST_LABEL(0), behavior_rgb_underglow_init, NULL,
|
DEVICE_DT_INST_DEFINE(0, behavior_rgb_underglow_init, device_pm_control_nop, NULL, NULL,
|
||||||
NULL, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||||
&behavior_rgb_underglow_driver_api);
|
&behavior_rgb_underglow_driver_api);
|
||||||
|
|
||||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
||||||
|
|
|
@ -59,9 +59,8 @@ static const struct behavior_driver_api behavior_sensor_rotate_key_press_driver_
|
||||||
.sensor_binding_triggered = on_sensor_binding_triggered};
|
.sensor_binding_triggered = on_sensor_binding_triggered};
|
||||||
|
|
||||||
#define KP_INST(n) \
|
#define KP_INST(n) \
|
||||||
DEVICE_AND_API_INIT(behavior_sensor_rotate_key_press_##n, DT_INST_LABEL(n), \
|
DEVICE_DT_INST_DEFINE(n, behavior_sensor_rotate_key_press_init, device_pm_control_nop, NULL, \
|
||||||
behavior_sensor_rotate_key_press_init, NULL, NULL, APPLICATION, \
|
NULL, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
|
||||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
|
|
||||||
&behavior_sensor_rotate_key_press_driver_api);
|
&behavior_sensor_rotate_key_press_driver_api);
|
||||||
|
|
||||||
DT_INST_FOREACH_STATUS_OKAY(KP_INST)
|
DT_INST_FOREACH_STATUS_OKAY(KP_INST)
|
||||||
|
|
|
@ -177,6 +177,11 @@ static const struct behavior_driver_api behavior_sticky_key_driver_api = {
|
||||||
.binding_released = on_sticky_key_binding_released,
|
.binding_released = on_sticky_key_binding_released,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int sticky_key_keycode_state_changed_listener(const zmk_event_t *eh);
|
||||||
|
|
||||||
|
ZMK_LISTENER(behavior_sticky_key, sticky_key_keycode_state_changed_listener);
|
||||||
|
ZMK_SUBSCRIPTION(behavior_sticky_key, zmk_keycode_state_changed);
|
||||||
|
|
||||||
static int sticky_key_keycode_state_changed_listener(const zmk_event_t *eh) {
|
static int sticky_key_keycode_state_changed_listener(const zmk_event_t *eh) {
|
||||||
struct zmk_keycode_state_changed *ev = as_zmk_keycode_state_changed(eh);
|
struct zmk_keycode_state_changed *ev = as_zmk_keycode_state_changed(eh);
|
||||||
if (ev == NULL) {
|
if (ev == NULL) {
|
||||||
|
@ -212,7 +217,10 @@ static int sticky_key_keycode_state_changed_listener(const zmk_event_t *eh) {
|
||||||
if (sticky_key->timer_started) {
|
if (sticky_key->timer_started) {
|
||||||
stop_timer(sticky_key);
|
stop_timer(sticky_key);
|
||||||
if (sticky_key->config->quick_release) {
|
if (sticky_key->config->quick_release) {
|
||||||
|
// continue processing the event. Release the sticky key afterwards.
|
||||||
|
ZMK_EVENT_RAISE_AFTER(eh, behavior_sticky_key);
|
||||||
release_sticky_key_behavior(sticky_key, ev->timestamp);
|
release_sticky_key_behavior(sticky_key, ev->timestamp);
|
||||||
|
return ZMK_EV_EVENT_CAPTURED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sticky_key->modified_key_usage_page = ev->usage_page;
|
sticky_key->modified_key_usage_page = ev->usage_page;
|
||||||
|
@ -229,9 +237,6 @@ static int sticky_key_keycode_state_changed_listener(const zmk_event_t *eh) {
|
||||||
return ZMK_EV_EVENT_BUBBLE;
|
return ZMK_EV_EVENT_BUBBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZMK_LISTENER(behavior_sticky_key, sticky_key_keycode_state_changed_listener);
|
|
||||||
ZMK_SUBSCRIPTION(behavior_sticky_key, zmk_keycode_state_changed);
|
|
||||||
|
|
||||||
void behavior_sticky_key_timer_handler(struct k_work *item) {
|
void behavior_sticky_key_timer_handler(struct k_work *item) {
|
||||||
struct active_sticky_key *sticky_key =
|
struct active_sticky_key *sticky_key =
|
||||||
CONTAINER_OF(item, struct active_sticky_key, release_timer);
|
CONTAINER_OF(item, struct active_sticky_key, release_timer);
|
||||||
|
@ -267,7 +272,7 @@ static struct behavior_sticky_key_data behavior_sticky_key_data;
|
||||||
.release_after_ms = DT_INST_PROP(n, release_after_ms), \
|
.release_after_ms = DT_INST_PROP(n, release_after_ms), \
|
||||||
.quick_release = DT_INST_PROP(n, quick_release), \
|
.quick_release = DT_INST_PROP(n, quick_release), \
|
||||||
}; \
|
}; \
|
||||||
DEVICE_AND_API_INIT(behavior_sticky_key_##n, DT_INST_LABEL(n), behavior_sticky_key_init, \
|
DEVICE_DT_INST_DEFINE(n, behavior_sticky_key_init, device_pm_control_nop, \
|
||||||
&behavior_sticky_key_data, &behavior_sticky_key_config_##n, APPLICATION, \
|
&behavior_sticky_key_data, &behavior_sticky_key_config_##n, APPLICATION, \
|
||||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_sticky_key_driver_api);
|
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_sticky_key_driver_api);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ static const struct behavior_driver_api behavior_to_driver_api = {
|
||||||
.binding_released = to_keymap_binding_released,
|
.binding_released = to_keymap_binding_released,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(behavior_to, DT_INST_LABEL(0), behavior_to_init, NULL, NULL, APPLICATION,
|
DEVICE_DT_INST_DEFINE(0, behavior_to_init, device_pm_control_nop, NULL, NULL, APPLICATION,
|
||||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_to_driver_api);
|
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_to_driver_api);
|
||||||
|
|
||||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
||||||
|
|
|
@ -43,7 +43,7 @@ static const struct behavior_tog_config behavior_tog_config = {};
|
||||||
|
|
||||||
static struct behavior_tog_data behavior_tog_data;
|
static struct behavior_tog_data behavior_tog_data;
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(behavior_tog, DT_INST_LABEL(0), behavior_tog_init, &behavior_tog_data,
|
DEVICE_DT_INST_DEFINE(0, behavior_tog_init, device_pm_control_nop, &behavior_tog_data,
|
||||||
&behavior_tog_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
&behavior_tog_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||||
&behavior_tog_driver_api);
|
&behavior_tog_driver_api);
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,7 @@ static const struct behavior_driver_api behavior_transparent_driver_api = {
|
||||||
.binding_released = on_keymap_binding_released,
|
.binding_released = on_keymap_binding_released,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(behavior_transparent, DT_INST_LABEL(0), behavior_transparent_init, NULL, NULL,
|
DEVICE_DT_INST_DEFINE(0, behavior_transparent_init, device_pm_control_nop, NULL, NULL, APPLICATION,
|
||||||
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_transparent_driver_api);
|
||||||
&behavior_transparent_driver_api);
|
|
||||||
|
|
||||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
|
@ -7,6 +7,7 @@
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -250,6 +251,10 @@ static int ble_save_profile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int zmk_ble_prof_select(uint8_t index) {
|
int zmk_ble_prof_select(uint8_t index) {
|
||||||
|
if (index >= PROFILE_COUNT) {
|
||||||
|
return -ERANGE;
|
||||||
|
}
|
||||||
|
|
||||||
LOG_DBG("profile %d", index);
|
LOG_DBG("profile %d", index);
|
||||||
if (active_profile == index) {
|
if (active_profile == index) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -188,11 +188,18 @@ static int64_t first_candidate_timeout() {
|
||||||
static inline bool candidate_is_completely_pressed(struct combo_cfg *candidate) {
|
static inline bool candidate_is_completely_pressed(struct combo_cfg *candidate) {
|
||||||
// this code assumes set(pressed_keys) <= set(candidate->key_positions)
|
// this code assumes set(pressed_keys) <= set(candidate->key_positions)
|
||||||
// this invariant is enforced by filter_candidates
|
// this invariant is enforced by filter_candidates
|
||||||
// the only thing we need to do is check if len(pressed_keys) == len(combo->key_positions)
|
// since events may have been reraised after clearing one or more slots at
|
||||||
return pressed_keys[candidate->key_position_len - 1] != NULL;
|
// the start of pressed_keys (see: release_pressed_keys), we have to check
|
||||||
|
// that each key needed to trigger the combo was pressed, not just the last.
|
||||||
|
for (int i = 0; i < candidate->key_position_len; i++) {
|
||||||
|
if (pressed_keys[i] == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cleanup();
|
static int cleanup();
|
||||||
|
|
||||||
static int filter_timed_out_candidates(int64_t timestamp) {
|
static int filter_timed_out_candidates(int64_t timestamp) {
|
||||||
int num_candidates = 0;
|
int num_candidates = 0;
|
||||||
|
@ -224,7 +231,7 @@ static int clear_candidates() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int capture_pressed_key(const zmk_event_t *ev) {
|
static int capture_pressed_key(const zmk_event_t *ev) {
|
||||||
for (int i = 0; i < CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY; i++) {
|
for (int i = 0; i < CONFIG_ZMK_COMBO_MAX_KEYS_PER_COMBO; i++) {
|
||||||
if (pressed_keys[i] != NULL) {
|
if (pressed_keys[i] != NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -236,24 +243,26 @@ static int capture_pressed_key(const zmk_event_t *ev) {
|
||||||
|
|
||||||
const struct zmk_listener zmk_listener_combo;
|
const struct zmk_listener zmk_listener_combo;
|
||||||
|
|
||||||
static void release_pressed_keys() {
|
static int release_pressed_keys() {
|
||||||
// release the first key that was pressed
|
for (int i = 0; i < CONFIG_ZMK_COMBO_MAX_KEYS_PER_COMBO; i++) {
|
||||||
if (pressed_keys[0] == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ZMK_EVENT_RELEASE(pressed_keys[0])
|
|
||||||
pressed_keys[0] = NULL;
|
|
||||||
|
|
||||||
// reprocess events (see tests/combo/fully-overlapping-combos-3 for why this is needed)
|
|
||||||
for (int i = 1; i < CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY; i++) {
|
|
||||||
if (pressed_keys[i] == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const zmk_event_t *captured_event = pressed_keys[i];
|
const zmk_event_t *captured_event = pressed_keys[i];
|
||||||
|
if (pressed_keys[i] == NULL) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
pressed_keys[i] = NULL;
|
pressed_keys[i] = NULL;
|
||||||
|
if (i == 0) {
|
||||||
|
LOG_DBG("combo: releasing position event %d",
|
||||||
|
as_zmk_position_state_changed(captured_event)->position);
|
||||||
|
ZMK_EVENT_RELEASE(captured_event)
|
||||||
|
} else {
|
||||||
|
// reprocess events (see tests/combo/fully-overlapping-combos-3 for why this is needed)
|
||||||
|
LOG_DBG("combo: reraising position event %d",
|
||||||
|
as_zmk_position_state_changed(captured_event)->position);
|
||||||
ZMK_EVENT_RAISE(captured_event);
|
ZMK_EVENT_RAISE(captured_event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return CONFIG_ZMK_COMBO_MAX_KEYS_PER_COMBO;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int press_combo_behavior(struct combo_cfg *combo, int32_t timestamp) {
|
static inline int press_combo_behavior(struct combo_cfg *combo, int32_t timestamp) {
|
||||||
struct zmk_behavior_binding_event event = {
|
struct zmk_behavior_binding_event event = {
|
||||||
|
@ -360,14 +369,14 @@ static bool release_combo_key(int32_t position, int64_t timestamp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cleanup() {
|
static int cleanup() {
|
||||||
k_delayed_work_cancel(&timeout_task);
|
k_delayed_work_cancel(&timeout_task);
|
||||||
clear_candidates();
|
clear_candidates();
|
||||||
if (fully_pressed_combo != NULL) {
|
if (fully_pressed_combo != NULL) {
|
||||||
activate_combo(fully_pressed_combo);
|
activate_combo(fully_pressed_combo);
|
||||||
fully_pressed_combo = NULL;
|
fully_pressed_combo = NULL;
|
||||||
}
|
}
|
||||||
release_pressed_keys();
|
return release_pressed_keys();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_timeout_task() {
|
static void update_timeout_task() {
|
||||||
|
@ -399,6 +408,7 @@ static int position_state_down(const zmk_event_t *ev, struct zmk_position_state_
|
||||||
update_timeout_task();
|
update_timeout_task();
|
||||||
|
|
||||||
struct combo_cfg *candidate_combo = candidates[0].combo;
|
struct combo_cfg *candidate_combo = candidates[0].combo;
|
||||||
|
LOG_DBG("combo: capturing position event %d", data->position);
|
||||||
int ret = capture_pressed_key(ev);
|
int ret = capture_pressed_key(ev);
|
||||||
switch (num_candidates) {
|
switch (num_candidates) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -418,13 +428,18 @@ static int position_state_down(const zmk_event_t *ev, struct zmk_position_state_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int position_state_up(struct zmk_position_state_changed *ev) {
|
static int position_state_up(const zmk_event_t *ev, struct zmk_position_state_changed *data) {
|
||||||
cleanup();
|
int released_keys = cleanup();
|
||||||
if (release_combo_key(ev->position, ev->timestamp)) {
|
if (release_combo_key(data->position, data->timestamp)) {
|
||||||
return ZMK_EV_EVENT_HANDLED;
|
return ZMK_EV_EVENT_HANDLED;
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
if (released_keys > 1) {
|
||||||
|
// The second and further key down events are re-raised. To preserve
|
||||||
|
// correct order for e.g. hold-taps, reraise the key up event too.
|
||||||
|
ZMK_EVENT_RAISE(ev);
|
||||||
|
return ZMK_EV_EVENT_CAPTURED;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void combo_timeout_handler(struct k_work *item) {
|
static void combo_timeout_handler(struct k_work *item) {
|
||||||
|
@ -447,7 +462,7 @@ static int position_state_changed_listener(const zmk_event_t *ev) {
|
||||||
if (data->state) { // keydown
|
if (data->state) { // keydown
|
||||||
return position_state_down(ev, data);
|
return position_state_down(ev, data);
|
||||||
} else { // keyup
|
} else { // keyup
|
||||||
return position_state_up(data);
|
return position_state_up(ev, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,16 @@ static lv_obj_t *screen;
|
||||||
|
|
||||||
__attribute__((weak)) lv_obj_t *zmk_display_status_screen() { return NULL; }
|
__attribute__((weak)) lv_obj_t *zmk_display_status_screen() { return NULL; }
|
||||||
|
|
||||||
void display_tick_cb(struct k_work *work) {
|
void display_tick_cb(struct k_work *work) { lv_task_handler(); }
|
||||||
lv_tick_inc(10);
|
|
||||||
lv_task_handler();
|
#define TICK_MS 10
|
||||||
}
|
|
||||||
|
|
||||||
K_WORK_DEFINE(display_tick_work, display_tick_cb);
|
K_WORK_DEFINE(display_tick_work, display_tick_cb);
|
||||||
|
|
||||||
void display_timer_cb() { k_work_submit(&display_tick_work); }
|
void display_timer_cb() {
|
||||||
|
lv_tick_inc(TICK_MS);
|
||||||
|
k_work_submit(&display_tick_work);
|
||||||
|
}
|
||||||
|
|
||||||
K_TIMER_DEFINE(display_timer, display_timer_cb, NULL);
|
K_TIMER_DEFINE(display_timer, display_timer_cb, NULL);
|
||||||
|
|
||||||
|
@ -44,7 +46,7 @@ static void start_display_updates() {
|
||||||
|
|
||||||
display_blanking_off(display);
|
display_blanking_off(display);
|
||||||
|
|
||||||
k_timer_start(&display_timer, K_MSEC(10), K_MSEC(10));
|
k_timer_start(&display_timer, K_MSEC(TICK_MS), K_MSEC(TICK_MS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stop_display_updates() {
|
static void stop_display_updates() {
|
||||||
|
@ -75,8 +77,6 @@ int zmk_display_init() {
|
||||||
|
|
||||||
lv_scr_load(screen);
|
lv_scr_load(screen);
|
||||||
|
|
||||||
lv_task_handler();
|
|
||||||
|
|
||||||
start_display_updates();
|
start_display_updates();
|
||||||
|
|
||||||
LOG_DBG("");
|
LOG_DBG("");
|
||||||
|
|
|
@ -22,13 +22,13 @@ int zmk_event_manager_handle_from(zmk_event_t *event, uint8_t start_index) {
|
||||||
uint8_t len = __event_subscriptions_end - __event_subscriptions_start;
|
uint8_t len = __event_subscriptions_end - __event_subscriptions_start;
|
||||||
for (int i = start_index; i < len; i++) {
|
for (int i = start_index; i < len; i++) {
|
||||||
struct zmk_event_subscription *ev_sub = __event_subscriptions_start + i;
|
struct zmk_event_subscription *ev_sub = __event_subscriptions_start + i;
|
||||||
if (ev_sub->event_type == event->event) {
|
if (ev_sub->event_type != event->event) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ret = ev_sub->listener->callback(event);
|
ret = ev_sub->listener->callback(event);
|
||||||
if (ret < 0) {
|
|
||||||
LOG_DBG("Listener returned an error: %d", ret);
|
|
||||||
goto release;
|
|
||||||
} else if (ret > 0) {
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
|
case ZMK_EV_EVENT_BUBBLE:
|
||||||
|
continue;
|
||||||
case ZMK_EV_EVENT_HANDLED:
|
case ZMK_EV_EVENT_HANDLED:
|
||||||
LOG_DBG("Listener handled the event");
|
LOG_DBG("Listener handled the event");
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -38,8 +38,9 @@ int zmk_event_manager_handle_from(zmk_event_t *event, uint8_t start_index) {
|
||||||
event->last_listener_index = i;
|
event->last_listener_index = i;
|
||||||
// Listeners are expected to free events they capture
|
// Listeners are expected to free events they capture
|
||||||
return 0;
|
return 0;
|
||||||
}
|
default:
|
||||||
}
|
LOG_DBG("Listener returned an error: %d", ret);
|
||||||
|
goto release;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,13 +231,7 @@ static const struct ext_power_api api = {.enable = ext_power_generic_enable,
|
||||||
|
|
||||||
#define ZMK_EXT_POWER_INIT_PRIORITY 81
|
#define ZMK_EXT_POWER_INIT_PRIORITY 81
|
||||||
|
|
||||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
DEVICE_DT_INST_DEFINE(0, ext_power_generic_init, &ext_power_generic_pm_control, &data, &config,
|
||||||
DEVICE_DEFINE(ext_power_generic, DT_INST_LABEL(0), ext_power_generic_init,
|
|
||||||
&ext_power_generic_pm_control, &data, &config, POST_KERNEL,
|
|
||||||
ZMK_EXT_POWER_INIT_PRIORITY, &api);
|
|
||||||
#else
|
|
||||||
DEVICE_AND_API_INIT(ext_power_generic, DT_INST_LABEL(0), ext_power_generic_init, &data, &config,
|
|
||||||
POST_KERNEL, ZMK_EXT_POWER_INIT_PRIORITY, &api);
|
POST_KERNEL, ZMK_EXT_POWER_INIT_PRIORITY, &api);
|
||||||
#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */
|
|
||||||
|
|
||||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
||||||
|
|
|
@ -47,7 +47,7 @@ void zmk_kscan_process_msgq(struct k_work *item) {
|
||||||
while (k_msgq_get(&zmk_kscan_msgq, &ev, K_NO_WAIT) == 0) {
|
while (k_msgq_get(&zmk_kscan_msgq, &ev, K_NO_WAIT) == 0) {
|
||||||
bool pressed = (ev.state == ZMK_KSCAN_EVENT_STATE_PRESSED);
|
bool pressed = (ev.state == ZMK_KSCAN_EVENT_STATE_PRESSED);
|
||||||
uint32_t position = zmk_matrix_transform_row_column_to_position(ev.row, ev.column);
|
uint32_t position = zmk_matrix_transform_row_column_to_position(ev.row, ev.column);
|
||||||
LOG_DBG("Row: %d, col: %d, position: %d, pressed: %s\n", ev.row, ev.column, position,
|
LOG_DBG("Row: %d, col: %d, position: %d, pressed: %s", ev.row, ev.column, position,
|
||||||
(pressed ? "true" : "false"));
|
(pressed ? "true" : "false"));
|
||||||
ZMK_EVENT_RAISE(new_zmk_position_state_changed((struct zmk_position_state_changed){
|
ZMK_EVENT_RAISE(new_zmk_position_state_changed((struct zmk_position_state_changed){
|
||||||
.state = pressed, .position = position, .timestamp = k_uptime_get()}));
|
.state = pressed, .position = position, .timestamp = k_uptime_get()}));
|
||||||
|
|
|
@ -23,18 +23,12 @@ bool is_usb_power_present() {
|
||||||
#endif /* CONFIG_USB */
|
#endif /* CONFIG_USB */
|
||||||
}
|
}
|
||||||
|
|
||||||
enum power_states sys_pm_policy_next_state(int32_t ticks) {
|
struct pm_state_info pm_policy_next_state(int32_t ticks) {
|
||||||
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES
|
|
||||||
#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1
|
|
||||||
if (zmk_activity_get_state() == ZMK_ACTIVITY_SLEEP && !is_usb_power_present()) {
|
if (zmk_activity_get_state() == ZMK_ACTIVITY_SLEEP && !is_usb_power_present()) {
|
||||||
return SYS_POWER_STATE_DEEP_SLEEP_1;
|
return (struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0};
|
||||||
}
|
|
||||||
#endif /* CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 */
|
|
||||||
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */
|
|
||||||
|
|
||||||
return SYS_POWER_STATE_ACTIVE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sys_pm_policy_low_power_devices(enum power_states pm_state) {
|
return (struct pm_state_info){PM_STATE_ACTIVE, 0, 0};
|
||||||
return sys_pm_is_sleep_state(pm_state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__weak bool pm_policy_low_power_devices(enum pm_state state) { return pm_is_sleep_state(state); }
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo//p
|
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo//p
|
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo//p
|
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo//p
|
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo//p
|
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo//p
|
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo//p
|
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo//p
|
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo//p
|
|
|
@ -0,0 +1 @@
|
||||||
|
s/.*hid_listener_keycode_//p
|
|
@ -0,0 +1,2 @@
|
||||||
|
pressed: usage_page 0x07 keycode 0x1d implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
released: usage_page 0x07 keycode 0x1d implicit_mods 0x00 explicit_mods 0x00
|
|
@ -0,0 +1,39 @@
|
||||||
|
#include <dt-bindings/zmk/keys.h>
|
||||||
|
#include <behaviors.dtsi>
|
||||||
|
#include <dt-bindings/zmk/kscan-mock.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
combos {
|
||||||
|
compatible = "zmk,combos";
|
||||||
|
combo_one {
|
||||||
|
timeout-ms = <80>;
|
||||||
|
key-positions = <0 1 2 3>;
|
||||||
|
bindings = <&kp Z>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
keymap {
|
||||||
|
compatible = "zmk,keymap";
|
||||||
|
label ="Default keymap";
|
||||||
|
|
||||||
|
default_layer {
|
||||||
|
bindings = <
|
||||||
|
&kp A &kp B
|
||||||
|
&kp C &kp D
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&kscan {
|
||||||
|
events = <
|
||||||
|
ZMK_MOCK_PRESS(1,1,10)
|
||||||
|
ZMK_MOCK_PRESS(0,1,10)
|
||||||
|
ZMK_MOCK_PRESS(1,0,10)
|
||||||
|
ZMK_MOCK_PRESS(0,0,10)
|
||||||
|
ZMK_MOCK_RELEASE(0,0,100)
|
||||||
|
ZMK_MOCK_RELEASE(1,0,100)
|
||||||
|
ZMK_MOCK_RELEASE(0,1,100)
|
||||||
|
ZMK_MOCK_RELEASE(1,1,100)
|
||||||
|
>;
|
||||||
|
};
|
|
@ -0,0 +1 @@
|
||||||
|
s/.*hid_listener_keycode_//p
|
|
@ -0,0 +1,4 @@
|
||||||
|
pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
|
|
@ -0,0 +1,35 @@
|
||||||
|
#include <dt-bindings/zmk/keys.h>
|
||||||
|
#include <behaviors.dtsi>
|
||||||
|
#include <dt-bindings/zmk/kscan-mock.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
combos {
|
||||||
|
compatible = "zmk,combos";
|
||||||
|
combo_one {
|
||||||
|
timeout-ms = <80>;
|
||||||
|
key-positions = <0 1 2 3>;
|
||||||
|
bindings = <&kp Z>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
keymap {
|
||||||
|
compatible = "zmk,keymap";
|
||||||
|
label ="Default keymap";
|
||||||
|
|
||||||
|
default_layer {
|
||||||
|
bindings = <
|
||||||
|
&kp A &kp B
|
||||||
|
&kp C &kp D
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&kscan {
|
||||||
|
events = <
|
||||||
|
ZMK_MOCK_PRESS(1,1,10)
|
||||||
|
ZMK_MOCK_PRESS(0,1,10)
|
||||||
|
ZMK_MOCK_RELEASE(0,1,100)
|
||||||
|
ZMK_MOCK_RELEASE(1,1,100)
|
||||||
|
>;
|
||||||
|
};
|
|
@ -0,0 +1 @@
|
||||||
|
s/.*hid_listener_keycode_//p
|
|
@ -0,0 +1,6 @@
|
||||||
|
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
|
@ -0,0 +1,37 @@
|
||||||
|
#include <dt-bindings/zmk/keys.h>
|
||||||
|
#include <behaviors.dtsi>
|
||||||
|
#include <dt-bindings/zmk/kscan-mock.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
combos {
|
||||||
|
compatible = "zmk,combos";
|
||||||
|
combo_one {
|
||||||
|
timeout-ms = <80>;
|
||||||
|
key-positions = <0 1 2>;
|
||||||
|
bindings = <&kp Z>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
keymap {
|
||||||
|
compatible = "zmk,keymap";
|
||||||
|
label ="Default keymap";
|
||||||
|
|
||||||
|
default_layer {
|
||||||
|
bindings = <
|
||||||
|
&kp A &kp B
|
||||||
|
&kp C &kp D
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&kscan {
|
||||||
|
events = <
|
||||||
|
ZMK_MOCK_PRESS(0,0,10)
|
||||||
|
ZMK_MOCK_PRESS(0,1,10)
|
||||||
|
ZMK_MOCK_PRESS(1,1,10)
|
||||||
|
ZMK_MOCK_RELEASE(1,1,100)
|
||||||
|
ZMK_MOCK_RELEASE(0,1,100)
|
||||||
|
ZMK_MOCK_RELEASE(0,0,100)
|
||||||
|
>;
|
||||||
|
};
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo/combo/p
|
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo/combo/p
|
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
s/.*hid_listener_keycode_//p
|
s/.*hid_listener_keycode_//p
|
||||||
s/.*combo/combo/p
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
s/.*hid_listener_keycode/kp/p
|
||||||
|
s/.*mo_keymap_binding/mo/p
|
||||||
|
s/.*on_hold_tap_binding/ht_binding/p
|
||||||
|
s/.*decide_hold_tap/ht_decide/p
|
|
@ -0,0 +1,10 @@
|
||||||
|
ht_binding_pressed: 0 new undecided hold_tap
|
||||||
|
ht_decide: 0 decided hold-timer (tap-preferred decision moment timer)
|
||||||
|
kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
ht_binding_pressed: 1 new undecided hold_tap
|
||||||
|
ht_decide: 1 decided tap (tap-preferred decision moment key-up)
|
||||||
|
kp_pressed: usage_page 0x07 keycode 0x0d implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
kp_released: usage_page 0x07 keycode 0x0d implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
ht_binding_released: 1 cleaning up hold-tap
|
||||||
|
kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
ht_binding_released: 0 cleaning up hold-tap
|
|
@ -0,0 +1,53 @@
|
||||||
|
#include <dt-bindings/zmk/keys.h>
|
||||||
|
#include <behaviors.dtsi>
|
||||||
|
#include <dt-bindings/zmk/kscan_mock.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A hold-tap with long tapping term is pressed first.
|
||||||
|
* A hold-tap with short tapping term is quickly tapped.
|
||||||
|
* The short tapping term hold-tap should 'tap', not 'hold'.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/ {
|
||||||
|
behaviors {
|
||||||
|
tp_short: short_tap {
|
||||||
|
compatible = "zmk,behavior-hold-tap";
|
||||||
|
label = "MOD_TAP_SHORT";
|
||||||
|
#binding-cells = <2>;
|
||||||
|
flavor = "tap-preferred";
|
||||||
|
tapping-term-ms = <100>;
|
||||||
|
quick-tap-ms = <200>;
|
||||||
|
bindings = <&kp>, <&kp>;
|
||||||
|
};
|
||||||
|
tp_long: long_tap {
|
||||||
|
compatible = "zmk,behavior-hold-tap";
|
||||||
|
label = "MOD_TAP_LONG";
|
||||||
|
#binding-cells = <2>;
|
||||||
|
flavor = "tap-preferred";
|
||||||
|
tapping-term-ms = <200>;
|
||||||
|
quick-tap-ms = <200>;
|
||||||
|
bindings = <&kp>, <&kp>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
keymap {
|
||||||
|
compatible = "zmk,keymap";
|
||||||
|
label ="Default keymap";
|
||||||
|
|
||||||
|
default_layer {
|
||||||
|
bindings = <
|
||||||
|
&tp_long LEFT_SHIFT F &tp_short LEFT_CONTROL J
|
||||||
|
&kp D &kp RIGHT_CONTROL>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
&kscan {
|
||||||
|
events = <
|
||||||
|
ZMK_MOCK_PRESS(0,0,20)
|
||||||
|
ZMK_MOCK_PRESS(0,1,20)
|
||||||
|
ZMK_MOCK_RELEASE(0,1,200)
|
||||||
|
ZMK_MOCK_RELEASE(0,0,10)
|
||||||
|
>;
|
||||||
|
};
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue