Compare commits

...

63 Commits

Author SHA1 Message Date
Pete Johanson
241ff39556 chore(main): release 0.2.1 (#2851) 2025-03-02 07:45:12 -07:00
Pete Johanson
f20e6ea759 fix(behaviors): Proper comma separated device list (#2850)
Properly generate the comma separated list of devs in caps word/
key repeat.
2025-03-02 06:49:07 -07:00
Pete Johanson
fadafc7759 chore(main): release 0.2.0 (#2693) 2025-03-01 11:29:58 -07:00
Pete Johanson
1e3e62c13d fix(pointing): Temp layer threading protection. (#2729)
fix(pointing): Temp layer threading protection.

Ensure all layer operations occur on the system work queue thread.

Fixes: #2719

fix(pointing): Handle layer events to disable events

Make the temp layer input processor propely handle layers getting
deactivated externally before the temp layer timeout.

Co-authored-by: Nicolas Munnich <98408764+Nick-Munnich@users.noreply.github.com>
2025-02-28 20:37:55 -05:00
Pete Johanson
21f54e7238 refactor(behaviors): Remove unneeded init funcs. (#2843)
Initialization functions are optional for Zephyr drivers, so remove
all our superfluous empty init functions.
2025-02-26 17:54:29 -05:00
Cem Aksoylar
7186528f77 fix(behaviors): Make multiple sticky keys work on same key position (#2758)
test(behaviors): Add same position sticky key tests

fix(behaviors): Make multiple sticky keys work on same key position

refactor(behaviors): Remove unused param2 in sticky keys
2025-02-26 17:54:08 -05:00
Pete Johanson
9406d39d14 refactor(behaviors): Small caps word RAM reduction. (#2842)
Don't use lazy initialized in-memory array of devices.
2025-02-26 17:01:04 -05:00
Nicolas Munnich
82216be635 chore: Add a deprecation warning to config/boards (#2811) 2025-02-26 15:16:50 -05:00
Xudong Zheng
ea267b0f35 fix(ble): enforce maximum length for dynamic device name (#2784) 2025-02-26 13:29:30 -05:00
Pete Johanson
2fe55c4c41 refactor(behaviors): Minor RAM usage tweaks (#2839)
Follow up cleanup of some config structs not marked as const.
2025-02-26 13:17:23 -05:00
Cem Aksoylar
d2eb6de7ad docs: Add query strings to tabs (#2840) 2025-02-25 16:31:57 -08:00
Pete Johanson
209085da73 refactor(behaviors): Add max-held tap-dance config (#2838)
refactor(behaviors): Add max-held tap-dance config

Add new `CONFIG_ZMK_BEHAVIOR_TAP_DANCE_MAX_HELD` config for reducing RAM
usage on more constrained devices.

refactor(behaviors): Move defaults to Kconfig.defaults
2025-02-25 14:12:27 -05:00
Pete Johanson
18d0d2f476 refactor(combos): Reduce combo RAM usage (#2837)
Properly mark combo configs as `const` so they are place in flash,
not RAM.
2025-02-25 13:38:51 -05:00
Cem Aksoylar
8575fc8a9d docs: Inline simple physical layout info in new shield guide (#2827)
docs: Inline simple physical layouts in new shield guide

docs: Fix broken anchor in module creation

docs: Make physical layout transform label consistent and comment
2025-02-17 15:59:54 -08:00
Cem Aksoylar
9d234cbb10 docs: Make default keymap in new shield guide complete (#2825)
Co-authored-by: Nicolas Munnich <98408764+Nick-Munnich@users.noreply.github.com>
2025-02-17 11:55:42 -08:00
Nicolas Munnich
e8ec9b65f8 docs: Add "planned: import/export keymap" to the studio features page (#2821) 2025-02-17 11:44:42 -08:00
Nicolas Munnich
d0d313409b docs: Improved some links to modules (#2822)
Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
2025-02-17 10:16:36 +01:00
Nicolas Munnich
5926269ea5 docs: Add KiCAD note and titles to physical layouts page (#2823)
docs: Note that Nick Coutsos' tool can import from KiCAD

docs: Add titles to some code blocks in physical layouts
2025-02-16 20:12:31 -08:00
Nicolas Munnich
eeb8a00778 docs: Add a page on module creation (#2456)
Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
2025-02-14 16:32:18 -08:00
Pete Johanson
aa3e5dd70f feat(display): Add config for display update period (#2819)
Add `CONFIG_ZMK_DISPLAY_TICK_PERIOD_MS` Kconfig to allow tweaking
the period between display updates.
2025-02-10 13:32:16 -05:00
Pete Johanson
627e6dbec9 feat(display): Add ability to set display on/off pin. (#2814)
Zephyr is still working on the plan upstream for generically controlling
display "backlight" pins with GPIO/PWM, so in the meantime, add our
own chosen property `zmk,display-led` that is set to an LED device child
to allow blanking/unblanking of devices that use a dedicated backlight
control pin.
2025-02-07 17:49:30 -07:00
Alex Rozhkov
424e53210e feat(shields): Add physical layout for Lotus58 (#2753)
Added physical layout and studio support for Lotus58.
2025-02-07 14:35:13 -05:00
Pete Johanson
4b4a8a35f3 fix(display): POSIX lvgl fixes (#2812)
fix(display): Do LVGL task processing in main on POSIX.

An SDL/Zephyr bug prevents proper display when SDL calls are
made from anything but the main thread, so add task handling
in our simple main function when on POSIX.

fix(usb): Compilation fix for 64-bit targets

Properly handle differences in the size of `size_t` on 64-bit
architectures.

fix(display): Imply, but don't force, LVGL mono theme

Some targets may be using color displays, so instead of forcing
on the mono theme, merely imply it to default it
2025-02-07 02:05:21 -05:00
Cem Aksoylar
0f7c11248a feat(pointing): Add pre-defined scroll scaler and mouse scroll tests (#2759)
feat(pointing): Add pre-defined scroll scaler

tests(pointing): Add mouse scroll tests
2025-02-04 10:27:14 -07:00
Nicolas Munnich
8e065d55b9 fix(kscan): Remove warning when keyboard is built without CONFIG_PM_DEVICE (#2808) 2025-02-01 11:16:52 -07:00
Pete Johanson
425256bc0d fix(display): Only default mono theme when 1bpp (#2804)
In order to have flexibility for color displays, only imply the mono
theme if we have 1bpp.
2025-01-31 22:53:35 -05:00
Cem Aksoylar
72b00b3f58 docs: Add pointers to final Kconfig/devicetree files (#2796)
docs: Add diagnosis pointers for Kconfig/devicetree outputs

docs: Add tip boxes for diagnosing config/devicetree changes
2025-01-25 13:04:50 -08:00
Cem Aksoylar
e4885d5d4c docs: Update keymaps index intro (#2790)
Co-authored-by: Nicolas Munnich <98408764+Nick-Munnich@users.noreply.github.com>
2025-01-25 12:30:50 -08:00
Cem Aksoylar
4f72e7cb25 docs: Update intro page (#2767) 2025-01-22 16:58:15 -08:00
Cem Aksoylar
4882a62c40 docs: Update dongle FAQ entry (#2788) 2025-01-22 10:09:03 +01:00
Xudong Zheng
40e9e5c5fa test(split): remove build banner from snapshot (#2787)
The test snapshot will otherwise be outdated each time there is a new
commit on https://github.com/zmkfirmware/zephyr.
2025-01-21 12:40:27 -05:00
Nick Winans
40ea92d201 docs: Link to ZMK Studio download page (#2783) 2025-01-20 21:30:55 -08:00
dependabot[bot]
db2fc2bffd chore(deps): bump katex from 0.16.11 to 0.16.21 in /docs (#2774)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-17 15:15:54 -08:00
Pete Johanson
e4f1454e0b refactor(keymap): Reduce flash usage for studio builds (#2771)
When building for ZMK Studio, we can use the constant stock keymap
for init of the in-memory keymap, to avoid duplicate flash usage
for the keymap from the devicetree.
2025-01-15 16:51:26 -05:00
Pete Johanson
c367d8f636 feat(core): Make physical layout key rotation optional (#2770)
To be able to save on flash space, for layouts on space constrained
devices that don't require rotation, make key rotation props
optional behind a new Kconfig flag.
2025-01-15 16:48:18 -05:00
Pete Johanson
6941abc2af fix(drivers): Proper static/const for data/config (#2769)
Save a tiny bit of RAM by properly marking our device config
struct instances const consistently, and also add missing static
modifiers to properly isolate config/data for drivers.
2025-01-15 12:35:35 -05:00
Cem Aksoylar
700e9b264f docs: Move more sections under hardware integration (#2704)
docs: Move battery sensing hardware integration to new page

docs: Refactor lighting hardware integrations to new category

docs: Link to pin control page from lighting pages

docs: Consolidate lighting feature pages

docs: Remove incorrect redirect

docs: Consolidate lighting config pages
2025-01-13 21:14:25 -08:00
Pete Johanson
8dddb1d9d7 Testing: split input test (#2762)
test(pointing): Add mock input device.

New mock input device to generate input events for tests.

test(split): Add peripheral input test.

Test event propagation from peripheral input devices.

fix(split): Proper scoping for local within switch.

Minor compile fix.

chore: Fix up test snapshots after logging changes.

Adjust the test snapshots after logging changes to the central.

fix(kscan): Don't fire last mock event twice.

Fix a bug where the kscan mock would raise the last mock event
twice before halting processing.
2025-01-13 15:15:16 -05:00
Cem Aksoylar
022603ec16 docs: Fix broken anchors in dongle page (#2764) 2025-01-13 09:21:55 +01:00
Aasim-A
b93bf6d3fd docs: Fix incorrect kscan value (#2763) 2025-01-12 15:51:30 +01:00
Pete Johanson
d0ee30bfaa Testing: split ble encoder test (#2754)
test(sensors): Add mock encoder sensor

Add a new mock sensor driver for generating mock encoder sensor channel
data.

test(split): Add a peripheral sensor split test

Test BLE split logic for peripheral sensors (encoders).
2025-01-06 14:41:02 -05:00
Cem Aksoylar
3377ed02a8 docs: Improve pointing docs (#2703)
docs: Add missing code fence languages in pointing

docs: Fix default msc exponent in example

docs: Make pointing hardware integration follow semantic structure
2025-01-04 11:15:32 -08:00
Pete Johanson
36508c27fd fix(studio): Allow adding layers after a layer move (#2748)
Properly return the available layers in the move layer response.
2025-01-03 19:19:19 -05:00
Pete Johanson
e6343f44ce test(split): Test split HID indicator setting. (#2747)
Add integration test for HID indicator state being propagated
to split peripherals.
2025-01-03 18:05:18 -05:00
Nicolas Munnich
bc6bb90414 docs: added a page on dongles.
Co-authored-by: rasmuskoit <rasmuskoit@gmail.com>
Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
2025-01-02 10:44:50 -08:00
Willow Herring
05abd677c5 chore: Add trailing lines to fix build warnings (#2743)
When building a unibody or central warnings get thrown for the backslash newlines at EOF in combos.h and input_listeners.h. Adding a trailing newline to the affected files rectifies this
2025-01-02 08:58:49 -07:00
Pete Johanson
f0a77b888a fix(combos): Properly report combos len with emply block (#2739)
Handle the scenario where there is an empty combos block and return
a zero combos length.
2025-01-01 18:14:53 -05:00
Pete Johanson
85aba16eec testing: Add split BLE tests (#2737)
* Enhance the BLE test runner to build additional peripheral builds
  when detecting peripheral*.overlay files in the test.
* Add basic and multiple-peripheral tests to exercise the testing
  support
* Add test for triggering local behaviors on split peripherals.

fix(ble): Fix building split code w/o settings

* Properly exclude storing peripheral addresses to settings when
  settings support isn't turned on.
2025-01-01 18:13:47 -05:00
Robert U
3f6841c95f chore: Allow running tests from anywhere and support EXTRA_MODULES (#2725)
* Allow running tests from anywhere in the workspace
* Trigger test workflow if run-test.sh changes
2024-12-20 15:19:56 -05:00
Nicolas Munnich
2f172f63c2 chore: Docs bullet point in PR checklist (#2718) 2024-12-20 14:31:37 -05:00
Nicolas Munnich
bb486619a1 fix: Kconfig refactor now works correctly with external modules (#2711) 2024-12-18 23:32:30 -07:00
Pete Johanson
cb867f92db Feature: input processor behavior invocation (#2714)
refactor(pointing): Allow stopping event propagation

    Allow input processors to return a special value if a given input event
    should not be further processed/propagated.

feat(pointing): Add behavior input processor

    Add the ability to intercept certain input events and trigger behaviors
    when they occur.

Co-authored-by: Jorge Villalobos <minusfive@users.noreply.github.com>
Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
2024-12-17 20:50:06 -05:00
dependabot[bot]
d0016b34f8 chore(deps-dev): bump the development group across 1 directory with 7 updates (#2698)
Bumps the development group with 7 updates in the /docs directory:

| Package | From | To |
| --- | --- | --- |
| [@docusaurus/module-type-aliases](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus-module-type-aliases) | `3.6.1` | `3.6.3` |
| [@docusaurus/tsconfig](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus-tsconfig) | `3.5.2` | `3.6.3` |
| [@docusaurus/types](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus-types) | `3.6.1` | `3.6.3` |
| [json-schema-to-typescript](https://github.com/bcherny/json-schema-to-typescript) | `15.0.2` | `15.0.3` |
| [prettier](https://github.com/prettier/prettier) | `3.3.3` | `3.4.2` |
| [typescript](https://github.com/microsoft/TypeScript) | `5.6.3` | `5.7.2` |
| [webpack](https://github.com/webpack/webpack) | `5.96.1` | `5.97.1` |



Updates `@docusaurus/module-type-aliases` from 3.6.1 to 3.6.3
- [Release notes](https://github.com/facebook/docusaurus/releases)
- [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/docusaurus/commits/v3.6.3/packages/docusaurus-module-type-aliases)

Updates `@docusaurus/tsconfig` from 3.5.2 to 3.6.3
- [Release notes](https://github.com/facebook/docusaurus/releases)
- [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/docusaurus/commits/v3.6.3/packages/docusaurus-tsconfig)

Updates `@docusaurus/types` from 3.6.1 to 3.6.3
- [Release notes](https://github.com/facebook/docusaurus/releases)
- [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/docusaurus/commits/v3.6.3/packages/docusaurus-types)

Updates `json-schema-to-typescript` from 15.0.2 to 15.0.3
- [Changelog](https://github.com/bcherny/json-schema-to-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bcherny/json-schema-to-typescript/commits)

Updates `prettier` from 3.3.3 to 3.4.2
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.3.3...3.4.2)

Updates `typescript` from 5.6.3 to 5.7.2
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.6.3...v5.7.2)

Updates `webpack` from 5.96.1 to 5.97.1
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.96.1...v5.97.1)

---
updated-dependencies:
- dependency-name: "@docusaurus/module-type-aliases"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: development
- dependency-name: "@docusaurus/tsconfig"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development
- dependency-name: "@docusaurus/types"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: development
- dependency-name: json-schema-to-typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: development
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-13 10:07:46 +01:00
Nicolas Munnich
ec6b770947 docs: Minor touchups to studio related bits (#2707) 2024-12-13 10:03:08 +01:00
Nicolas Munnich
4ef231f4bb feat: Added toggle-mode, allowing toggle-on and toggle-off (#2555)
feat: added toggle mode to key and layer toggles

docs: documented toggle mode changes
2024-12-12 19:13:56 -05:00
Joel Spadin
7013158a67 fix: Fix warnings in nanopb encoding code (#2643)
The "arg" field on nanopb structs is a void* because it is shared
between the encode and decode callbacks, even though the encode
callback probably should not modify the data. We are passing const data
using this non-const pointer, which causes warnings about discarding
const. This commit explicitly casts to void* to suppress these warnings.
2024-12-11 15:00:48 -05:00
svek1
a8f5ab67b5 fix: allow kscan-composite to wake up device. (#2682)
* include kscan.yaml so we can set kscan-composite as a wakeup source
* modify enable and disable callback to check for wakeup capabilities of
composite and children
* disable children wakeup source

The disable function is only called
when the composite is not an enabled wakeup source.
In that case the children should also not be an enabled
wakeup source, so they can get suspended
2024-12-11 14:46:22 -05:00
Pete Johanson
84baf929c9 fix(pointing): Complete header rename missed in refactor (#2702)
* Update a few mouse.h -> pointing.h missed refactors.
2024-12-10 02:29:35 -05:00
Pete Johanson
6b40bfda53 feat(mouse): Add mouse move and scroll support (#2477)
* feat(mouse): Add mouse move and scroll support

    * Use Zephyr input subsystem for all pointers.
    * Input processors for modifying events, e.g. scaling, swapping
      codes, temporary (mouse) layers, etc.
    * Mouse move/scroll behaviors.
    * Infrastructure in place for physical pointer input devices.

* feat: Add input split support.

* docs: Add initial pointer docs.

---------

Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
Co-authored-by: Alexander Krikun <krikun98@gmail.com>
Co-authored-by: Robert U <urob@users.noreply.github.com>
Co-authored-by: Shawn Meier <ftc@users.noreply.github.com>
Co-authored-by: Chris Andreae <chris@andreae.gen.nz>
Co-authored-by: Anant Thazhemadam <47104651+thazhemadam@users.noreply.github.com>
Co-authored-by: Erik Tollerud <erik.tollerud@gmail.com>
Co-authored-by: Nicolas Munnich <98408764+Nick-Munnich@users.noreply.github.com>
2024-12-09 19:45:41 -05:00
pabile
7e8c542c94 feat(studio): Add ortho_4x10 grid layout (#2651)
* added 4x10 grid layout

Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
2024-12-09 12:53:54 -05:00
Pete Johanson
0820991901 fix(studio): Properly return complete keymap from RPC (#2696)
Ensure the set active physical layout RPC returns the full keymap
details including the available layers.
2024-12-06 18:10:58 -05:00
yuki
b26058b6c7 feat(boards): Update for mikoto board definition (#1946)
* Set default revision to 5.20
* update mikoto board defs
* add revision info to mikoto.zmk.yml
* use zephyr aliases to handle mikoto_520
* enable pull-ups for on-board i2c
2024-12-05 02:02:58 -05:00
Nicolas Munnich
40925d48e6 refactor(Kconfig): Extracted designer defaults out into new files (#2537)
docs: Fix incorrect kconfig default values

fix(Kconfig): Added a name to EC11's trigger mode choice, allowing it to be set in device Kconfig.defconfig

refactor(Kconfig): Moved designer defaults out into new files
2024-12-04 16:19:35 -05:00
388 changed files with 9130 additions and 1136 deletions

View File

@@ -6,3 +6,4 @@
- [ ] Additional tests are included, if changing behaviors/core code that is testable.
- [ ] Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
- [ ] [Pre-commit](https://zmk.dev/docs/development/local-toolchain/pre-commit) used to check formatting of files, commit messages, etc.
- [ ] Includes any necessary [documentation changes](https://zmk.dev/docs/development/contributing/documentation).

View File

@@ -4,12 +4,14 @@ on:
push:
paths:
- ".github/workflows/test.yml"
- "app/run-test.sh"
- "app/tests/**"
- "app/src/**"
- "app/include/**"
pull_request:
paths:
- ".github/workflows/test.yml"
- "app/run-test.sh"
- "app/tests/**"
- "app/src/**"
- "app/include/**"

View File

@@ -1 +1 @@
{".":"0.1.0"}
{".":"0.2.1"}

View File

@@ -1,5 +1,52 @@
# Changelog
## [0.2.1](https://github.com/zmkfirmware/zmk/compare/v0.2.0...v0.2.1) (2025-03-02)
### Bug Fixes
* **behaviors:** Proper comma separated device list ([#2850](https://github.com/zmkfirmware/zmk/issues/2850)) ([f20e6ea](https://github.com/zmkfirmware/zmk/commit/f20e6ea7594b49eef1e3acc017529073a0409962))
## [0.2.0](https://github.com/zmkfirmware/zmk/compare/v0.1.0...v0.2.0) (2025-03-01)
### Features
* Added `toggle-mode`, allowing toggle-on and toggle-off ([#2555](https://github.com/zmkfirmware/zmk/issues/2555)) ([4ef231f](https://github.com/zmkfirmware/zmk/commit/4ef231f4bba87151acfbd1cf3babd83b69813e45))
* added toggle mode to key and layer toggles ([4ef231f](https://github.com/zmkfirmware/zmk/commit/4ef231f4bba87151acfbd1cf3babd83b69813e45))
* **boards:** Update for mikoto board definition ([#1946](https://github.com/zmkfirmware/zmk/issues/1946)) ([b26058b](https://github.com/zmkfirmware/zmk/commit/b26058b6c7c83f8d1f095d2f9c6c3998b391a61b))
* **core:** Make physical layout key rotation optional ([#2770](https://github.com/zmkfirmware/zmk/issues/2770)) ([c367d8f](https://github.com/zmkfirmware/zmk/commit/c367d8f636f0842b414c2b58df6101761cdd676d))
* **display:** Add ability to set display on/off pin. ([#2814](https://github.com/zmkfirmware/zmk/issues/2814)) ([627e6db](https://github.com/zmkfirmware/zmk/commit/627e6dbec99211b3d7cce55904fb1c824ed87bf3))
* **display:** Add config for display update period ([#2819](https://github.com/zmkfirmware/zmk/issues/2819)) ([aa3e5dd](https://github.com/zmkfirmware/zmk/commit/aa3e5dd70fdd1b364fa9ad26f14425be613d180c))
* input processor behavior invocation ([#2714](https://github.com/zmkfirmware/zmk/issues/2714)) ([cb867f9](https://github.com/zmkfirmware/zmk/commit/cb867f92dbe4e32675c2137fc6aa914a44ecc8dc))
* **Kconfig:** Allow overriding ZMK Kconfig defaults ([#2537](https://github.com/zmkfirmware/zmk/issues/2537)) ([40925d4](https://github.com/zmkfirmware/zmk/commit/40925d48e67b3eeaeb3e848a2287ed628de9f674))
* **mouse:** Add mouse move and scroll support ([#2477](https://github.com/zmkfirmware/zmk/issues/2477)) ([6b40bfd](https://github.com/zmkfirmware/zmk/commit/6b40bfda53571f7a960ccc448aa87f29da7496ac))
* **pointing:** Add behavior input processor ([cb867f9](https://github.com/zmkfirmware/zmk/commit/cb867f92dbe4e32675c2137fc6aa914a44ecc8dc))
* **pointing:** Add pre-defined scroll scaler ([0f7c112](https://github.com/zmkfirmware/zmk/commit/0f7c11248a1ddb7c6559064c2a1e7a3c446d5d55))
* **pointing:** Add pre-defined scroll scaler and mouse scroll tests ([#2759](https://github.com/zmkfirmware/zmk/issues/2759)) ([0f7c112](https://github.com/zmkfirmware/zmk/commit/0f7c11248a1ddb7c6559064c2a1e7a3c446d5d55))
* **shields:** Add physical layout for Lotus58 ([#2753](https://github.com/zmkfirmware/zmk/issues/2753)) ([424e532](https://github.com/zmkfirmware/zmk/commit/424e53210ea16c2287abaf770ebf45be432d841a))
* **studio:** Add ortho_4x10 grid layout ([#2651](https://github.com/zmkfirmware/zmk/issues/2651)) ([7e8c542](https://github.com/zmkfirmware/zmk/commit/7e8c542c94908ac011ec7272a5f8ab10d2102632))
### Bug Fixes
* allow kscan-composite to wake up device. ([#2682](https://github.com/zmkfirmware/zmk/issues/2682)) ([a8f5ab6](https://github.com/zmkfirmware/zmk/commit/a8f5ab67b5d449a2624e2de7ddfb264da778ea6c))
* **behaviors:** Make multiple sticky keys work on same key position ([7186528](https://github.com/zmkfirmware/zmk/commit/7186528f77bf077173927c1c8506b4d434e5c371))
* **behaviors:** Make multiple sticky keys work on same key position ([#2758](https://github.com/zmkfirmware/zmk/issues/2758)) ([7186528](https://github.com/zmkfirmware/zmk/commit/7186528f77bf077173927c1c8506b4d434e5c371))
* **ble:** enforce maximum length for dynamic device name ([#2784](https://github.com/zmkfirmware/zmk/issues/2784)) ([ea267b0](https://github.com/zmkfirmware/zmk/commit/ea267b0f35f862b882ac568dde6365c3a0c85099))
* **combos:** Properly report combos len with emply block ([#2739](https://github.com/zmkfirmware/zmk/issues/2739)) ([f0a77b8](https://github.com/zmkfirmware/zmk/commit/f0a77b888ac482a863386ced08e04660ddacb026))
* **display:** Only default mono theme when 1bpp ([#2804](https://github.com/zmkfirmware/zmk/issues/2804)) ([425256b](https://github.com/zmkfirmware/zmk/commit/425256bc0de7ed08802533b170abba78ee90f546))
* **display:** POSIX lvgl fixes ([#2812](https://github.com/zmkfirmware/zmk/issues/2812)) ([4b4a8a3](https://github.com/zmkfirmware/zmk/commit/4b4a8a35f3f90f1af75cdf5d9c26b47d4b8dcabb))
* **drivers:** Proper static/const for data/config ([#2769](https://github.com/zmkfirmware/zmk/issues/2769)) ([6941abc](https://github.com/zmkfirmware/zmk/commit/6941abc2afab16502cff9c5149d8dc0fcd5112c9))
* Fix warnings in nanopb encoding code ([#2643](https://github.com/zmkfirmware/zmk/issues/2643)) ([7013158](https://github.com/zmkfirmware/zmk/commit/7013158a6715d94b34e8c471ce25bb5005f3bb49))
* Kconfig refactor now works correctly with external modules ([#2711](https://github.com/zmkfirmware/zmk/issues/2711)) ([bb48661](https://github.com/zmkfirmware/zmk/commit/bb486619a183f6df7fbb4620c80164555a22da0b))
* **Kconfig:** Added a name to EC11's trigger mode choice ([40925d4](https://github.com/zmkfirmware/zmk/commit/40925d48e67b3eeaeb3e848a2287ed628de9f674))
* **kscan:** Remove warning when keyboard is built without CONFIG_PM_DEVICE ([#2808](https://github.com/zmkfirmware/zmk/issues/2808)) ([8e065d5](https://github.com/zmkfirmware/zmk/commit/8e065d55b916481ef06ce37cddedb84cf1d15d99))
* **pointing:** Complete header rename missed in refactor ([#2702](https://github.com/zmkfirmware/zmk/issues/2702)) ([84baf92](https://github.com/zmkfirmware/zmk/commit/84baf929c9bb95f255d4bafd0e57f2ec47455fca))
* **pointing:** Temp layer threading protection. ([#2729](https://github.com/zmkfirmware/zmk/issues/2729)) ([1e3e62c](https://github.com/zmkfirmware/zmk/commit/1e3e62c13d0666d98831ee302ae2fb17e68196c9))
* **studio:** Allow adding layers after a layer move ([#2748](https://github.com/zmkfirmware/zmk/issues/2748)) ([36508c2](https://github.com/zmkfirmware/zmk/commit/36508c27fddfb84d912e0122e313ad3904ceb946))
* **studio:** Properly return complete keymap from RPC ([#2696](https://github.com/zmkfirmware/zmk/issues/2696)) ([0820991](https://github.com/zmkfirmware/zmk/commit/0820991901a95ab7a0eb1f1cc608a631d514e26c))
## 0.1.0 (2024-11-29)

View File

@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.13.1)
set(CONFIG_APPLICATION_DEFINED_SYSCALL true)
set(ZEPHYR_BOARD_ALIASES "boards/aliases.cmake")
set(ZEPHYR_EXTRA_MODULES "${ZMK_EXTRA_MODULES};${CMAKE_CURRENT_SOURCE_DIR}/module;${CMAKE_CURRENT_SOURCE_DIR}/keymap-module")
# Find Zephyr. This also loads Zephyr's build system.
@@ -16,6 +17,7 @@ if(CONFIG_ZMK_BEHAVIOR_LOCAL_IDS)
endif()
zephyr_syscall_header(${APPLICATION_SOURCE_DIR}/include/drivers/behavior.h)
zephyr_syscall_header(${APPLICATION_SOURCE_DIR}/include/drivers/input_processor.h)
zephyr_syscall_header(${APPLICATION_SOURCE_DIR}/include/drivers/ext_power.h)
# Add your source file to the "app" target. This must come after
@@ -36,15 +38,14 @@ target_sources_ifdef(CONFIG_ZMK_GPIO_KEY_WAKEUP_TRIGGER app PRIVATE src/gpio_key
target_sources(app PRIVATE src/events/activity_state_changed.c)
target_sources(app PRIVATE src/events/position_state_changed.c)
target_sources(app PRIVATE src/events/sensor_event.c)
target_sources(app PRIVATE src/events/mouse_button_state_changed.c)
target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/events/wpm_state_changed.c)
target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/events/usb_conn_state_changed.c)
target_sources(app PRIVATE src/behaviors/behavior_reset.c)
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/behaviors/behavior_ext_power.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_SOFT_OFF app PRIVATE src/behaviors/behavior_soft_off.c)
add_subdirectory_ifdef(CONFIG_ZMK_POINTING src/pointing/)
if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
target_sources(app PRIVATE src/hid.c)
target_sources_ifdef(CONFIG_ZMK_MOUSE app PRIVATE src/mouse.c)
target_sources(app PRIVATE src/behaviors/behavior_key_press.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_KEY_TOGGLE app PRIVATE src/behaviors/behavior_key_toggle.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_HOLD_TAP app PRIVATE src/behaviors/behavior_hold_tap.c)
@@ -64,8 +65,9 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_SENSOR_ROTATE_COMMON app PRIVATE src/behaviors/behavior_sensor_rotate_common.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_MOUSE_KEY_PRESS app PRIVATE src/behaviors/behavior_mouse_key_press.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_STUDIO_UNLOCK app PRIVATE src/behaviors/behavior_studio_unlock.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_INPUT_TWO_AXIS app PRIVATE src/behaviors/behavior_input_two_axis.c)
target_sources(app PRIVATE src/combo.c)
target_sources(app PRIVATE src/behaviors/behavior_tap_dance.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_TAP_DANCE app PRIVATE src/behaviors/behavior_tap_dance.c)
target_sources(app PRIVATE src/behavior_queue.c)
target_sources(app PRIVATE src/conditional_layer.c)
target_sources(app PRIVATE src/endpoints.c)

View File

@@ -46,7 +46,7 @@ config NRF_STORE_REBOOT_TYPE_GPREGRET
bool
default y
endif
endif # SOC_SERIES_NRF52X
menu "HID"
@@ -81,14 +81,11 @@ if ZMK_HID_REPORT_TYPE_HKRO
config ZMK_HID_KEYBOARD_REPORT_SIZE
int "# Keyboard Keys Reportable"
default 6
endif
endif # ZMK_HID_REPORT_TYPE_HKRO
config ZMK_HID_CONSUMER_REPORT_SIZE
int "# Consumer Keys Reportable"
default 6
choice ZMK_HID_CONSUMER_REPORT_USAGES
prompt "HID Report Type"
@@ -142,8 +139,7 @@ config USB_NUMOF_EP_WRITE_RETRIES
config USB_HID_POLL_INTERVAL_MS
default 1
#ZMK_USB
endif
endif # ZMK_USB
menuconfig ZMK_BLE
bool "BLE (HID over GATT)"
@@ -163,17 +159,14 @@ if ZMK_BLE
config ZMK_BLE_EXPERIMENTAL_CONN
bool "Experimental BLE connection changes"
help
Enables a combination of settings that are planned to be default in future versions of ZMK
to improve connection stability. This includes changes to timing on BLE pairing initiation,
restores use of the updated/new LLCP implementation, and disables 2M PHY support.
Enables settings that are planned to be default in future versions of ZMK
to improve connection stability.
config ZMK_BLE_EXPERIMENTAL_SEC
bool "Experimental BLE security changes"
imply BT_SMP_ALLOW_UNAUTH_OVERWRITE
help
Enables a combination of settings that are planned to be officially supported in the future.
This includes enabling BT Secure Connection passkey entry, and allows overwrite of keys from
previously paired hosts.
Enables security settings that are planned to be officially supported in the future.
config ZMK_BLE_EXPERIMENTAL_FEATURES
bool "Experimental BLE connection and security settings/features"
@@ -245,19 +238,20 @@ config BT_PERIPHERAL_PREF_LATENCY
config BT_PERIPHERAL_PREF_TIMEOUT
default 400
#ZMK_BLE
endif
# The device name should be 16 characters or less so it fits within the
# advertising data.
config BT_DEVICE_NAME_MAX
default 16
#Output Types
endmenu
endif # ZMK_BLE
# HID
endmenu
endmenu # Output Types
endmenu # HID
rsource "src/split/Kconfig"
#Basic Keyboard Setup
endmenu
endmenu # Basic Keyboard Setup
menu "Keymaps"
@@ -275,7 +269,7 @@ config ZMK_KEYMAP_LAYER_NAME_MAX_LEN
int "Max Layer Name Length"
default 20
endif
endif # ZMK_KEYMAP_SETTINGS_STORAGE
endmenu # Keymaps
@@ -292,67 +286,51 @@ menuconfig ZMK_RGB_UNDERGLOW
if ZMK_RGB_UNDERGLOW
# This default value cuts down on tons of excess .conf files, if you're using GPIO, manually disable this
config SPI
default y
config ZMK_RGB_UNDERGLOW_EXT_POWER
bool "RGB underglow toggling also controls external power"
default y
config ZMK_RGB_UNDERGLOW_BRT_MIN
int "RGB underglow minimum brightness in percent"
range 0 100
default 0
config ZMK_RGB_UNDERGLOW_BRT_MAX
int "RGB underglow maximum brightness in percent"
range ZMK_RGB_UNDERGLOW_BRT_MIN 100
default 100
config ZMK_RGB_UNDERGLOW_HUE_STEP
int "RGB underglow hue step in degrees"
range 0 359
default 10
config ZMK_RGB_UNDERGLOW_SAT_STEP
int "RGB underglow saturation step in percent"
range 0 100
default 10
config ZMK_RGB_UNDERGLOW_BRT_STEP
int "RGB underglow brightness step in percent"
range 0 100
default 10
config ZMK_RGB_UNDERGLOW_HUE_START
int "RGB underglow start hue value in degrees"
range 0 359
default 0
config ZMK_RGB_UNDERGLOW_SAT_START
int "RGB underglow start saturations value in percent"
range 0 100
default 100
config ZMK_RGB_UNDERGLOW_BRT_START
int "RGB underglow start brightness value in percent"
range ZMK_RGB_UNDERGLOW_BRT_MIN ZMK_RGB_UNDERGLOW_BRT_MAX
default ZMK_RGB_UNDERGLOW_BRT_MAX
config ZMK_RGB_UNDERGLOW_SPD_START
int "RGB underglow start animation speed value"
range 1 5
default 3
config ZMK_RGB_UNDERGLOW_EFF_START
int "RGB underglow start effect int value related to the effect enum list"
range 0 3
default 0
config ZMK_RGB_UNDERGLOW_ON_START
bool "RGB underglow starts on by default"
default y
config ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE
bool "Turn off RGB underglow when keyboard goes into idle state"
@@ -361,8 +339,7 @@ config ZMK_RGB_UNDERGLOW_AUTO_OFF_USB
bool "Turn off RGB underglow when USB is disconnected"
depends on USB_DEVICE_STACK
#ZMK_RGB_UNDERGLOW
endif
endif # ZMK_RGB_UNDERGLOW
menuconfig ZMK_BACKLIGHT
bool "LED backlight"
@@ -373,16 +350,13 @@ if ZMK_BACKLIGHT
config ZMK_BACKLIGHT_BRT_STEP
int "Brightness step in percent"
range 1 100
default 20
config ZMK_BACKLIGHT_BRT_START
int "Default brightness in percent"
range 1 100
default 40
config ZMK_BACKLIGHT_ON_START
bool "Default backlight state"
default y
config ZMK_BACKLIGHT_AUTO_OFF_IDLE
bool "Turn off backlight when keyboard goes into idle state"
@@ -390,19 +364,11 @@ config ZMK_BACKLIGHT_AUTO_OFF_IDLE
config ZMK_BACKLIGHT_AUTO_OFF_USB
bool "Turn off backlight when USB is disconnected"
#ZMK_BACKLIGHT
endif
endif # ZMK_BACKLIGHT
#Display/LED Options
endmenu
endmenu # Display/LED Options
menu "Mouse Options"
config ZMK_MOUSE
bool "Enable ZMK mouse emulation"
#Mouse Options
endmenu
rsource "src/pointing/Kconfig"
menu "Power Management"
@@ -424,7 +390,8 @@ config ZMK_BATTERY_REPORTING_FETCH_MODE_LITHIUM_VOLTAGE
bool "Lithium Voltage"
endchoice
endif
endif # ZMK_BATTERY_REPORTING
config ZMK_IDLE_TIMEOUT
int "Milliseconds of inactivity before entering idle state (OLED shutoff, etc)"
@@ -446,12 +413,10 @@ config ZMK_IDLE_SLEEP_TIMEOUT
int "Milliseconds of inactivity before entering deep sleep"
default 900000
#ZMK_SLEEP
endif
endif # ZMK_SLEEP
config ZMK_EXT_POWER
bool "Enable support to control external power output"
default y
config ZMK_PM
bool
@@ -525,8 +490,7 @@ config ZMK_USB_HID_INIT_PRIORITY
int "USB HID Init Priority"
default 95
#USB
endif
endif # USB
if ZMK_BLE || ZMK_SPLIT_BLE
@@ -534,11 +498,13 @@ config ZMK_BLE_INIT_PRIORITY
int "BLE Init Priority"
default 50
#ZMK_BLE || ZMK_SPLIT_BLE
endif
endif # ZMK_BLE || ZMK_SPLIT_BLE
#Initialization Priorities
endmenu
endmenu # Initialization Priorities
config ZMK_PHYSICAL_LAYOUT_KEY_ROTATION
bool "Support rotation of keys in physical layouts"
default y
menuconfig ZMK_KSCAN
bool "ZMK KScan Integration"
@@ -612,8 +578,7 @@ config USB_CDC_ACM_RINGBUF_SIZE
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
default 1000
#ZMK_USB_LOGGING
endif
endif # ZMK_USB_LOGGING
config ZMK_RTT_LOGGING
bool "Enable RTT logging to help debug"
@@ -629,8 +594,7 @@ if ZMK_RTT_LOGGING
config SEGGER_RTT_BUFFER_SIZE_UP
default 8192
#ZMK_RTT_LOGGING
endif
endif # ZMK_RTT_LOGGING
if ZMK_USB_LOGGING || ZMK_RTT_LOGGING
@@ -640,11 +604,9 @@ config LOG_BUFFER_SIZE
config LOG_PROCESS_THREAD_SLEEP_MS
default 100
#ZMK_USB_LOGGING || ZMK_RTT_LOGGING
endif
endif # ZMK_USB_LOGGING || ZMK_RTT_LOGGING
#Logging
endmenu
endmenu # Logging
if SETTINGS
@@ -660,21 +622,17 @@ config ZMK_SETTINGS_RESET_ON_START_INIT_PRIORITY
Initialization priority for the settings reset on start. Must be lower priority/
higher value than FLASH_INIT_PRIORITY if using the NVS/Flash settings backend.
endif
endif # ZMK_SETTINGS_RESET_ON_START
config ZMK_SETTINGS_SAVE_DEBOUNCE
int "Milliseconds to debounce settings saves"
default 60000
#SETTINGS
endif
endif # SETTINGS
config ZMK_BATTERY_REPORT_INTERVAL
depends on ZMK_BATTERY_REPORTING
int "Battery level report interval in seconds"
default 60
config ZMK_LOW_PRIORITY_WORK_QUEUE
bool "Work queue for low priority items"
@@ -689,13 +647,11 @@ config ZMK_LOW_PRIORITY_THREAD_PRIORITY
int "Low priority thread priority"
default 10
endif
endif # ZMK_LOW_PRIORITY_WORK_QUEUE
#Advanced
endmenu
endmenu # Advanced
#ZMK
endmenu
endmenu # ZMK
config KERNEL_BIN_NAME
default "zmk"
@@ -740,12 +696,22 @@ module = ZMK
module-str = zmk
source "subsys/logging/Kconfig.template.log_config"
# This loads ZMK's internal board and shield Kconfigs
rsource "boards/Kconfig"
rsource "boards/shields/*/Kconfig.defconfig"
rsource "boards/shields/*/Kconfig.shield"
# This loads custom shields defconfigs (from BOARD_ROOT)
# Duplicated from Kconfig.zephyr
osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig"
source "$(BOARD_DIR)/Kconfig.defconfig"
# This loads board and shield Kconfigs found under zmk-config/config/
osource "$(ZMK_CONFIG)/boards/shields/*/Kconfig.defconfig"
osource "$(ZMK_CONFIG)/boards/shields/*/Kconfig.shield"
# This loads ZMK's sensible defaults
rsource "Kconfig.defaults"
source "Kconfig.zephyr"

View File

@@ -51,13 +51,11 @@ if ZMK_BEHAVIOR_HOLD_TAP
config ZMK_BEHAVIOR_HOLD_TAP_MAX_HELD
int "Hold Tap Max Held"
default 10
help
Max number of simultaneously held hold-taps
config ZMK_BEHAVIOR_HOLD_TAP_MAX_CAPTURED_EVENTS
int "Hold Tap Max Captured Events"
default 40
help
Max number of captured system events while waiting to resolve hold taps
@@ -71,8 +69,7 @@ config ZMK_BEHAVIOR_KEY_TOGGLE
config ZMK_BEHAVIOR_MOUSE_KEY_PRESS
bool
default y
depends on DT_HAS_ZMK_BEHAVIOR_MOUSE_KEY_PRESS_ENABLED
imply ZMK_MOUSE
depends on DT_HAS_ZMK_BEHAVIOR_MOUSE_KEY_PRESS_ENABLED && ZMK_POINTING
config ZMK_BEHAVIOR_STICKY_KEY
bool
@@ -83,7 +80,6 @@ if ZMK_BEHAVIOR_STICKY_KEY
config ZMK_BEHAVIOR_STICKY_KEY_MAX_HELD
int "Sticky Key Max Held"
default 10
help
Max number of simultaneously held sticky keys
@@ -94,6 +90,26 @@ config ZMK_BEHAVIOR_SOFT_OFF
default y
depends on DT_HAS_ZMK_BEHAVIOR_SOFT_OFF_ENABLED && ZMK_PM_SOFT_OFF
config ZMK_BEHAVIOR_TAP_DANCE
bool
default y
depends on DT_HAS_ZMK_BEHAVIOR_TAP_DANCE_ENABLED
if ZMK_BEHAVIOR_TAP_DANCE
config ZMK_BEHAVIOR_TAP_DANCE_MAX_HELD
int "Tap-Dance Max Held"
help
Max number of simultaneously held taps-dances
endif
config ZMK_BEHAVIOR_INPUT_TWO_AXIS
bool
default y
depends on DT_HAS_ZMK_BEHAVIOR_INPUT_TWO_AXIS_ENABLED && ZMK_POINTING
config ZMK_BEHAVIOR_SENSOR_ROTATE_COMMON
bool

109
app/Kconfig.defaults Normal file
View File

@@ -0,0 +1,109 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT
# HID
if ZMK_HID_REPORT_TYPE_HKRO
config ZMK_HID_KEYBOARD_REPORT_SIZE
default 6
endif
config ZMK_HID_CONSUMER_REPORT_SIZE
default 6
# Behaviors
if ZMK_BEHAVIOR_HOLD_TAP
config ZMK_BEHAVIOR_HOLD_TAP_MAX_HELD
default 10
config ZMK_BEHAVIOR_HOLD_TAP_MAX_CAPTURED_EVENTS
default 40
endif
if ZMK_BEHAVIOR_STICKY_KEY
config ZMK_BEHAVIOR_STICKY_KEY_MAX_HELD
default 10
endif
if ZMK_BEHAVIOR_TAP_DANCE
config ZMK_BEHAVIOR_TAP_DANCE_MAX_HELD
default 10
endif
# Underglow
if ZMK_RGB_UNDERGLOW
# This default value cuts down on tons of excess .conf files, if you're using GPIO, manually disable this
config SPI
default y
config ZMK_RGB_UNDERGLOW_EXT_POWER
default y
config ZMK_RGB_UNDERGLOW_BRT_MIN
default 0
config ZMK_RGB_UNDERGLOW_BRT_MAX
default 100
config ZMK_RGB_UNDERGLOW_HUE_STEP
default 10
config ZMK_RGB_UNDERGLOW_SAT_STEP
default 10
config ZMK_RGB_UNDERGLOW_BRT_STEP
default 10
config ZMK_RGB_UNDERGLOW_HUE_START
default 0
config ZMK_RGB_UNDERGLOW_SAT_START
default 100
config ZMK_RGB_UNDERGLOW_BRT_START
default ZMK_RGB_UNDERGLOW_BRT_MAX
config ZMK_RGB_UNDERGLOW_SPD_START
default 3
config ZMK_RGB_UNDERGLOW_EFF_START
default 0
config ZMK_RGB_UNDERGLOW_ON_START
default y
endif # ZMK_RGB_UNDERGLOW
# Backlight
if ZMK_BACKLIGHT
config ZMK_BACKLIGHT_BRT_STEP
default 20
config ZMK_BACKLIGHT_BRT_START
default 40
config ZMK_BACKLIGHT_ON_START
default y
endif # ZMK_BACKLIGHT
# Ext_power
config ZMK_EXT_POWER
default y
# Battery
config ZMK_BATTERY_REPORT_INTERVAL
default 60
# Imports
rsource "src/split/Kconfig.defaults"

View File

@@ -3,11 +3,11 @@ VERSION_MAJOR = 0
# x-release-please-end
# x-release-please-start-minor
VERSION_MINOR = 1
VERSION_MINOR = 2
# x-release-please-end
# x-release-please-start-patch
PATCHLEVEL = 0
PATCHLEVEL = 1
# x-release-please-end
VERSION_TWEAK = 0

2
app/boards/aliases.cmake Normal file
View File

@@ -0,0 +1,2 @@
# defines board aliases for shorter names (or for renaming boards)
set(mikoto_520_BOARD_ALIAS "mikoto")

View File

@@ -2,17 +2,17 @@ config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on (BOARD_MIKOTO_520)
depends on (BOARD_MIKOTO)
config BOARD_ENABLE_DCDC_HV
bool "High voltage DCDC converter"
select SOC_DCDC_NRF52X_HV
default y
depends on (BOARD_MIKOTO_520)
depends on (BOARD_MIKOTO)
choice BOARD_MIKOTO_CHARGER_CURRENT
prompt "Charge current to supply to attached batteries"
depends on (BOARD_MIKOTO_520)
depends on (BOARD_MIKOTO)
config BOARD_MIKOTO_CHARGER_CURRENT_40MA
bool "40mA charge current, for battery capacity 40mAh or higher"

View File

@@ -3,6 +3,6 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
config BOARD_MIKOTO_520
bool "mikoto_520"
config BOARD_MIKOTO
bool "mikoto"
depends on SOC_NRF52840_QIAA

View File

@@ -3,7 +3,7 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
if BOARD_MIKOTO_520
if BOARD_MIKOTO
config BOARD
default "mikoto"
@@ -25,4 +25,4 @@ choice BOARD_MIKOTO_CHARGER_CURRENT
default BOARD_MIKOTO_CHARGER_CURRENT_100MA
endchoice
endif # BOARD_MIKOTO_520
endif # BOARD_MIKOTO

View File

@@ -0,0 +1,59 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/ {
pro_micro: connector {
compatible = "arduino-pro-micro";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map
= <0 0 &gpio0 4 0> /* D0 */
, <1 0 &gpio0 8 0> /* D1 */
, <2 0 &gpio0 17 0> /* D2 */
, <3 0 &gpio0 20 0> /* D3 */
, <4 0 &gpio0 22 0> /* D4/A6 */
, <5 0 &gpio0 24 0> /* D5 */
, <6 0 &gpio1 8 0> /* D6/A7 */
, <7 0 &gpio1 2 0> /* D7 */
, <8 0 &gpio1 4 0> /* D8/A8 */
, <9 0 &gpio1 6 0> /* D9/A9 */
, <10 0 &gpio0 9 0> /* D10/A10 */
, <16 0 &gpio0 10 0> /* D16 */
, <14 0 &gpio1 13 0> /* D14 */
, <15 0 &gpio0 2 0> /* D15 */
, <18 0 &gpio0 29 0> /* D18/A0 */
, <19 0 &gpio0 31 0> /* D19/A1 */
, <20 0 &gpio0 25 0> /* D20/A2 */
, <21 0 &gpio0 11 0> /* D21/A3 */
;
};
pro_micro_a: connector_a {
compatible = "arduino-pro-micro";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map
= <0 0 &gpio0 29 0> /* D18/A0 */
, <1 0 &gpio0 31 0> /* D19/A1 */
, <2 0 &gpio0 25 0> /* D20/A2 */
, <3 0 &gpio0 11 0> /* D21/A3 */
, <6 0 &gpio0 22 0> /* D4/A6 */
, <7 0 &gpio1 8 0> /* D6/A7 */
, <8 0 &gpio1 4 0> /* D8/A8 */
, <9 0 &gpio1 6 0> /* D9/A9 */
, <10 0 &gpio0 9 0> /* D10/A10 */
;
};
};
pro_micro_d: &pro_micro {};
pro_micro_i2c: &i2c0 {};
pro_micro_spi: &spi0 {};
pro_micro_serial: &uart0 {};

View File

@@ -6,8 +6,6 @@
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "arduino_pro_micro_pins.dtsi"
#include "mikoto_520-pinctrl.dtsi"
/ {
model = "mikoto";

View File

@@ -1,5 +1,5 @@
identifier: mikoto_520
name: mikoto_520
identifier: mikoto
name: mikoto
type: mcu
arch: arm
toolchain:

View File

@@ -1,6 +1,6 @@
file_format: "1"
id: mikoto_520
name: Mikoto 5.20
id: mikoto
name: Mikoto
type: board
arch: arm
outputs:
@@ -8,3 +8,9 @@ outputs:
- ble
url: https://github.com/zhiayang/mikoto
exposes: [pro_micro]
revisions:
- "5.20"
- "6.1"
- "6.3"
- "7.2"
default_revision: "5.20"

View File

@@ -0,0 +1,8 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include "mikoto-pinctrl.dtsi"
#include "arduino_pro_micro_pins_v5.dtsi"

View File

@@ -0,0 +1,8 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include "mikoto-pinctrl.dtsi"
#include "arduino_pro_micro_pins_v6.dtsi"

View File

@@ -0,0 +1,2 @@
CONFIG_I2C=y
CONFIG_ZMK_MAX17048=y

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include "mikoto-pinctrl.dtsi"
#include "arduino_pro_micro_pins_v6.dtsi"
&pinctrl {
i2c1_default: i2c1_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 23)>,
<NRF_PSEL(TWIM_SCL, 0, 19)>;
bias-pull-up;
};
};
i2c1_sleep: i2c1_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 23)>,
<NRF_PSEL(TWIM_SCL, 0, 19)>;
low-power-enable;
bias-pull-up;
};
};
};
&i2c1 {
status = "okay";
compatible = "nordic,nrf-twi";
pinctrl-0 = <&i2c1_default>;
pinctrl-1 = <&i2c1_sleep>;
pinctrl-names = "default", "sleep";
builtin_fuel_gauge: max17048@36 {
compatible = "zmk,maxim-max17048";
status = "okay";
reg = <0x36>;
};
};
/ {
chosen {
zmk,battery = &builtin_fuel_gauge;
};
};

View File

@@ -2,11 +2,10 @@
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_MIKOTO_520=y
CONFIG_BOARD_MIKOTO=y
# Enable MPU
CONFIG_ARM_MPU=y
CONFIG_PINCTRL=y
# enable GPIO

View File

@@ -13,7 +13,7 @@
static int pinmux_mikoto_init(void) {
#if CONFIG_BOARD_MIKOTO_520
#if CONFIG_BOARD_MIKOTO
const struct device *p0 = DEVICE_DT_GET(DT_NODELABEL(gpio0));
const struct device *p1 = DEVICE_DT_GET(DT_NODELABEL(gpio1));
#if CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_40MA

View File

@@ -0,0 +1,7 @@
board_check_revision(FORMAT MAJOR.MINOR.PATCH
DEFAULT_REVISION 5.20.0
VALID_REVISIONS
5.20.0 # first public release
6.1.0 6.3.0 # incompatible pinout change from v5+
7.2.0 # addition of MAX17048; compatible pinout with v6+
)

View File

@@ -0,0 +1,71 @@
#include <physical_layouts.dtsi>
/ {
physical_layout0: physical_layout_0 {
compatible = "zmk,physical-layout";
display-name = "Default";
keys // w h x y rot rx ry
= <&key_physical_attrs 100 100 0 50 0 0 0>
, <&key_physical_attrs 100 100 100 37 0 0 0>
, <&key_physical_attrs 100 100 200 12 0 0 0>
, <&key_physical_attrs 100 100 300 0 0 0 0>
, <&key_physical_attrs 100 100 400 12 0 0 0>
, <&key_physical_attrs 100 100 500 25 0 0 0>
, <&key_physical_attrs 100 100 1050 25 0 0 0>
, <&key_physical_attrs 100 100 1150 12 0 0 0>
, <&key_physical_attrs 100 100 1250 0 0 0 0>
, <&key_physical_attrs 100 100 1350 12 0 0 0>
, <&key_physical_attrs 100 100 1450 37 0 0 0>
, <&key_physical_attrs 100 100 1550 50 0 0 0>
, <&key_physical_attrs 100 100 0 150 0 0 0>
, <&key_physical_attrs 100 100 100 137 0 0 0>
, <&key_physical_attrs 100 100 200 112 0 0 0>
, <&key_physical_attrs 100 100 300 100 0 0 0>
, <&key_physical_attrs 100 100 400 112 0 0 0>
, <&key_physical_attrs 100 100 500 125 0 0 0>
, <&key_physical_attrs 100 100 1050 125 0 0 0>
, <&key_physical_attrs 100 100 1150 112 0 0 0>
, <&key_physical_attrs 100 100 1250 100 0 0 0>
, <&key_physical_attrs 100 100 1350 112 0 0 0>
, <&key_physical_attrs 100 100 1450 137 0 0 0>
, <&key_physical_attrs 100 100 1550 150 0 0 0>
, <&key_physical_attrs 100 100 0 250 0 0 0>
, <&key_physical_attrs 100 100 100 237 0 0 0>
, <&key_physical_attrs 100 100 200 212 0 0 0>
, <&key_physical_attrs 100 100 300 200 0 0 0>
, <&key_physical_attrs 100 100 400 212 0 0 0>
, <&key_physical_attrs 100 100 500 225 0 0 0>
, <&key_physical_attrs 100 100 625 75 0 0 0>
, <&key_physical_attrs 100 100 925 75 0 0 0>
, <&key_physical_attrs 100 100 1050 225 0 0 0>
, <&key_physical_attrs 100 100 1150 212 0 0 0>
, <&key_physical_attrs 100 100 1250 200 0 0 0>
, <&key_physical_attrs 100 100 1350 212 0 0 0>
, <&key_physical_attrs 100 100 1450 237 0 0 0>
, <&key_physical_attrs 100 100 1550 250 0 0 0>
, <&key_physical_attrs 100 100 0 350 0 0 0>
, <&key_physical_attrs 100 100 100 337 0 0 0>
, <&key_physical_attrs 100 100 200 312 0 0 0>
, <&key_physical_attrs 100 100 300 300 0 0 0>
, <&key_physical_attrs 100 100 400 312 0 0 0>
, <&key_physical_attrs 100 100 500 325 0 0 0>
, <&key_physical_attrs 100 100 625 275 0 0 0>
, <&key_physical_attrs 100 100 925 275 0 0 0>
, <&key_physical_attrs 100 100 1050 325 0 0 0>
, <&key_physical_attrs 100 100 1150 312 0 0 0>
, <&key_physical_attrs 100 100 1250 300 0 0 0>
, <&key_physical_attrs 100 100 1350 312 0 0 0>
, <&key_physical_attrs 100 100 1450 337 0 0 0>
, <&key_physical_attrs 100 100 1550 350 0 0 0>
, <&key_physical_attrs 100 100 250 412 0 0 0>
, <&key_physical_attrs 100 100 350 415 0 0 0>
, <&key_physical_attrs 100 100 450 425 0 0 0>
, <&key_physical_attrs 100 150 575 400 3000 625 475>
, <&key_physical_attrs 100 150 975 400 (-3000) 1025 475>
, <&key_physical_attrs 100 100 1100 425 0 0 0>
, <&key_physical_attrs 100 100 1200 415 0 0 0>
, <&key_physical_attrs 100 100 1300 415 0 0 0>
;
};
};

View File

@@ -6,17 +6,19 @@
#include <dt-bindings/zmk/matrix_transform.h>
#include "lotus58-layouts.dtsi"
/ {
chosen {
zephyr,display = &oled;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
zmk,physical-layout = &physical_layout0;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <16>;
rows = <4>;
rows = <5>;
// | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 |
// | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 |
// | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 | SW30 | | SW30 | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 |
@@ -68,6 +70,10 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7
};
};
&physical_layout0 {
transform = <&default_transform>;
};
&pro_micro_i2c {
status = "okay";

View File

@@ -9,6 +9,7 @@ features:
- keys
- display
- encoder
- studio
siblings:
- lotus58_left
- lotus58_right

View File

@@ -24,7 +24,7 @@ include:
nickname: "display"
- board: nice_nano_v2
shield: kyria_left
cmake-args: "-DCONFIG_ZMK_MOUSE=y"
cmake-args: "-DCONFIG_ZMK_POINTING=y"
nickname: "mouse"
- board: sparkfun_pro_micro_rp2040
shield: reviung41

View File

@@ -1,3 +1,9 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors/key_press.dtsi>
#include <behaviors/key_toggle.dtsi>
#include <behaviors/transparent.dtsi>
@@ -19,6 +25,6 @@
#include <behaviors/key_repeat.dtsi>
#include <behaviors/backlight.dtsi>
#include <behaviors/macros.dtsi>
#include <behaviors/mouse_key_press.dtsi>
#include <behaviors/soft_off.dtsi>
#include <behaviors/studio_unlock.dtsi>
#include <behaviors/mouse_keys.dtsi>

View File

@@ -16,4 +16,9 @@
#binding-cells = <1>;
};
};
mkp_input_listener: mkp_input_listener {
compatible = "zmk,input-listener";
device = <&mkp>;
};
};

View File

@@ -0,0 +1,9 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include "mouse_key_press.dtsi"
#include "mouse_move.dtsi"
#include "mouse_scroll.dtsi"

View File

@@ -0,0 +1,25 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
behaviors {
/omit-if-no-ref/ mmv: mouse_move {
compatible = "zmk,behavior-input-two-axis";
#binding-cells = <1>;
x-input-code = <INPUT_REL_X>;
y-input-code = <INPUT_REL_Y>;
time-to-max-speed-ms = <300>;
acceleration-exponent = <1>;
};
};
mmv_input_listener: mmv_input_listener {
compatible = "zmk,input-listener";
device = <&mmv>;
};
};

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
behaviors {
/omit-if-no-ref/ msc: mouse_scroll {
compatible = "zmk,behavior-input-two-axis";
#binding-cells = <1>;
x-input-code = <INPUT_REL_HWHEEL>;
y-input-code = <INPUT_REL_WHEEL>;
time-to-max-speed-ms = <300>;
acceleration-exponent = <0>;
};
};
msc_input_listener: msc_input_listener {
compatible = "zmk,input-listener";
device = <&msc>;
};
};

View File

@@ -0,0 +1,28 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT
description: Two axis input behavior
compatible: "zmk,behavior-input-two-axis"
include: one_param.yaml
properties:
x-input-code:
type: int
required: true
y-input-code:
type: int
required: true
trigger-period-ms:
type: int
default: 16
description: The time (in ms) between generated inputs when an input has non-zero speed.
delay-ms:
type: int
time-to-max-speed-ms:
type: int
required: true
acceleration-exponent:
type: int
default: 1

View File

@@ -6,3 +6,13 @@ description: Key toggle behavior
compatible: "zmk,behavior-key-toggle"
include: one_param.yaml
properties:
toggle-mode:
type: string
required: false
default: "flip"
enum:
- "on"
- "off"
- "flip"

View File

@@ -6,3 +6,13 @@ description: Toggle Layer
compatible: "zmk,behavior-toggle-layer"
include: one_param.yaml
properties:
toggle-mode:
type: string
required: false
default: "flip"
enum:
- "on"
- "off"
- "flip"

View File

@@ -0,0 +1,6 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT
properties:
track-remainders:
type: boolean

View File

@@ -0,0 +1,13 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT
include: ip_common.yaml
properties:
"#input-processor-cells":
type: int
required: true
const: 1
input-processor-cells:
- param1

View File

@@ -0,0 +1,14 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT
include: ip_common.yaml
properties:
"#input-processor-cells":
type: int
required: true
const: 2
input-processor-cells:
- param1
- param2

View File

@@ -0,0 +1,10 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT
include: ip_common.yaml
properties:
"#input-processor-cells":
type: int
required: true
const: 0

View File

@@ -0,0 +1,18 @@
# Copyright (c) 2024, The ZMK Contributors
# SPDX-License-Identifier: MIT
description: Input Processor for invoking behaviors on certain events
compatible: "zmk,input-processor-behaviors"
include: ip_zero_param.yaml
properties:
type:
type: int
codes:
type: array
required: true
bindings:
type: phandle-array
required: true

View File

@@ -0,0 +1,16 @@
# Copyright (c) 2024, The ZMK Contributors
# SPDX-License-Identifier: MIT
description: Input Processor for remapping certain input codes to other codes
compatible: "zmk,input-processor-code-mapper"
include: ip_zero_param.yaml
properties:
type:
type: int
required: true
map:
type: array
required: true

View File

@@ -0,0 +1,16 @@
# Copyright (c) 2024, The ZMK Contributors
# SPDX-License-Identifier: MIT
description: Input Processor for scaling values
compatible: "zmk,input-processor-scaler"
include: ip_two_param.yaml
properties:
type:
type: int
required: true
codes:
type: array
required: true

View File

@@ -0,0 +1,21 @@
# Copyright (c) 2024, The ZMK Contributors
# SPDX-License-Identifier: MIT
description: Input Processor for temporarily enabling a layer after input events
compatible: "zmk,input-processor-temp-layer"
include: ip_two_param.yaml
properties:
require-prior-idle-ms:
type: int
required: false
default: 0
description: Time in milliseconds that must pass after the last keystroke before the layer can be toggled
excluded-positions:
type: array
required: false
default: []
description: Array of key positions that will NOT trigger layer deactivation when pressed

View File

@@ -0,0 +1,18 @@
# Copyright (c) 2024, The ZMK Contributors
# SPDX-License-Identifier: MIT
description: Input Processor for transforming values in various ways
compatible: "zmk,input-processor-transform"
include: ip_one_param.yaml
properties:
type:
type: int
x-codes:
type: array
required: true
y-codes:
type: array
required: true

View File

@@ -0,0 +1,26 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT
description: |
Listener to subscribe to input events and send HID updates after processing
compatible: "zmk,input-listener"
properties:
device:
type: phandle
required: true
input-processors:
type: phandle-array
child-binding:
description: "Listener overrides for certain layers"
properties:
layers:
type: array
required: true
process-next:
type: boolean
input-processors:
type: phandle-array

View File

@@ -0,0 +1,18 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT
include: [base.yaml]
compatible: "zmk,input-split"
description: Device to wire up an input device for split use.
properties:
reg:
required: true
device:
type: phandle
input-processors:
type: phandle-array

View File

@@ -3,6 +3,8 @@ description: |
compatible: "zmk,kscan-composite"
include: kscan.yaml
properties:
label:
type: string

View File

@@ -0,0 +1,11 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <input/processors/scaler.dtsi>
#include <input/processors/code_mapper.dtsi>
#include <input/processors/transform.dtsi>
#include <input/processors/temp_layer.dtsi>
#include <input/processors/behaviors.dtsi>

View File

@@ -0,0 +1,16 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
zip_button_behaviors: zip_button_behaviors {
compatible = "zmk,input-processor-behaviors";
#input-processor-cells = <0>;
codes = <INPUT_BTN_0 INPUT_BTN_1 INPUT_BTN_2>;
bindings = <&none &none &none>;
};
};

View File

@@ -0,0 +1,29 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
/omit-if-no-ref/ zip_xy_swap_mapper: zip_xy_swap_mapper {
compatible = "zmk,input-processor-code-mapper";
#input-processor-cells = <0>;
type = <INPUT_EV_REL>;
map
= <INPUT_REL_Y INPUT_REL_X>
, <INPUT_REL_X INPUT_REL_Y>
;
};
/omit-if-no-ref/ zip_xy_to_scroll_mapper: zip_xy_to_scroll_mapper {
compatible = "zmk,input-processor-code-mapper";
#input-processor-cells = <0>;
type = <INPUT_EV_REL>;
map
= <INPUT_REL_Y INPUT_REL_WHEEL>
, <INPUT_REL_X INPUT_REL_HWHEEL>
;
};
};

View File

@@ -0,0 +1,41 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
/omit-if-no-ref/ zip_x_scaler: zip_x_scaler {
compatible = "zmk,input-processor-scaler";
#input-processor-cells = <2>;
type = <INPUT_EV_REL>;
codes = <INPUT_REL_X>;
track-remainders;
};
/omit-if-no-ref/ zip_y_scaler: zip_y_scaler {
compatible = "zmk,input-processor-scaler";
#input-processor-cells = <2>;
type = <INPUT_EV_REL>;
codes = <INPUT_REL_Y>;
track-remainders;
};
/omit-if-no-ref/ zip_xy_scaler: zip_xy_scaler {
compatible = "zmk,input-processor-scaler";
#input-processor-cells = <2>;
type = <INPUT_EV_REL>;
codes = <INPUT_REL_X INPUT_REL_Y>;
track-remainders;
};
/omit-if-no-ref/ zip_scroll_scaler: zip_scroll_scaler {
compatible = "zmk,input-processor-scaler";
#input-processor-cells = <2>;
type = <INPUT_EV_REL>;
codes = <INPUT_REL_WHEEL INPUT_REL_HWHEEL>;
track-remainders;
};
};

View File

@@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
/omit-if-no-ref/ zip_temp_layer: zip_temp_layer {
compatible = "zmk,input-processor-temp-layer";
#input-processor-cells = <2>;
};
};

View File

@@ -0,0 +1,25 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
/omit-if-no-ref/ zip_xy_transform: zip_xy_transform {
compatible = "zmk,input-processor-transform";
#input-processor-cells = <1>;
type = <INPUT_EV_REL>;
y-codes = <INPUT_REL_Y>;
x-codes = <INPUT_REL_X>;
};
/omit-if-no-ref/ zip_scroll_transform: zip_scroll_transform {
compatible = "zmk,input-processor-transform";
#input-processor-cells = <1>;
type = <INPUT_EV_REL>;
y-codes = <INPUT_REL_WHEEL>;
x-codes = <INPUT_REL_HWHEEL>;
};
};

View File

@@ -0,0 +1,64 @@
#include <layouts/common/ortho_4x10/position_map.dtsi>
#include <physical_layouts.dtsi>
/ {
layout_ortho_4x10_1x2u: layout_ortho_4x10_1x2u {
compatible = "zmk,physical-layout";
display-name = "1x2U Space";
keys // w h x y rot rx ry
= <&key_physical_attrs 100 100 0 0 0 0 0>
, <&key_physical_attrs 100 100 100 0 0 0 0>
, <&key_physical_attrs 100 100 200 0 0 0 0>
, <&key_physical_attrs 100 100 300 0 0 0 0>
, <&key_physical_attrs 100 100 400 0 0 0 0>
, <&key_physical_attrs 100 100 500 0 0 0 0>
, <&key_physical_attrs 100 100 600 0 0 0 0>
, <&key_physical_attrs 100 100 700 0 0 0 0>
, <&key_physical_attrs 100 100 800 0 0 0 0>
, <&key_physical_attrs 100 100 900 0 0 0 0>
, <&key_physical_attrs 100 100 0 100 0 0 0>
, <&key_physical_attrs 100 100 100 100 0 0 0>
, <&key_physical_attrs 100 100 200 100 0 0 0>
, <&key_physical_attrs 100 100 300 100 0 0 0>
, <&key_physical_attrs 100 100 400 100 0 0 0>
, <&key_physical_attrs 100 100 500 100 0 0 0>
, <&key_physical_attrs 100 100 600 100 0 0 0>
, <&key_physical_attrs 100 100 700 100 0 0 0>
, <&key_physical_attrs 100 100 800 100 0 0 0>
, <&key_physical_attrs 100 100 900 100 0 0 0>
, <&key_physical_attrs 100 100 0 200 0 0 0>
, <&key_physical_attrs 100 100 100 200 0 0 0>
, <&key_physical_attrs 100 100 200 200 0 0 0>
, <&key_physical_attrs 100 100 300 200 0 0 0>
, <&key_physical_attrs 100 100 400 200 0 0 0>
, <&key_physical_attrs 100 100 500 200 0 0 0>
, <&key_physical_attrs 100 100 600 200 0 0 0>
, <&key_physical_attrs 100 100 700 200 0 0 0>
, <&key_physical_attrs 100 100 800 200 0 0 0>
, <&key_physical_attrs 100 100 900 200 0 0 0>
, <&key_physical_attrs 100 100 0 300 0 0 0>
, <&key_physical_attrs 100 100 100 300 0 0 0>
, <&key_physical_attrs 100 100 200 300 0 0 0>
, <&key_physical_attrs 100 100 300 300 0 0 0>
, <&key_physical_attrs 200 100 400 300 0 0 0>
, <&key_physical_attrs 100 100 600 300 0 0 0>
, <&key_physical_attrs 100 100 700 300 0 0 0>
, <&key_physical_attrs 100 100 800 300 0 0 0>
, <&key_physical_attrs 100 100 900 300 0 0 0>
;
};
};
&layouts_common_ortho_4x10_position_map {
layout_ortho_4x10_1x2u_posmap: layout_ortho_4x10_1x2u {
physical-layout = <&layout_ortho_4x10_1x2u>;
positions
= < 0 1 2 3 4 5 6 7 8 9>
, <10 11 12 13 14 15 16 17 18 19>
, <20 21 22 23 24 25 26 27 28 29>
, <30 31 32 33 34 39 35 36 37 38>
;
};
};

View File

@@ -0,0 +1,64 @@
#include <layouts/common/ortho_4x10/position_map.dtsi>
#include <physical_layouts.dtsi>
/ {
layout_ortho_4x10_all1u: layout_ortho_4x10_all1u {
compatible = "zmk,physical-layout";
display-name = "All 1U/Grid";
keys // w h x y rot rx ry
= <&key_physical_attrs 100 100 0 0 0 0 0>
, <&key_physical_attrs 100 100 100 0 0 0 0>
, <&key_physical_attrs 100 100 200 0 0 0 0>
, <&key_physical_attrs 100 100 300 0 0 0 0>
, <&key_physical_attrs 100 100 400 0 0 0 0>
, <&key_physical_attrs 100 100 500 0 0 0 0>
, <&key_physical_attrs 100 100 600 0 0 0 0>
, <&key_physical_attrs 100 100 700 0 0 0 0>
, <&key_physical_attrs 100 100 800 0 0 0 0>
, <&key_physical_attrs 100 100 900 0 0 0 0>
, <&key_physical_attrs 100 100 0 100 0 0 0>
, <&key_physical_attrs 100 100 100 100 0 0 0>
, <&key_physical_attrs 100 100 200 100 0 0 0>
, <&key_physical_attrs 100 100 300 100 0 0 0>
, <&key_physical_attrs 100 100 400 100 0 0 0>
, <&key_physical_attrs 100 100 500 100 0 0 0>
, <&key_physical_attrs 100 100 600 100 0 0 0>
, <&key_physical_attrs 100 100 700 100 0 0 0>
, <&key_physical_attrs 100 100 800 100 0 0 0>
, <&key_physical_attrs 100 100 900 100 0 0 0>
, <&key_physical_attrs 100 100 0 200 0 0 0>
, <&key_physical_attrs 100 100 100 200 0 0 0>
, <&key_physical_attrs 100 100 200 200 0 0 0>
, <&key_physical_attrs 100 100 300 200 0 0 0>
, <&key_physical_attrs 100 100 400 200 0 0 0>
, <&key_physical_attrs 100 100 500 200 0 0 0>
, <&key_physical_attrs 100 100 600 200 0 0 0>
, <&key_physical_attrs 100 100 700 200 0 0 0>
, <&key_physical_attrs 100 100 800 200 0 0 0>
, <&key_physical_attrs 100 100 900 200 0 0 0>
, <&key_physical_attrs 100 100 0 300 0 0 0>
, <&key_physical_attrs 100 100 100 300 0 0 0>
, <&key_physical_attrs 100 100 200 300 0 0 0>
, <&key_physical_attrs 100 100 300 300 0 0 0>
, <&key_physical_attrs 100 100 400 300 0 0 0>
, <&key_physical_attrs 100 100 500 300 0 0 0>
, <&key_physical_attrs 100 100 600 300 0 0 0>
, <&key_physical_attrs 100 100 700 300 0 0 0>
, <&key_physical_attrs 100 100 800 300 0 0 0>
, <&key_physical_attrs 100 100 900 300 0 0 0>
;
};
};
&layouts_common_ortho_4x10_position_map {
layout_ortho_4x10_all1u_posmap: layout_ortho_4x10_all1u {
physical-layout = <&layout_ortho_4x10_all1u>;
positions
= < 0 1 2 3 4 5 6 7 8 9>
, <10 11 12 13 14 15 16 17 18 19>
, <20 21 22 23 24 25 26 27 28 29>
, <30 31 32 33 34 35 36 37 38 39>
;
};
};

View File

@@ -0,0 +1,7 @@
/ {
layouts_common_ortho_4x10_position_map: layouts_common_ortho_4x10_position_map {
compatible = "zmk,physical-layout-position-map";
complete;
};
};

View File

@@ -0,0 +1,71 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <zephyr/types.h>
#include <stddef.h>
#include <zephyr/sys/util.h>
#include <string.h>
#include <zephyr/device.h>
#include <zephyr/input/input.h>
#define ZMK_INPUT_PROC_CONTINUE 0
#define ZMK_INPUT_PROC_STOP 1
struct zmk_input_processor_entry {
const struct device *dev;
uint32_t param1;
uint32_t param2;
bool track_remainders;
};
#define ZMK_INPUT_PROCESSOR_ENTRY_AT_IDX(idx, n) \
{ \
.dev = DEVICE_DT_GET(DT_PHANDLE_BY_IDX(n, input_processors, idx)), \
.param1 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(n, input_processors, idx, param1), (0), \
(DT_PHA_BY_IDX(n, input_processors, idx, param1))), \
.param2 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(n, input_processors, idx, param2), (0), \
(DT_PHA_BY_IDX(n, input_processors, idx, param2))), \
.track_remainders = \
COND_CODE_1(DT_PROP(DT_PHANDLE_BY_IDX(n, input_processors, idx), track_remainders), \
(true), (false)), \
}
struct zmk_input_processor_state {
uint8_t input_device_index;
int16_t *remainder;
};
// TODO: Need the ability to store remainders? Some data passed in?
typedef int (*zmk_input_processor_handle_event_callback_t)(const struct device *dev,
struct input_event *event,
uint32_t param1, uint32_t param2,
struct zmk_input_processor_state *state);
__subsystem struct zmk_input_processor_driver_api {
zmk_input_processor_handle_event_callback_t handle_event;
};
__syscall int zmk_input_processor_handle_event(const struct device *dev, struct input_event *event,
uint32_t param1, uint32_t param2,
struct zmk_input_processor_state *state);
static inline int z_impl_zmk_input_processor_handle_event(const struct device *dev,
struct input_event *event,
uint32_t param1, uint32_t param2,
struct zmk_input_processor_state *state) {
const struct zmk_input_processor_driver_api *api =
(const struct zmk_input_processor_driver_api *)dev->api;
if (api->handle_event == NULL) {
return -ENOTSUP;
}
return api->handle_event(dev, event, param1, param2, state);
}
#include <syscalls/input_processor.h>

View File

@@ -0,0 +1,12 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#define ZMK_INPUT_EXPLICIT_CODE(type, code) ((type << 16) & code)
#define ZMK_INPUT_EXPLICIT_CODE_TYPE(val) ((val >> 16) & 0xFF)
#define ZMK_INPUT_EXPLICIT_CODE_CODE(val) (val & 0xFFFF)

View File

@@ -0,0 +1,11 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <zephyr/dt-bindings/dt-util.h>
#define INPUT_TRANSFORM_XY_SWAP BIT(0)
#define INPUT_TRANSFORM_X_INVERT BIT(1)
#define INPUT_TRANSFORM_Y_INVERT BIT(2)

View File

@@ -1,24 +1,9 @@
/*
* Copyright (c) 2020 The ZMK Contributors
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <zephyr/dt-bindings/dt-util.h>
/* Mouse press behavior */
/* Left click */
#define MB1 BIT(0)
#define LCLK (MB1)
/* Right click */
#define MB2 BIT(1)
#define RCLK (MB2)
/* Middle click */
#define MB3 BIT(2)
#define MCLK (MB3)
#define MB4 BIT(3)
#define MB5 BIT(4)
#include "pointing.h"

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <zephyr/dt-bindings/dt-util.h>
/* Mouse press behavior */
/* Left click */
#define MB1 BIT(0)
#define LCLK (MB1)
/* Right click */
#define MB2 BIT(1)
#define RCLK (MB2)
/* Middle click */
#define MB3 BIT(2)
#define MCLK (MB3)
#define MB4 BIT(3)
#define MB5 BIT(4)
#ifndef ZMK_POINTING_DEFAULT_MOVE_VAL
#define ZMK_POINTING_DEFAULT_MOVE_VAL 600
#endif
#ifndef ZMK_POINTING_DEFAULT_SCRL_VAL
#define ZMK_POINTING_DEFAULT_SCRL_VAL 10
#endif
/* Mouse move behavior */
#define MOVE_Y(vert) ((vert) & 0xFFFF)
#define MOVE_Y_DECODE(encoded) (int16_t)((encoded) & 0x0000FFFF)
#define MOVE_X(hor) (((hor) & 0xFFFF) << 16)
#define MOVE_X_DECODE(encoded) (int16_t)(((encoded) & 0xFFFF0000) >> 16)
#define MOVE(hor, vert) (MOVE_X(hor) + MOVE_Y(vert))
#define MOVE_UP MOVE_Y(-ZMK_POINTING_DEFAULT_MOVE_VAL)
#define MOVE_DOWN MOVE_Y(ZMK_POINTING_DEFAULT_MOVE_VAL)
#define MOVE_LEFT MOVE_X(-ZMK_POINTING_DEFAULT_MOVE_VAL)
#define MOVE_RIGHT MOVE_X(ZMK_POINTING_DEFAULT_MOVE_VAL)
#define SCRL_UP MOVE_Y(ZMK_POINTING_DEFAULT_SCRL_VAL)
#define SCRL_DOWN MOVE_Y(-ZMK_POINTING_DEFAULT_SCRL_VAL)
#define SCRL_LEFT MOVE_X(-ZMK_POINTING_DEFAULT_SCRL_VAL)
#define SCRL_RIGHT MOVE_X(ZMK_POINTING_DEFAULT_SCRL_VAL)

16
app/include/zmk/combos.h Normal file
View File

@@ -0,0 +1,16 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <zephyr/devicetree.h>
#define ZMK_COMBOS_UTIL_ONE(n) +1
#define ZMK_COMBOS_LEN \
COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(zmk_combos), \
(0 DT_FOREACH_CHILD_STATUS_OKAY(DT_INST(0, zmk_combos), ZMK_COMBOS_UTIL_ONE)), \
(0))

View File

@@ -70,8 +70,8 @@ struct zmk_endpoint_instance zmk_endpoints_selected(void);
int zmk_endpoints_send_report(uint16_t usage_page);
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
#if IS_ENABLED(CONFIG_ZMK_POINTING)
int zmk_endpoints_send_mouse_report();
#endif // IS_ENABLE(CONFIG_ZMK_MOUSE)
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
void zmk_endpoints_clear_current(void);

View File

@@ -9,7 +9,7 @@
#include <zmk/hid.h>
#include <zmk/event_manager.h>
#include <zmk/mouse.h>
#include <zmk/pointing.h>
struct zmk_mouse_button_state_changed {
zmk_mouse_button_t buttons;

View File

@@ -12,9 +12,9 @@
#include <zephyr/usb/class/usb_hid.h>
#include <zmk/keys.h>
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
#include <zmk/mouse.h>
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
#if IS_ENABLED(CONFIG_ZMK_POINTING)
#include <zmk/pointing.h>
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
#include <dt-bindings/zmk/hid_usage.h>
#include <dt-bindings/zmk/hid_usage_pages.h>
@@ -77,6 +77,30 @@
#define ZMK_HID_REPORT_ID_CONSUMER 0x02
#define ZMK_HID_REPORT_ID_MOUSE 0x03
#ifndef HID_ITEM_TAG_PUSH
#define HID_ITEM_TAG_PUSH 0xA
#endif
#ifndef HID_ITEM_TAG_POP
#define HID_ITEM_TAG_POP 0xB
#endif
#define HID_PUSH HID_ITEM(HID_ITEM_TAG_PUSH, HID_ITEM_TYPE_GLOBAL, 0)
#define HID_POP HID_ITEM(HID_ITEM_TAG_POP, HID_ITEM_TYPE_GLOBAL, 0)
#ifndef HID_PHYSICAL_MIN8
#define HID_PHYSICAL_MIN8(a) HID_ITEM(HID_ITEM_TAG_PHYSICAL_MIN, HID_ITEM_TYPE_GLOBAL, 1), a
#endif
#ifndef HID_PHYSICAL_MAX8
#define HID_PHYSICAL_MAX8(a) HID_ITEM(HID_ITEM_TAG_PHYSICAL_MAX, HID_ITEM_TYPE_GLOBAL, 1), a
#endif
#define HID_USAGE16(a, b) HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 2), a, b
#define HID_USAGE16_SINGLE(a) HID_USAGE16((a & 0xFF), ((a >> 8) & 0xFF))
static const uint8_t zmk_hid_report_desc[] = {
HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP),
HID_USAGE(HID_USAGE_GD_KEYBOARD),
@@ -161,7 +185,7 @@ static const uint8_t zmk_hid_report_desc[] = {
HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_ARRAY | ZMK_HID_MAIN_VAL_ABS),
HID_END_COLLECTION,
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
#if IS_ENABLED(CONFIG_ZMK_POINTING)
HID_USAGE_PAGE(HID_USAGE_GD),
HID_USAGE(HID_USAGE_GD_MOUSE),
HID_COLLECTION(HID_COLLECTION_APPLICATION),
@@ -184,15 +208,51 @@ static const uint8_t zmk_hid_report_desc[] = {
HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP),
HID_USAGE(HID_USAGE_GD_X),
HID_USAGE(HID_USAGE_GD_Y),
HID_LOGICAL_MIN16(0xFF, -0x7F),
HID_LOGICAL_MAX16(0xFF, 0x7F),
HID_REPORT_SIZE(0x10),
HID_REPORT_COUNT(0x02),
HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_REL),
HID_COLLECTION(HID_COLLECTION_LOGICAL),
#if IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
HID_USAGE(HID_USAGE_GD_RESOLUTION_MULTIPLIER),
HID_LOGICAL_MIN8(0x00),
HID_LOGICAL_MAX8(0x0F),
HID_PHYSICAL_MIN8(0x01),
HID_PHYSICAL_MAX8(0x10),
HID_REPORT_SIZE(0x04),
HID_REPORT_COUNT(0x01),
HID_PUSH,
HID_FEATURE(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_ABS),
#endif // IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
HID_USAGE(HID_USAGE_GD_WHEEL),
HID_LOGICAL_MIN8(-0x7F),
HID_LOGICAL_MAX8(0x7F),
HID_REPORT_SIZE(0x08),
HID_REPORT_COUNT(0x03),
HID_LOGICAL_MIN16(0xFF, -0x7F),
HID_LOGICAL_MAX16(0xFF, 0x7F),
HID_PHYSICAL_MIN8(0x00),
HID_PHYSICAL_MAX8(0x00),
HID_REPORT_SIZE(0x10),
HID_REPORT_COUNT(0x01),
HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_REL),
HID_END_COLLECTION,
HID_COLLECTION(HID_COLLECTION_LOGICAL),
#if IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
HID_USAGE(HID_USAGE_GD_RESOLUTION_MULTIPLIER),
HID_POP,
HID_FEATURE(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_ABS),
#endif // IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
HID_USAGE_PAGE(HID_USAGE_CONSUMER),
HID_USAGE16_SINGLE(HID_USAGE_CONSUMER_AC_PAN),
HID_LOGICAL_MIN16(0xFF, -0x7F),
HID_LOGICAL_MAX16(0xFF, 0x7F),
HID_PHYSICAL_MIN8(0x00),
HID_PHYSICAL_MAX8(0x00),
HID_REPORT_SIZE(0x10),
HID_REPORT_COUNT(0x01),
HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_REL),
HID_END_COLLECTION,
HID_END_COLLECTION,
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
HID_END_COLLECTION,
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
};
#if IS_ENABLED(CONFIG_ZMK_USB_BOOT)
@@ -255,12 +315,13 @@ struct zmk_hid_consumer_report {
struct zmk_hid_consumer_report_body body;
} __packed;
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
#if IS_ENABLED(CONFIG_ZMK_POINTING)
struct zmk_hid_mouse_report_body {
zmk_mouse_button_flags_t buttons;
int8_t d_x;
int8_t d_y;
int8_t d_wheel;
int16_t d_x;
int16_t d_y;
int16_t d_scroll_y;
int16_t d_scroll_x;
} __packed;
struct zmk_hid_mouse_report {
@@ -268,7 +329,21 @@ struct zmk_hid_mouse_report {
struct zmk_hid_mouse_report_body body;
} __packed;
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
#if IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
struct zmk_hid_mouse_resolution_feature_report_body {
uint8_t wheel_res : 4;
uint8_t hwheel_res : 4;
} __packed;
struct zmk_hid_mouse_resolution_feature_report {
uint8_t report_id;
struct zmk_hid_mouse_resolution_feature_report_body body;
} __packed;
#endif // IS_ENABLED(CONFIG_ZMK_POINTING_SMOOTH_SCROLLING)
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
zmk_mod_flags_t zmk_hid_get_explicit_mods(void);
int zmk_hid_register_mod(zmk_mod_t modifier);
@@ -296,13 +371,18 @@ int zmk_hid_press(uint32_t usage);
int zmk_hid_release(uint32_t usage);
bool zmk_hid_is_pressed(uint32_t usage);
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
#if IS_ENABLED(CONFIG_ZMK_POINTING)
int zmk_hid_mouse_button_press(zmk_mouse_button_t button);
int zmk_hid_mouse_button_release(zmk_mouse_button_t button);
int zmk_hid_mouse_buttons_press(zmk_mouse_button_flags_t buttons);
int zmk_hid_mouse_buttons_release(zmk_mouse_button_flags_t buttons);
void zmk_hid_mouse_movement_set(int16_t x, int16_t y);
void zmk_hid_mouse_scroll_set(int8_t x, int8_t y);
void zmk_hid_mouse_movement_update(int16_t x, int16_t y);
void zmk_hid_mouse_scroll_update(int8_t x, int8_t y);
void zmk_hid_mouse_clear(void);
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
struct zmk_hid_keyboard_report *zmk_hid_get_keyboard_report(void);
struct zmk_hid_consumer_report *zmk_hid_get_consumer_report(void);
@@ -311,6 +391,6 @@ struct zmk_hid_consumer_report *zmk_hid_get_consumer_report(void);
zmk_hid_boot_report_t *zmk_hid_get_boot_report();
#endif
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
#if IS_ENABLED(CONFIG_ZMK_POINTING)
struct zmk_hid_mouse_report *zmk_hid_get_mouse_report();
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)

View File

@@ -12,6 +12,6 @@
int zmk_hog_send_keyboard_report(struct zmk_hid_keyboard_report_body *body);
int zmk_hog_send_consumer_report(struct zmk_hid_consumer_report_body *body);
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
#if IS_ENABLED(CONFIG_ZMK_POINTING)
int zmk_hog_send_mouse_report(struct zmk_hid_mouse_report_body *body);
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)

14
app/include/zmk/input.h Normal file
View File

@@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <dt-bindings/zmk/input.h>
struct zmk_input_explicit_code {
uint8_t type;
uint16_t code;
};

View File

@@ -0,0 +1,14 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <zephyr/devicetree.h>
#define ZMK_INPUT_LISTENERS_UTIL_ONE(n) 1 +
#define ZMK_INPUT_LISTENERS_LEN \
(DT_FOREACH_STATUS_OKAY(zmk_input_listener, ZMK_INPUT_LISTENERS_UTIL_ONE) 0)

View File

@@ -10,7 +10,10 @@
#define ZMK_LAYER_CHILD_LEN_PLUS_ONE(node) 1 +
#define ZMK_KEYMAP_LAYERS_LEN \
(DT_FOREACH_CHILD(DT_INST(0, zmk_keymap), ZMK_LAYER_CHILD_LEN_PLUS_ONE) 0)
(COND_CODE_1( \
IS_ENABLED(CONFIG_ZMK_STUDIO), \
(DT_FOREACH_CHILD(DT_INST(0, zmk_keymap), ZMK_LAYER_CHILD_LEN_PLUS_ONE)), \
(DT_FOREACH_CHILD_STATUS_OKAY(DT_INST(0, zmk_keymap), ZMK_LAYER_CHILD_LEN_PLUS_ONE))) 0)
/**
* @brief A layer ID is a stable identifier to refer to a layer, regardless of ordering.

View File

@@ -21,9 +21,11 @@ struct zmk_key_physical_attrs {
int16_t height;
int16_t x;
int16_t y;
#if IS_ENABLED(CONFIG_ZMK_PHYSICAL_LAYOUT_KEY_ROTATION)
int16_t rx;
int16_t ry;
int16_t r;
#endif
};
struct zmk_physical_layout {

View File

@@ -1,12 +1,12 @@
/*
* Copyright (c) 2021 The ZMK Contributors
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <dt-bindings/zmk/mouse.h>
#include <dt-bindings/zmk/pointing.h>
typedef uint8_t zmk_mouse_button_flags_t;
typedef uint16_t zmk_mouse_button_t;

View File

@@ -0,0 +1,10 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
int zmk_input_split_report_peripheral_event(uint8_t reg, uint8_t type, uint16_t code, int32_t value,
bool sync);

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <zmk/hid.h>
#include <zmk/endpoints.h>
struct zmk_pointing_resolution_multipliers {
uint8_t wheel;
uint8_t hor_wheel;
};
struct zmk_pointing_resolution_multipliers
zmk_pointing_resolution_multipliers_get_current_profile(void);
struct zmk_pointing_resolution_multipliers
zmk_pointing_resolution_multipliers_get_profile(struct zmk_endpoint_instance endpoint);
void zmk_pointing_resolution_multipliers_set_profile(
struct zmk_pointing_resolution_multipliers multipliers, struct zmk_endpoint_instance endpoint);
void zmk_pointing_resolution_multipliers_process_report(
struct zmk_hid_mouse_resolution_feature_report_body *report,
struct zmk_endpoint_instance endpoint);

View File

@@ -31,8 +31,17 @@ struct zmk_split_run_behavior_payload {
char behavior_dev[ZMK_SPLIT_RUN_BEHAVIOR_DEV_LEN];
} __packed;
struct zmk_split_input_event_payload {
uint8_t type;
uint16_t code;
uint32_t value;
uint8_t sync;
} __packed;
int zmk_split_bt_position_pressed(uint8_t position);
int zmk_split_bt_position_released(uint8_t position);
int zmk_split_bt_sensor_triggered(uint8_t sensor_index,
const struct zmk_sensor_channel_data channel_data[],
size_t channel_data_size);
int zmk_split_bt_report_input(uint8_t reg, uint8_t type, uint16_t code, int32_t value, bool sync);

View File

@@ -19,3 +19,4 @@
#define ZMK_SPLIT_BT_CHAR_SENSOR_STATE_UUID ZMK_BT_SPLIT_UUID(0x00000003)
#define ZMK_SPLIT_BT_UPDATE_HID_INDICATORS_UUID ZMK_BT_SPLIT_UUID(0x00000004)
#define ZMK_SPLIT_BT_SELECT_PHYS_LAYOUT_UUID ZMK_BT_SPLIT_UUID(0x00000005)
#define ZMK_SPLIT_BT_INPUT_EVENT_UUID ZMK_BT_SPLIT_UUID(0x00000006)

View File

@@ -10,7 +10,7 @@
int zmk_usb_hid_send_keyboard_report(void);
int zmk_usb_hid_send_consumer_report(void);
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
#if IS_ENABLED(CONFIG_ZMK_POINTING)
int zmk_usb_hid_send_mouse_report(void);
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)
void zmk_usb_hid_set_protocol(uint8_t protocol);

View File

@@ -7,6 +7,8 @@
#pragma once
#include <zmk/matrix.h>
#include <zmk/combos.h>
#include <zmk/input_listeners.h>
#include <zmk/sensors.h>
/**
@@ -22,4 +24,9 @@
/**
* Gets the virtual key position to use for the combo with the given index.
*/
#define ZMK_VIRTUAL_KEY_POSITION_COMBO(index) (ZMK_KEYMAP_LEN + ZMK_KEYMAP_SENSORS_LEN + (index))
#define ZMK_VIRTUAL_KEY_POSITION_COMBO(index) \
(ZMK_VIRTUAL_KEY_POSITION_SENSOR(ZMK_KEYMAP_SENSORS_LEN) + (index))
#define ZMK_VIRTUAL_KEY_POSITION_BEHAVIOR_INPUT_PROCESSOR(listener_index, processor_index) \
(ZMK_VIRTUAL_KEY_POSITION_COMBO(ZMK_COMBOS_LEN) + \
(ZMK_INPUT_LISTENERS_LEN * (processor_index)) + (listener_index))

View File

@@ -50,10 +50,12 @@ if (ZMK_CONFIG)
set(ENV{ZMK_CONFIG} "${ZMK_CONFIG}")
if(EXISTS ${ZMK_CONFIG}/boards)
message(STATUS "Adding ZMK config directory as board root: ${ZMK_CONFIG}")
message(DEPRECATION "The `config/boards` folder is deprecated. Please use a module instead. See https://zmk.dev/docs/development/hardware-integration/new-shield and https://zmk.dev/docs/development/module-creation for more information.")
list(APPEND BOARD_ROOT ${ZMK_CONFIG})
endif()
if(EXISTS ${ZMK_CONFIG}/dts)
message(STATUS "Adding ZMK config directory as DTS root: ${ZMK_CONFIG}")
message(DEPRECATION "The `config/dts` folder is deprecated. Please use a module instead. See https://zmk.dev/docs/development/hardware-integration/new-shield and https://zmk.dev/docs/development/module-creation for more information.")
list(APPEND DTS_ROOT ${ZMK_CONFIG})
endif()
endif()

View File

@@ -5,3 +5,4 @@ add_subdirectory_ifdef(CONFIG_GPIO gpio)
add_subdirectory_ifdef(CONFIG_KSCAN kscan)
add_subdirectory_ifdef(CONFIG_SENSOR sensor)
add_subdirectory_ifdef(CONFIG_DISPLAY display)
add_subdirectory_ifdef(CONFIG_INPUT input)

View File

@@ -5,3 +5,4 @@ rsource "gpio/Kconfig"
rsource "kscan/Kconfig"
rsource "sensor/Kconfig"
rsource "display/Kconfig"
rsource "input/Kconfig"

View File

@@ -371,14 +371,14 @@ static int il0323_init(const struct device *dev) {
return il0323_controller_init(dev);
}
static struct il0323_cfg il0323_config = {
static const struct il0323_cfg il0323_config = {
.spi = SPI_DT_SPEC_INST_GET(0, SPI_OP_MODE_MASTER | SPI_WORD_SET(8), 0),
.reset = GPIO_DT_SPEC_INST_GET(0, reset_gpios),
.busy = GPIO_DT_SPEC_INST_GET(0, busy_gpios),
.dc = GPIO_DT_SPEC_INST_GET(0, dc_gpios),
};
static struct display_driver_api il0323_driver_api = {
static const struct display_driver_api il0323_driver_api = {
.blanking_on = il0323_blanking_on,
.blanking_off = il0323_blanking_off,
.write = il0323_write,

View File

@@ -202,7 +202,7 @@ static int reg_595_init(const struct device *dev) {
GPIO_PORT_PIN_MASK_FROM_NGPIOS(DT_INST_PROP(inst, ngpios))
#define REG_595_INIT(n) \
static struct reg_595_config reg_595_##n##_config = { \
static const struct reg_595_config reg_595_##n##_config = { \
.common = \
{ \
.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(n), \

View File

@@ -322,7 +322,7 @@ static int max7318_init(const struct device *dev) {
GPIO_PORT_PIN_MASK_FROM_NGPIOS(DT_INST_PROP(inst, ngpios))
#define MAX7318_INIT(inst) \
static struct max7318_config max7318_##inst##_config = { \
static const struct max7318_config max7318_##inst##_config = { \
.common = {.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(inst)}, \
.i2c_bus = I2C_DT_SPEC_INST_GET(inst)}; \
\

View File

@@ -0,0 +1,6 @@
# Copyright (c) 2020-2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
zephyr_library_amend()
zephyr_library_sources_ifdef(CONFIG_ZMK_INPUT_MOCK input_mock.c)

View File

@@ -0,0 +1,9 @@
if INPUT
config ZMK_INPUT_MOCK
bool "Input Mock"
default y
depends on DT_HAS_ZMK_INPUT_MOCK_ENABLED
endif

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#define DT_DRV_COMPAT zmk_input_mock
#include <stdlib.h>
#include <zephyr/device.h>
#include <zephyr/input/input.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct input_mock_config {
uint16_t startup_delay;
uint16_t event_period;
bool exit_after;
const uint32_t *events;
size_t events_len;
};
struct input_mock_data {
size_t event_index;
struct k_work_delayable work;
const struct device *dev;
};
static void input_mock_work_cb(struct k_work *work) {
struct k_work_delayable *dwork = CONTAINER_OF(work, struct k_work_delayable, work);
struct input_mock_data *data = CONTAINER_OF(dwork, struct input_mock_data, work);
const struct device *dev = data->dev;
const struct input_mock_config *cfg = dev->config;
data->event_index++;
size_t base_idx = data->event_index * 4;
if (base_idx >= cfg->events_len) {
if (cfg->exit_after) {
exit(0);
} else {
return;
}
}
input_report(dev, cfg->events[base_idx], cfg->events[base_idx + 1], cfg->events[base_idx + 2],
cfg->events[base_idx + 3], K_NO_WAIT);
k_work_schedule(&data->work, K_MSEC(cfg->event_period));
}
int input_mock_init(const struct device *dev) {
struct input_mock_data *drv_data = dev->data;
const struct input_mock_config *drv_cfg = dev->config;
drv_data->dev = dev;
drv_data->event_index = -1;
k_work_init_delayable(&drv_data->work, input_mock_work_cb);
k_work_schedule(&drv_data->work, K_MSEC(drv_cfg->startup_delay));
return 0;
}
#define INPUT_MOCK_INST(n) \
static struct input_mock_data input_mock_data_##n = {}; \
static const uint32_t mock_data_##n[] = DT_INST_PROP(n, events); \
static const struct input_mock_config input_mock_cfg_##n = { \
.events = mock_data_##n, \
.events_len = DT_INST_PROP_LEN(n, events), \
.startup_delay = DT_INST_PROP(n, event_startup_delay), \
.event_period = DT_INST_PROP(n, event_period), \
.exit_after = DT_INST_PROP(n, exit_after), \
}; \
DEVICE_DT_INST_DEFINE(n, input_mock_init, NULL, &input_mock_data_##n, &input_mock_cfg_##n, \
POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL);
DT_INST_FOREACH_STATUS_OKAY(INPUT_MOCK_INST)

View File

@@ -44,6 +44,13 @@ static int kscan_composite_enable_callback(const struct device *dev) {
for (int i = 0; i < cfg->children_len; i++) {
const struct kscan_composite_child_config *child_cfg = &cfg->children[i];
#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || IS_ENABLED(CONFIG_PM_DEVICE)
if (pm_device_wakeup_is_enabled(dev) && pm_device_wakeup_is_capable(child_cfg->child) &&
!pm_device_wakeup_enable(child_cfg->child, true)) {
LOG_ERR("Failed to enable wakeup for %s", child_cfg->child->name);
}
#endif // IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || IS_ENABLED(CONFIG_PM_DEVICE)
#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)
if (!pm_device_runtime_is_enabled(dev) && pm_device_runtime_is_enabled(child_cfg->child)) {
pm_device_runtime_get(child_cfg->child);
@@ -62,6 +69,14 @@ static int kscan_composite_disable_callback(const struct device *dev) {
for (int i = 0; i < cfg->children_len; i++) {
const struct kscan_composite_child_config *child_cfg = &cfg->children[i];
#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || IS_ENABLED(CONFIG_PM_DEVICE)
if (pm_device_wakeup_is_capable(child_cfg->child) &&
pm_device_wakeup_is_enabled(child_cfg->child) &&
!pm_device_wakeup_enable(child_cfg->child, false)) {
LOG_ERR("Failed to disable wakeup for %s", child_cfg->child->name);
}
#endif // IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || IS_ENABLED(CONFIG_PM_DEVICE)
kscan_disable_callback(child_cfg->child);
#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)

View File

@@ -168,6 +168,8 @@ static int kscan_charlieplex_set_all_outputs(const struct device *dev, const int
return 0;
}
#if IS_ENABLED(CONFIG_PM_DEVICE)
static int kscan_charlieplex_disconnect_all(const struct device *dev) {
const struct kscan_charlieplex_config *config = dev->config;
@@ -183,6 +185,8 @@ static int kscan_charlieplex_disconnect_all(const struct device *dev) {
return 0;
}
#endif
static int kscan_charlieplex_interrupt_configure(const struct device *dev,
const gpio_flags_t flags) {
const struct kscan_charlieplex_config *config = dev->config;
@@ -445,7 +449,7 @@ static const struct kscan_driver_api kscan_charlieplex_api = {
.charlieplex_state = kscan_charlieplex_state_##n, \
}; \
\
static struct kscan_charlieplex_config kscan_charlieplex_config_##n = { \
static const struct kscan_charlieplex_config kscan_charlieplex_config_##n = { \
.cells = KSCAN_GPIO_LIST(kscan_charlieplex_cells_##n), \
.debounce_config = \
{ \

View File

@@ -397,7 +397,7 @@ static const struct kscan_driver_api kscan_direct_api = {
.pin_state = kscan_direct_state_##n, \
COND_INTERRUPTS((.irqs = kscan_direct_irqs_##n, ))}; \
\
static struct kscan_direct_config kscan_direct_config_##n = { \
static const struct kscan_direct_config kscan_direct_config_##n = { \
.debounce_config = \
{ \
.debounce_press_ms = INST_DEBOUNCE_PRESS_MS(n), \

View File

@@ -515,7 +515,7 @@ static const struct kscan_driver_api kscan_matrix_api = {
.matrix_state = kscan_matrix_state_##n, \
COND_INTERRUPTS((.irqs = kscan_matrix_irqs_##n, ))}; \
\
static struct kscan_matrix_config kscan_matrix_config_##n = { \
static const struct kscan_matrix_config kscan_matrix_config_##n = { \
.rows = ARRAY_SIZE(kscan_matrix_rows_##n), \
.cols = ARRAY_SIZE(kscan_matrix_cols_##n), \
.outputs = \

View File

@@ -65,6 +65,12 @@ static int kscan_mock_configure(const struct device *dev, kscan_callback_t callb
struct k_work_delayable *d_work = k_work_delayable_from_work(work); \
struct kscan_mock_data *data = CONTAINER_OF(d_work, struct kscan_mock_data, work); \
const struct kscan_mock_config_##n *cfg = data->dev->config; \
if (data->event_index >= DT_INST_PROP_LEN(n, events)) { \
if (cfg->exit_after) \
exit(0); \
else \
return; \
} \
uint32_t ev = cfg->events[data->event_index]; \
LOG_DBG("ev %u row %d column %d state %d\n", ev, ZMK_MOCK_ROW(ev), ZMK_MOCK_COL(ev), \
ZMK_MOCK_IS_PRESS(ev)); \

View File

@@ -4,3 +4,5 @@
add_subdirectory_ifdef(CONFIG_ZMK_BATTERY battery)
add_subdirectory_ifdef(CONFIG_EC11 ec11)
add_subdirectory_ifdef(CONFIG_ZMK_MAX17048 max17048)
add_subdirectory_ifdef(CONFIG_ZMK_SENSOR_ENCODER_MOCK encoder_mock)

View File

@@ -7,4 +7,6 @@ rsource "battery/Kconfig"
rsource "ec11/Kconfig"
rsource "max17048/Kconfig"
rsource "encoder_mock/Kconfig"
endif # SENSOR

View File

@@ -11,7 +11,7 @@ menuconfig EC11
if EC11
choice
choice EC11_TRIGGER_MODE
prompt "Trigger mode"
default EC11_TRIGGER_NONE
help

View File

@@ -148,8 +148,8 @@ int ec11_init(const struct device *dev) {
}
#define EC11_INST(n) \
struct ec11_data ec11_data_##n; \
const struct ec11_config ec11_cfg_##n = { \
static struct ec11_data ec11_data_##n; \
static const struct ec11_config ec11_cfg_##n = { \
.a = GPIO_DT_SPEC_INST_GET(n, a_gpios), \
.b = GPIO_DT_SPEC_INST_GET(n, b_gpios), \
.resolution = DT_INST_PROP_OR(n, resolution, 1), \

View File

@@ -0,0 +1,8 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT
zephyr_include_directories(.)
zephyr_library()
zephyr_library_sources(encoder_mock.c)

Some files were not shown because too many files have changed in this diff Show More