Commit graph

110 commits

Author SHA1 Message Date
Kim Streich
8873bf937e feat(mouse): Add PS/2 mouse/trackpoint/etc support
PS2 GPIO: Added initial structure

PS2 GPIO: Added interrupt handler and pin reading/writing helper functions

PS2 GPIO: Added reading mode

PS2 GPIO: Add zephyr PS2 API support for callback and read function

PS2 GPIO: Fix reading not working with real PS2 device

PS2 GPIO: Added write with separate edge rising callback

PS2 GPIO: Made single interrupt handler

PS2 GPIO: Switch to inactive and falling handler only

PS2 GPIO: Switch back to edge falling

PS2 GPIO: Working without writing

PS2 GPIO: Enable both edges (working)

PS2 GPIO: Somewhat working write

PS2 GPIO: Write with ack working, but read always wrong stop bit

PS2 GPIO: Cleanup code

PS2 GPIO: Fix write not working by increasing clock holding time

PS2 GPIO: Adde scl clock timeout for reads

PS2 GPIO: Add scl clock timeout for writes

PS2 GPIO: Moved pin config into separate functions (not working)

PS2 GPIO: Make read work by removing some logging

PS2 GPIO: Fixed memory issue with fifo

PS2 GPIO: Kind of working sometimes except for ack bit

PS2 GPIO: Working without ack

PS2 GPIO: Fix crash: Disable resend command in read abort

PS2 GPIO: Make write work (But next read fails)
PS2 GPIO:
PS2 GPIO: I think the next read fails because we swallow the first 0 bit when reading the ack.

PS2 GPIO: Disable logging go speed up processing

PS2 GPIO: Made writing mostly work; read afterwards inconsistent

PS2 GPIO: Added post write debug log

PS2 GPIO: Improved post-write reading success rate

PS2 GPIO: Adjust timings

PS2 GPIO: Added logging of time between interrupts

PS2 GPIO: Instead of sleep() for write line inhibition, do delayable work

PS2 GPIO: Compensate for missing stop bit in read when it happens directly after write

PS2 GPIO: Adding interrupt logging

PS2 GPIO: Fix set_scl() setting sda and set_sda() setting scl

PS2 GPIO: Make interrupt logging work for sends
PS2 GPIO:
PS2 GPIO: Add interrupt logging to read functions

PS2 GPIO: Add ability to disable interrupt callback during write inhibition phase

PS2 GPIO: Rename inhibit slc duration config option
PS2 GPIO:
PS2 GPIO: Add missing inhibit setting rename

PS2 GPIO: Improve handling of spurious interrupts after writing better
PS2 GPIO:
PS2 GPIO: Adjust scl timeouts

PS2 GPIO: Added logging helper
PS2 GPIO:
PS2 GPIO: Logging helper

PS2 GPIO: Start fixing original write functions

PS2 GPIO: Cleanup read code

PS2 GPIO: Cleanup write code

PS2 GPIO: Adjust read/write scl timeouts

PS2 GPIO: Disable logger

PS2 GPIO: Add custom interrupt logging

PS2 GPIO: Enable interrupt logger

PS2 GPIO: Added separate write scl timeout for the first clock

PS2 GPIO: Fix running out of memory due to read queue

PS2 GPIO: Allow disabling of interrupt logs

PS2 GPIO: Improve logging and comments

PS2 GPIO: Removed old interrupt code
PS2 GPIO:
PS2 GPIO: interrupt stuff
PS2 GPIO:
PS2 GPIO: x

PS 2 Mouse: Add initial mouse driver for testing PS2 driver

PS2 GPIO: Add ps2 device to callback

PS2 Mouse: Added initial mouse movement cmd parsing

PS2 Mouse: Added actual mouse movement
PS2 Mouse:
PS2 Mouse: Inverted y for zmk as that is what zmk thinks is up
PS2 Mouse:
PS2 Mouse: comm

PS2 Mouse: Changed config options to match zmk mouse naming

PS2 Mouse: Added options to invert x and y mouse movements

PS2 Mouse: Rename mouse movement to mouse activity

PS2 Mouse: Added mouse button support

PS2 GPIO: Small cleanup

PS2 GPIO: Move interrupt logging around

PS2 GPIO: Added write re-try on fail

PS2 GPIO: Initial attempt at write await response (not working)

PS2 GPIO: Revert "Initial attempt at write await response (not working)"
PS2 GPIO:
PS2 GPIO: This reverts commit 6e77047ba8f8537e076f3a583d03c6222874998c.

PS2 GPIO: Added reason do abort_read()

PS2 GPIO: Disable resend on read failure for debugging

PS2 GPIO: Initialize current write byte

PS2 GPIO: Added max read retry

PS2 GPIO: Disable log interrupt

PS2 GPIO: Made timings based on ps2 protocol defines
PS2 GPIO:
PS2 GPIO: Move settings

PS2 GPIO: Added write_byte_await_response()

PS2 GPIO: Fix write retry incorrect retry number log

PS2 Mouse: Sort defines

PS2 Mouse: Improve init sequence

PS2 Mouse: Removed unneeded stream mode enabling command

PS2 GPIO: Make no response in write_byte_await_response an failure

PS2 Mouse: During init send reset command on every 4th attempt

PS2 Mouse: Add sample rate setting support

PS2 Mouse: Start use mouse events for movements

PS2 GPIO: Change most logging to debug

PS2 Mouse: Change logs from inf to dbg

PS2 Mouse: Experiment with different mouse movement methods

PS2 Mouse: Report mouse activity through timer instead of as it arrives.

PS2 Mouse: Use zmk log level instead of ps2

PS2 GPIO: Moved retry logic into separate function that also resends on error resp from device
PS2 GPIO:
PS2 GPIO: Enable retry send for ps2 interface
PS2 GPIO:
PS2 GPIO: Fix write failure error code

PS2 GPIO: Cleanup write code slightly

PS2 GPIO: Disable interrupt logging

PS2 GPIO: Use just one function for parity checking

PS2 GPIO: Small cleanup of read and write
PS2 GPIO:
PS2 GPIO: Small comment improvement

PS2 GPIO: In read_interrupt, moved data bits to a more logical position
PS2 GPIO:
PS2 GPIO: Read interrupt fix

PS2 GPIO: Call zephyr PS2 callback from a worker

PS2 GPIO: Remove unneeded gpio config flags

PS2 GPIO: Allow to enable and disable interrupt log through kconfig

PS2 Mouse: Re-enable resend request due to packet misalignment

PS2 Mouse: Parse cmd buffer using a struct instead of pointers

PS2 Mouse: Cleanup and improve documentation

PS2 Mouse: Silence error on read data queue timeout

PS2 Mouse: Improved init sequence

PS2 Mouse: Move init functions around

PS2 Mouse: Added scroll mode

PS2 Mouse: Make scroll mode configurable

PS2 Mouse: Added functions to incr and decr sampling rate

PS2 GPIO: Update blocking timeout for retry changes

PS2 GPIO: Increased timeout for write_byte_await_response()

PS2 GPIO: Added custom work queue

PS2 Mouse: Added mouse settings behavior (with queue)

PS2 Mouse: Removed queue from mouse setting behavior
PS2 Mouse:
PS2 Mouse: A queue was added to the ps2 gpio driver itself. So there is no need for it here anymore.

PS2 GPIO: Don’t log error on timed out ps2_read()

PS2 Mouse: Added reset-on-power function for trackpoints

PS2 Mouse: Add command to check if device is trackpoint

PS2 Mouse: Added send_cmd function that can send multibyte commands and read response

PS2 Mouse: Added trackpoint press to select and sensitivity setting

PS2 Mouse: Add config option for tap to select

PS2 Mouse: Fixed power-on-reset

PS2 Mouse: Add trackpoint swap xy command

PS2 Mouse: Add swap xy setting

PS2 Mouse: Added option to invert x and y directly on the trackpoint

PS2 Mouse: Added negative inertia setting

PS2 Mouse: Added upper plateau speed (value6)

PS2 Mouse: Added press-to-select threshold

PS2 Mouse: Added keybindings for TP settings

PS2 GPIO: Increased log break time

PS2 GPIO: Re-enable re-send request on read error

PS2 GPIO: Fix outdated comment

PS2 GPIO: Reduce debug logging

PS2 Mouse: Reduce logging

PS2 Mouse: Added config option to disable clicking

PS2 Mouse: Added config option for sampling rate

PS2 GPIO: Automatically adjust BT priorities when PS2 GPIO driver is enabled

PS2 Mouse: Lower default priority of NRF IRQs

PS2 Mouse: Add out of alignment detection

PS2 Mouse: Simplify out of alignment check

PS2 GPIO: Fixed deadlock on write due to wrong wokr queue priorities

PS2 GPIO: Log reason for write finish

PS2 GPIO: Increase SCL timeout

PS2 GPIO: Add pos to abort read logging

PS2 GPIO: For writes read ack bit before interrupt logging

PS2 GPIO: Fix interrupt_log_add crash

PS2 GPIO: Make interrupt_log. log in background

PS2 GPIO: Decrease priority for inhibition wait thread

PS2 GPIO: Increase timeout for first write clock

PS2 GPIO: Add argument to interrupt_log

PS2 GPIO: Improve write debug logging

PS2 Mouse: Improve misalignment detection by checking if there was prev movement

PS2 Mouse: Fix crash caused by zephyr LOG bug due to transient strings
PS2 Mouse:
PS2 Mouse: https://github.com/zephyrproject-rtos/zephyr/issues/44996

PS2 GPIO: Use main write function for 0xfe retry cmd

PS2 GPIO: Add resend callback to gpio driver

PS2 GPIO: Increase inhibition delay timer

PS2 GPIO: Properly fail write if semaphore times out

PS2 Mouse: Added resend callback

PS2 Mouse: Fix TP incr/decrease not remembering prev value

PS2 Mouse: Reset cmd buffer on misalignment

PS2 Mouse: Re-enable abort on sharp movement

PS2 Mouse: Fix mouse scrolling unintendedly if mouse mode is disabled

PS2 Mouse: Log button presses as info

PS2 GPIO: Re-enable scl interrupt on write failure

PS2 GPIO: Increase write max retry

PS2 Mouse: Make compatible with zephyr 3.2 update

PS2 GPIO: Make compatible with zephyr 3.2

PS2 GPIO: Use new zephyr gpio_*_dt apis

PS2 Mouse: Use new zephyr gpio_*_dt apis

PS2 GPIO: Prevent lockout on resend by using cb worker

PS2 GPIO: Add missing interrupt detection

PS2 GPIO: Added write error code for semaphore timeout

PS2 GPIO: Added mutex to prevent multiple threads writing at once

PS2 Mouse: Treat packet overflow as mistransmission

PS2 Mouse: If multiple mouse buttons are changed in one packet, treat it as mistransmission

PS2 Mouse: Fix value6 functions actually setting neg inertia

PS2 Mouse: Remove kconfig setting for mouse

PS2 Mouse: Reordered includes

PS2 Mouse: Switched tp sensitivity setting from float to int

PS2 Mouse: Added setting saving and restoring

PS2 Mouse: Created proper, automatic Kconfig

PS2 Mouse: Reorder includes

PS2 GPIO: Enable PS2 GPIO driver automatically if the devicetree node is present

PS2 Mouse: Rename ps2_mouse to mouse_ps2

PS2 Mouse: Fully rename ps2_mouse to mouse_ps2

PS2 Mouse: Cleanup of mouse_ps2 function  naming and order

PS2 Mouse: Renamed activity cmd to packet

PS2 Mouse: Removed sampling rate from being set from keypresses

PS2 Mouse: Remove redudant decr/incr functions

PS2 Mouse: Rename array functions

PS2 Mouse: Ensure all functions have common prefix zmk_mouse_ps2

PS2 Mouse: Reduce logging

PS2 GPIO: Make sure all functions have the ps2_gpio prefix

PS2 UART: Added initial UART PS2 driver

PS2 UART: Made uart PS2 read work

PS2 UART: Refactored uart read code

PS2 UART: Added parity error checking

PS2 UART: Initial attempt at pincntrl switching

Revert "PS2 UART: Initial attempt at pincntrl switching"

This reverts commit 5538731a90031b7607f05775135385bbe14464dc.

PS2 UART: Initial version of GPIO write (not working)

PS2 UART: Kindoff working

PS2 UART: Working

PS2 UART: Small cleanup

PS2 UART: Adjust timings and improve comments

PS2 Mouse: Increase init priority to be after UART drivers

PS2 UART: Attempt to not block interrupt (not working, worker never called)

Revert "PS2 UART: Attempt to not block interrupt (not working, worker never called)"

This reverts commit 6c37f9a236137cc0ca873c6ee4afef3f69eb5708.

PS2 Mouse: Add config option to disable additional error mitigation

Auto Layer: Add automatic layer toggling on mouse movement

PS2 Mouse: Log transmission error reason

PS2 UART: Check read error in received_byte

PS2 UART: Added blocking write

Auto Layer: Fixes

Scroll Mode: Initial implementation

PS2 Mouse: Auto lint code

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

PS2 GPIO: Apply new auto-format to ps2_gpio

PS2 UART: Apply new auto-format

PS2 GPIO: Make write mutex names unique

PS2 UART: Make write mutex names unique

PS2 GPIO: Fix zephyr 3.5 compile errors

PS2 UART: Fix zephyr 3.5 compile errors

Mouse Settings & Scroll Mode: Apply new auto-formatting

Mouse Settings: Silence zephyr 3.5 compile warnings

PS2 Mouse: Move to zephyr 3.5 input system

PS2 Mouse: Add mouse ps2 work queue

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

PS2 UART: Attempt adding pinctrl states dynamically (unsuccessful)

Revert "PS2 UART: Attempt adding pinctrl states dynamically (unsuccessful)"

This reverts commit 1a2c3f6f6832a95a828675a093bef7070fbe5bac.

PS2 UART: Fix zephyr 3.5 pinctrl change error

the issue was that I was using the sleep pinctrl state, because I couldn't figure out how to create a custom state.

And in zephyr 3.2 that worked fine, but in 3.5 it disables the sleep state if CONFIG_PM_DEVICE=n.

So the state was missing.

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

PS2 Mouse: Disable restore of mouse PS2 settings

Mouse Auto Layer: Added toggle delay to prevent accidental activations

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

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

PS2 GPIO: Potentially fix SCL not being pulled down during write

PS2 UART: Potentially fix inhibition not being done correctly

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

PS2 UART: Fix PM_DEVICE not enabling

PS2 GPIO: Improve PS2 GPIO kconfig documentation

PS2 UART: Lower BT interrupt priorities

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

PS2 UART: Fix first write not working

PS2 UART: Add debug write function

PS2 UART: Disable debug write function

PS2 UART: Log received bytes

PS2 UART: Use delayable instead of k_busy_wait

Revert "PS2 UART: Use delayable instead of k_busy_wait"

Realized that this is pointless, since that’s a blocking function anyways.

We need to not block in the interrupt handler rather than here.

This reverts commit eee0c35793ccccf40d72742d19cc85762423a103.

PS2 UART: Move scl interrupt into worker

PS2 UART: Add cur write pos

Revert "PS2 UART: Move scl interrupt into worker"

This reverts commit ea24c68b1af0f6e4a367622829d92f380d92a27f.

PS2 UART: Added async interrupt writing mode

PS2 UART: Ignore framing errors for 0xfa received bytes

PS2 UART: Log write and received bytes only in DBG

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

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

PS2 Mouse: Log when settings were set successfully

PS2 Mouse: Added devicetree settings for TP settings

Correct val6 default value

PS2 Mouse: Enable settings restore again

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

Mouse Settings: Added log and reset behavior

Adjust settings log

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

PS2 Mouse: Replace kconfig enable clicking with devicetree disable clicking

PS2 Mouse: Disable error mitigations by default

PS2 Mouse: Moved axis options from kconfig to devicetree

PS2 Mouse: Removed scroll mode behavior

PS2 Mouse: Move scroll mode from kconfig to devicetree

PS2 Mouse: Removed movement buffer / queue

Remove butter kconfigs

PS2 Mouse: Moved mouse_ps2 driver to module

PS2 Mouse: Convert clicking to zephyr 3.5 input system

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

PS2 UART: Fix Linking error due to missing config options if logging is disabled

PS2 UART: Replace data queue fifo with message queue to get rid of heap use

PS2 GPIO: Replace data queue fifo with message queue to get rid of heap use

Input Listener: Added logging

Auto Layer Toggle: Added initial version

Auto Layer Toggle: Changed how config is retrieved

Auto Layer Toggle: Adjust logging

Auto Layer Toggle: Remove dependency on urob’s “Zen display & battery tweaks”

That commit adds an additional parameter to the `zmk_keymap_layer_activate` function.

Need to find a better way to make the code compatible whether urob is used or not.

5796aa0104

PS2 GPIO & UART: Apply zmk auto-formatting

PS2 UART, GPIO, Mouse: Make resend callback optional to allow compilation without zephyr fork

PS2 Mouse & Auto Layer Toggle: Add urob compatibility option

PS2 Mouse: Remove unneeded file
2024-04-20 22:48:20 -06:00
Peter Johanson
1974fe9d54 refactor(mouse): Lots of mouse refactors.
* Dedicated mouse source directory.
* Split mouse HID into dedicated USB endpoint and HoG service.
* Enable composite USB device automatically, tweak the
  various default sizes.
2024-04-09 23:10:49 -07:00
Peter Johanson
36c78275c5 refactor: Proper per-device input listeners.
* Buffer data from input devices and only surface to HID once synd'd.
2024-04-06 21:31:45 -07:00
Peter Johanson
664a61e405 refactor(mouse): Remove mouse work queue, Kconfig
* Remove now-unused mouse work queue and related mouse main file.
* Move ticks config into a DTS property on the two axis input behavior.
2024-04-06 21:31:23 -07:00
Peter Johanson
368f98c330 feat(mouse): Add input configs for data mods.
* Add ability to swap X/Y, invert X and Y values, and apply a
  scalar multiplier/divisor.
2024-04-06 21:31:23 -07:00
Peter Johanson
0ba8a29b69 refactor: Use input system for pointer events. 2024-04-06 21:31:22 -07:00
Cem Aksoylar
2eba88d2c4 feat(mouse): Add mouse move and scroll support [WIP]
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>
2024-04-06 21:30:53 -07:00
Peter Johanson
41d81801ed fix(pm): Use Zephyr created device slots.
* Avoid overwriting random memory by using
  iterable section created by Zephyr PM.
2024-03-27 20:59:26 -07:00
Peter Johanson
bb94a7aafe fix: Fixes for building soft off without deep sleep. 2024-03-27 20:59:26 -07:00
Peter Johanson
a0ad1d4c94 refactor: Add kscan sideband behavior driver
* Instead of gpio key behavior trigger, add new kscan driver that
  decorates/wraps a given kscan driver and will invoke basic system
  behavior assigned to a given row + column, without the need for keymap
  mapping in the matrix transform, bypassing keymaps entirely.
2024-03-27 20:59:26 -07:00
Pete Johanson
933fdcd364 refactor(pm): Remove scanned behavior trigger.
* Remove the painful scanned behavior trigger for now, future enhancement
  will restore this high level functionality using kscan directly.
2024-03-27 20:59:26 -07:00
Pete Johanson
5ebe924e94 chore: Various soft-off review fixes
* Code style to avoid goto.
* Enable pm.c compilation via dedicated Kconfig flag.
* Comment wakeup trigger PM behavior.
2024-03-27 20:59:26 -07:00
Peter Johanson
fceb0351a5 refactor: Fixes for soft-off based on review.
* Better naming for gpio-key behavior triggers.
* Tweaks to scanned behavior trigger to avoid bad semaphore use,
  and reduce chance of issues with slowly scanned matrixes.
* Various code cleanups of style issues.
2024-03-27 20:59:26 -07:00
Peter Johanson
b19df0cbf0 feat(behaviors): Add soft off behavior.
* New soft-off behavior that can be used to force the device
  into  soft-off state with only certain configured wakeup
  devices.
2024-03-27 20:59:26 -07:00
Peter Johanson
adb3a13dc5 feat: Add soft on/off support.
Initial work on a soft on/off support for ZMK. Triggering soft off
puts the device into deep sleep with only a specific GPIO pin
configured to wake the device, avoiding waking from other key
presses in the matrix like the normal deep sleep.

Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
2024-03-27 20:59:26 -07:00
Joel Spadin
610a806c84 feat: Add function to erase all settings
Added a zmk_settings_erase() function to clear all saved settings. This
does not go through Zephyr's settings subsystem, but instead directly
clears the data from the setting storage backend, so a reboot is needed
for it to take effect.
2024-03-18 09:48:19 -07:00
Peter Johanson
50a303b8bb fix(pm): Restore sleep suspension of devices.
* After the move to `sys_poweroff`, restore the behavior of
  suspending devices before entering sleep state.
2024-02-09 14:32:46 -08:00
Peter Johanson
d06e90e713 fix: Fix syscalls generation setup. 2024-02-09 14:32:46 -08:00
Peter Johanson
1b8b6b4a0e refactor(core): Make low priority queue optional.
* Add a new Kconfig symbol to enable the low priority queue, and make
  the two features that depend on it `select` the symbol to turn it on.
  This helps ensure no wasted RAM/ROM on devices that don't need it.
2023-12-16 17:10:45 -08:00
Peter Johanson
efd403a567 refactor: Hook into CMake loading in a better spot.
* Shift to using an extra Zephyr module to do keymap location
  work after all board roots are resolved. This avoids duplicate work
  and allows us to load custom boards from Zephyr modules as well as
  user config setups.
2023-12-06 09:36:37 -08:00
Joel Spadin
36eda571b7 refactor(behaviors): Create a list to lookup behaviors
Added BEHAVIOR_DT_DEFINE() and BEHAVIOR_DT_INST_DEFINE(), which work
exactly like the DEVICE_*_DEFINE() macros, except they also register the
device as a behavior by adding a pointer to it to a memory section.

Added zmk_behavior_get_binding(), which works like device_get_binding()
except that it only searches the devices that have been registered as
behaviors. This ensures that behaviors cannot have name collisions with
other devices defined by the SoC, which will be important when we remove
the label property from behaviors so they are given their node names.

As an added benefit, this is faster since it searches a smaller list.
Some basic benchmark code I wrote indicates it takes 30-70% as long,
depending on where the behavior is in the list and whether the name
string is an exact pointer match.

From now on, behaviors should use BEHAVIOR_*_DEFINe() instead of
DEVICE_*_DEFINE(), and any code that looks up a behavior by name should
use zmk_behavior_get_binding() instead of device_get_binding().
2023-12-04 20:06:54 -06:00
Alessandro Bortolin
4e55c5f6e9 feat: handle LED indicators report 2023-11-27 16:03:18 -08:00
Alexander Krikun
d7d9eed317 feat(mouse): Initial mouse keys support.
* Add HID report/descriptor for a new report with mouse buttons,
  and x/y/wheel deltas.
* New mouse key press behavior for press/release of mouse keys.
* Add constants for HID main item values (e.g. data/array/absolute)
* Define and use constants for our HID report IDs.
2023-11-15 11:16:59 -08:00
Joel Spadin
b17d896c5c fix: Address review comments 2023-10-02 22:03:08 -07:00
Peter Johanson
690bc1bb44 refactor: Move drivers into properly module.
* Align our driver module layout to properly match Zephyr conventions,
  allowing proper CMake setup to amend the library for each type of driver.
2023-09-16 11:52:40 -07:00
Xudong Zheng
9a963abfc8 refactor: use low priority workqueue for underglow and battery reporting
Blocking operations on the high priority system workqueue may result in
deadlocks, particularly when Bluetooth is in use.
2023-07-24 17:04:51 -07:00
Peter Johanson
805dd4a53b feat(behaviors): Support parameterized macros.
* Add two new compatibles for macros that
  take one or two parameters when bound in
  a keymap.
* Use `&macro_param_1to1`, `&macro_param_1to2`, `&macro_param_2to1`,
  and `&macro_param_2to2` control entries in the bindings for the macro
  to have the next binding entry have it's values substituted.

Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
2023-06-20 11:19:28 -06:00
Peter Johanson
d781ec795b refactor(bluetooth): Add battery reporting config.
* Add dedicated battery reporting Kconfig that is `imply`d by
  enabling ZMK_BLE.
2023-06-18 20:45:06 -06:00
Nick Conway
3db163aa2c feat(behaviors): Add reusable sensor behaviors.
* Add new sensor behaviors that either take full bindings
  add definition, or accept parameters when bound in the
  keymap.
* Remove existing hard-coded key press sensor behavior
  and instead leverage new generic sensor behaviors to
  achieve the same functionality.

Co-authored-by: nick@conway.dev
2023-04-21 21:13:31 -07:00
Okke Formsma
a61eac9139
fix(behaviors): make tap dances work on a combo
* Tap dance event handler goes after combos
* Add test
2022-11-01 15:13:19 -05:00
Peter Johanson
532c4b9267 refactor(build): Fixes for config/overlay loading.
* Move to ZephyrBuildConfig package based on Zephyr best practices.
* Support multiple shields properly, e.g. -DSHIELD="foo bar", which
  allows using existing upstream shields like `ssd1306_128x64` along
  with another ZMK shield.
* Properly *add* the "ZMK config" .conf file to the conf file list,
  so that existing board .conf files in `app/boards/<board>.conf` are
  properly honored still. Needed for overrides to usptream boards when
  combined with a local `<shield>.conf` file.
2022-06-04 00:44:13 -04:00
Caleb Goates
0d5bb100ba feat(behavior): Add key toggle 2022-06-03 00:04:41 -04:00
Peter Johanson
4f503246a3 refactor(split): cmake split clean up.
* Cleaner cmake setup for split build.
2022-05-29 19:18:09 -04:00
Peter Johanson
6539b3ae25 refactor(split): Clean up Kconfig organization.
* Seperated configs for split role (central/peripheral)
  and transport (BLE only for now).
* Split the configs to align on structure.
2022-05-29 19:18:09 -04:00
Peter Johanson
16ab6df18d feat(display): Add new peripheral status/display
* Add new API/status to track state of the
  peripheral connection to the central.
* Add new peripheral status widget for displaying
  the current status of the connection to
  the central.
2022-05-17 13:09:21 -04:00
Peter Johanson
0a40f922b5 refactor(split): Seperate peripheral BLE handling.
* Move foundational BLE code for split
  peripherals to a dedicated file to avoid
  tons of conditionals and awkward code.
2022-05-17 13:09:21 -04:00
Peter Johanson
40cd8da743 fix(usb): Split HID from core USB, logging fix.
* Split core USB init from USB HID init.
* Tweak logging to avoid "log loop" causing
  spurious buffer messages on startup.
2022-04-13 13:07:59 -04:00
Peter Johanson
79ab60dfe5 refactor: Move to new PM API/Kconfig settings. 2022-04-03 00:10:29 -04:00
Peter Johanson
6287819fcc refactor: Move to USB_DEVICE_STACK symbol.
See: https://docs.zephyrproject.org/latest/releases/release-notes-2.7.html#changes-in-this-release
2022-04-03 00:10:29 -04:00
Peter Johanson
3a6a249ad0 feat(behaviors): Add macro support.
* Fine grainted press/release/tap actions.
* TIming between actions can be controlled.
* Processed async, to avoid blocking.
2022-03-23 23:42:54 -04:00
Kurtis Lew
32ebe2cfb5
feat(behaviors): Add Tap-Dance behavior 2022-03-16 01:08:42 -04:00
Alessandro Bortolin
85b2d30bd5 feat(lighting): add backlight behavior 2022-02-05 23:40:18 -05:00
Peter Johanson
7430750428 refactor(splits): Minor cleanups to periph invocation
* Add strlcpy from public domain version.
* Leverage strlcpy to detect truncation of behavior dev strs, and log.
* Use `offsetof` for cleaner detection on peripheral side.
2022-01-31 23:03:34 -05:00
Pete Johanson
47f873b038 feature(split): behavior locality support.
* GATT characteristic allowing passng data + behavior
  label to invoke the behavior on the peripheral side.
* Behaviors have a locality setting to specify where they run.
* Build reset/power/RGB on peripheral.
2022-01-31 23:03:34 -05:00
Peter Johanson
70bb7c9334 feat(behaviors): &key_repeat behavior + tests.
* Add new `&key_repeat` behavior that captures and re-sends
  the most recently triggered keycode.

Closes: #853
2022-01-30 22:47:34 -05:00
Peter Johanson
54dabffd0d feat(behaviors): Add caps word (&caps_word).
* Add new `&caps_word` behavior that acts like caps lock, but
  releases automatically when any "break" keycode is pressed.
2021-11-28 22:41:35 -05:00
Jonathan Rascher
e9140b2da9 feat(conditional-layers): Implement feature
This is a generalization of the existing concept of tri-layer support
that's already well known. Essentially, a conditional-layer
configuration activates a particular layer (the then-layer) when one or
more other layers (the if-layers) are activated.

This is commonly used on ortho keyboards to activate a third "adjust"
layer while the primary two layers ("lower" and "raise") are active.
2021-11-15 05:49:23 -05:00
Peter Johanson
d05d7ec2d2 feat(endpoints): Add endpoint select changed event. 2021-08-03 00:19:05 -04:00
Ally Parker
a4aaa73f06 feat: Add WPM calculator and display widget 2021-01-23 18:38:31 -05:00
Okke Formsma
5eeb310b2f feat(grave-escape): implement grave-escape
closes #85
2021-01-22 19:27:18 -05:00