Newer Zephyr uses a different Kconfig value to control buffers for GATT
client discovery, so adjust our defaults to bump the correct value
Fixes: #3156
refactor(core): Adjust our approach for upstream Zephyr boards
Move to using proper HWMv2 board extensions
https://docs.zephyrproject.org/4.1.0/hardware/porting/board_porting.html#board-extensions
for extending upstream Zephyr boards for use with ZMK. With this change,
using upstream Zephyr board IDs directly, e.g. `seeeduino_xiao` will be
stock versions as found upstream. To use a board variant that is tuned
for ZMK use, use the `zmk` variant, e.g. `seeeduino_xiao//zmk` which is
shorthand for `seeeduino_xiao/samd21g18a/zmk`.
refactor(boards): Move to ZMK specific variants for the nRFMicro board
For consistency, adjust the nRFMicro board definition to offer a
"vanilla" Zephyr board, and then ZMK variants, e.g.
`nrfmicro/nrf52840/zmk`.
refactor(boards): Move to ZMK specific variant for the bluemicro840 board
For consistency, adjust the bluemicro840 board definition to offer a
"vanilla" Zephyr board, and then ZMK variant, e.g. `bluemicro840//zmk`.
refactor(boards): Make tofu65 to ZMK variant by default
Make the standard Tofu65 board ID be `tofu65/rp2040/zmk` or
`tofu65//zmk` by shorthand.
refactor(boards): Move BDN9 to ZMK variant by default
Make the standard BDN9 board ID be `bdn9/stm32f072xb/zmk` or
`bdn9//zmk` by shorthand.
refactor(boards): Move Puchi BLE to ZMK variant by default
Make the standard Puchi BLE board ID be `puchi_ble/nrf52840/zmk` or
`puchi_ble//zmk` by shorthand.
refactor(boards): Move Adv360 Pro to ZMK variant by default
Make the standard Adv360 Pro board ID be `adv360pro_left/nrf52840/zmk` or
`adv360pro_left//zmk` by shorthand and for right as well.
refactor(boards): Move nRF52840 M2 to ZMK variant by default
Make the standard nRF52840 M2 board ID be `nrf52840_m2/nrf52840/zmk` or
`nrf52840_m2//zmk` by shorthand.
refactor(boards): Move Pillbug to ZMK variant by default
Make the standard Pillbug board ID be `pillbug/nrf52840/zmk` or
`pillbug//zmk` by shorthand.
refactor(boards): Move s40nc to ZMK variant by default
Make the standard s40nc board ID be `s40nc/nrf52840/zmk` or
`s40nc//zmk` by shorthand.
refactor(boards): Move nice!60 to ZMK variant by default
Make the standard nice!60 board ID be `nice60/nrf52840/zmk` or
`nice60//zmk` by shorthand.
refactor(boards): Move planck to ZMK variant by default
Make the standard planck board ID be `planck/stm32f303xc/zmk` or
`planck//zmk` by shorthand.
refactor(boards): Move preonic to ZMK variant by default
Make the standard preonic board ID be `preonic/stm32f303xc/zmk` or
`preonic//zmk` by shorthand.
refactor(boards): Move ferris to ZMK variant by default
Make the standard ferris board ID be `ferris/stm32f072xb/zmk` or
`ferris//zmk` by shorthand.
refactor(boards): Move Proton-C to ZMK variant by default
Make the standard Proton-C board ID be `proton_c/stm32f303xc/zmk` or
`proton_c//zmk` by shorthand.
refactor(boards): Move Corneish Zen to ZMK variant by default
Make the standard Corneish Zen board ID be `corneish_zen_left/nrf52840/zmk` or
`corneish_zen_left//zmk` by shorthand and for right as well.
refactor(boards): Move nice!nano to ZMK variant by default
Make the standard nice!nano board ID be `nice_nano/nrf52840/zmk` or
`nice_nano//zmk` by shorthand.
refactor(boards): Move mikoto to ZMK variant by default
Make the standard mikoto board ID be `mikoto/nrf52840/zmk` or
`mikoto//zmk` by shorthand.
refactor(boards): Move Polarity Works boards to ZMK variants
Make the standard Polarity Works board IDs be `zmk` variants.
doc: Update docs/blog post to reference ZMK variants
* Update Zephyr 4.1 blog post to mention ZMK variants
* Add note to hardware support page about variants
docs: Fix up shield board overlays for new board IDs
Adjust our documentation to properly use the correct qualified board
overlay file names that match our new board conventions.
feat(endpoints): add "no endpoint" value
This adds ZMK_TRANSPORT_NONE, which can be set as the preferred
endpoint transport if you wish to prevent the keyboard from sending any
output. More usefully, it also is used to indicate that the preferred
endpoint is not available and it could not fall back to an available
one. To go along with this, many endpoint functions are renamed for
consistency, and a few new functions are added:
- zmk_endpoint_get_preferred_transport() returns the value that was set
with zmk_endpoint_set_preferred_transport().
- zmk_endpoint_get_preferred() returns the endpoint that will be used
if it is available. This endpoint always has the same transport as
zmk_endpoint_get_preferred_transport().
- zmk_endpoint_is_connected() is a shortcut to check if the keyboard is
actually connected to an endpoint.
This change is based on #2572 but without the option to disable endpoint
fallback. It does refactor code to allow adding that feature later.
fix(endpoints): Add endpoint setting upgrade
Adding ZMK_TRANSPORT_NONE at the start of enum zmk_transport results in
the preferred transport setting no longer representing the same values
when it is saved with earlier firmware and loaded with newer firmware.
To fix this, the "endpoints/preferred" setting is now deprecated and
replaced by "endpoints/preferred2". If the old setting is present, it
is interpreted as the old enum type, upgraded to the new type, and saved
immediately to the new setting. The old setting is then deleted.
To avoid this happening again in the future, enum zmk_transport now has
explicit values assigned to identifier, and a comment is also added to
explain that existing values must not be changed.
fix: Set default transport according to enabled transports
The default value for preferred_transport is now set to USB only if
CONFIG_ZMK_USB is enabled. If not, it falls back to BLE if
CONFIG_ZMK_BLE is enabled, then to "none" if nothing is enabled.
* fix(docs): Improve link and code highlight contrast
Reset the theme's primary colors to the defaults, since the color of
links was a bit too low contrast in the dark theme. The default primary
color is a very similar but slightly lighter shade of blue.
The background color of highlighted lines in code blocks is also fairly
low contrast, but it needs to be in order to keep the text readable. To
add contrast here, we now add a colored block to the left side of a
highlighted line.
* fix(docs): Improve ZMK setup instructions
This makes several improvements to the instructions for installing and
using ZMK CLI:
- Windows Terminal is also named "Terminal", so reworded the terminal
instructions to not separate Windows from other OSes.
- Specified that Windows Terminal should always be used on Windows, as
on older installations of Windows, the default terminal when opening
PowerShell may be the legacy console host, which may not support some
of the VT sequences used by ZMK CLI.
- Switched from pipx to uv. This eliminates the need for instructions
on installing Python, as uv will automatically install a supported
version of Python if needed.
- Updated the instructions for running "zmk init", as ZMK CLI version
0.4.0 switched from immediately asking for a repo URL to prompting
the user to select between creating a new repo or cloning an existing
one first.
- Since for a new user, having a keymap compile successfully on the
first attempt after modifying it may be the exception rather than the
norm, added a note about error messages in GitHub actions with a link
to the troubleshooting page.
Also added instructions for updating ZMK CLI to the latest version on
the ZMK CLI page.
With the binding referenced to as uint8_t the keymap would be incorrect if more than 256 positions were in use, going to a uint16_t gives large enough headroom to not have to worry
deps: Use hal_stm32 with stm32c0 USB device fixes.
Pull in ZMK fork of hal_stm32 with USB device driver fixes for stm32c0.
feat: Add nBOOT_SEL bit setup for STM32 G0/C0 targets
Newer STM32 C0 and G0 series SoCs do not by default allow use of the
BOOT0 pin/button to enter the bootloader once something has been flash
to the device, which is a change from previous series, and usually not
what's wanted for keyboards running ZMK. To address this, add some
optional, but default initialization code to check the nBOOT_SEL bit and
override it if necessary to ensure BOOT pin/button functionality.
docs: Extract bootloader config into a dedicated page.
Pull the bootloader intergration options out of the system configuration
page into their own dedicated one.
Co-authored-by: Nicolas Munnich <98408764+nmunnich@users.noreply.github.com>
---------
Co-authored-by: Nicolas Munnich <98408764+nmunnich@users.noreply.github.com>
The static mouse_report definition did not initialize the d_scroll_x
field. The zmk_hid_mouse_report_body structure contains five fields
(buttons, d_x, d_y, d_scroll_y, d_scroll_x), but d_scroll_x was left
uninitialized.
Initialize d_scroll_x to 0 to ensure all fields in the mouse report
are properly initialized and avoid potential undefined behavior.
The RX buffer was previously defined as [RX_BUFFER_SIZE/2][2], which
created (RX_BUFFER_SIZE/2) small 2-byte buffers instead of the two
(RX_BUFFER_SIZE/2)-byte buffers required for DMA ping-pong operation.
Update the buffer definition to [2][RX_BUFFER_SIZE/2] and apply the
fix to both the central and peripheral wired split implementations.
This prevents potential DMA RX data corruption when using async UART.
Enable ZMK_BOOTMODE_MAGIC_VALUE_BOOTLOADER_TYPE_ADAFRUIT_NRF52 for
nRF52833, add nrf52833_uf2_boot_mode.dtsi as a copy of the nRF52840 file
for easy inclusion.
Enable retention for all nrfmicro subvariants (as this is the only
in-tree board that uses the nRF52833).
This fixes &bootloader for nRF52833 boards post-4.1 upgrade.
ZMK doesn't use SOF. Disable this to prevent unexpected USB
disconnection. The disconnection is observed under 3 circumstances on a
Linux host:
1. Keyboard just performed a firmware upgrade and USB is kept connected.
2. Keyboard is woken from USB power source and USB is kept connected.
3. Keyboard is connected when host is booting, and when Linux is just
initialized.
Disabling SOF processing will not affect boot protocol switching.
Tested on Makerdiary M60.
Adds support for building the firmware in the config-repo locally via
[act](https://github.com/nektos/act).
Linux example command:
```shell
act --artifact-server-path $PWD/.artifacts
```
MacOS (M2) example command:
```shell
act --artifact-server-path $PWD/.artifacts \
--container-architecture \
linux/amd64 --container-daemon-socket -
This deletes the Bash and PowerShell setup scripts in favor of using
ZMK CLI. The old setup scripts are broken, since the config repo
template uses ZMK version 0.3, while the setup scripts use hardware
metadata from the main branch. ZMK CLI doesn't have this issue, because
it clones the version of ZMK listed in the config repo to get hardware
metadata.
Much of the "Installing ZMK" page has been rewritten to give
instructions for installing ZMK CLI and using it to create and modify
a config repo. The previously-hidden page on ZMK CLI has been added to
the sidebar and repurposed into general documentation for the tool.