mirror of https://github.com/zmkfirmware/zmk.git
fix(bootmagic): Get stuff working on new zephyr
This commit is contained in:
parent
ace0613a21
commit
f97e49f99f
|
|
@ -691,11 +691,6 @@ config ZMK_KEYMAP_SENSORS_DEFAULT_TRIGGERS_PER_ROTATION
|
|||
|
||||
endif # ZMK_KEYMAP_SENSORS
|
||||
|
||||
choice CBPRINTF_IMPLEMENTATION
|
||||
default CBPRINTF_NANO
|
||||
|
||||
endchoice
|
||||
|
||||
DT_COMPAT_ZMK_BOOT_MAGIC_KEY := zmk,boot-magic-key
|
||||
config ZMK_BOOT_MAGIC_KEY
|
||||
bool "Enable actions when keys are held at boot"
|
||||
|
|
|
|||
|
|
@ -11,9 +11,10 @@
|
|||
|
||||
/**
|
||||
* Reboot the system.
|
||||
* @param type A ZMK_RESET_* value indicating how to reboot.
|
||||
* @param type If CONFIG_RETENTION_BOOT_MODE is set: A BOOT_MODE_TYPE_* value indicating which type
|
||||
* of reboot. Otherwise, A ZMK_RESET_* value indicating how to reboot.
|
||||
*/
|
||||
FUNC_NORETURN void zmk_reset(int type);
|
||||
void zmk_reset(int type);
|
||||
|
||||
/**
|
||||
* Clear all persistent settings.
|
||||
|
|
|
|||
|
|
@ -36,24 +36,11 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
|||
const struct device *dev = zmk_behavior_get_binding(binding->behavior_dev);
|
||||
const struct behavior_reset_config *cfg = dev->config;
|
||||
|
||||
<<<<<<< HEAD
|
||||
#if IS_ENABLED(CONFIG_RETENTION_BOOT_MODE)
|
||||
int ret = bootmode_set(cfg->boot_mode);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Failed to set the bootloader mode (%d)", ret);
|
||||
return ZMK_BEHAVIOR_OPAQUE;
|
||||
}
|
||||
|
||||
sys_reboot(SYS_REBOOT_WARM);
|
||||
zmk_reset(cfg->boot_mode);
|
||||
#else
|
||||
// See
|
||||
// https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/d6b28e66053eea467166f44875e3c7ec741cb471/src/main.c#L107
|
||||
sys_reboot(cfg->type);
|
||||
#endif /* IS_ENABLED(CONFIG_RETENTION_BOOT_MODE) */
|
||||
|
||||
=======
|
||||
zmk_reset(cfg->type);
|
||||
>>>>>>> 1d73fc26 (refactor: Move reset logic to a new function)
|
||||
#endif /* IS_ENABLED(CONFIG_RETENTION_BOOT_MODE) */
|
||||
return ZMK_BEHAVIOR_OPAQUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,12 @@
|
|||
#include <zmk/event_manager.h>
|
||||
#include <zmk/events/position_state_changed.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_RETENTION_BOOT_MODE)
|
||||
|
||||
#include <zephyr/retention/bootmode.h>
|
||||
|
||||
#endif /* IS_ENABLED(CONFIG_RETENTION_BOOT_MODE) */
|
||||
|
||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
struct boot_key_config {
|
||||
|
|
@ -51,11 +57,19 @@ static void trigger_boot_key(const struct boot_key_config *config) {
|
|||
|
||||
if (config->jump_to_bootloader) {
|
||||
LOG_INF("Boot key: jumping to bootloader");
|
||||
#if IS_ENABLED(CONFIG_RETENTION_BOOT_MODE)
|
||||
zmk_reset(BOOT_MODE_TYPE_BOOTLOADER);
|
||||
#else
|
||||
zmk_reset(ZMK_RESET_BOOTLOADER);
|
||||
#endif /* IS_ENABLED(CONFIG_RETENTION_BOOT_MODE) */
|
||||
} else if (config->reset_settings) {
|
||||
// If resetting settings but not jumping to bootloader, we need to reboot
|
||||
// to ensure all subsystems are properly reset.
|
||||
#if IS_ENABLED(CONFIG_RETENTION_BOOT_MODE)
|
||||
zmk_reset(BOOT_MODE_TYPE_NORMAL);
|
||||
#else
|
||||
zmk_reset(ZMK_RESET_WARM);
|
||||
#endif /* IS_ENABLED(CONFIG_RETENTION_BOOT_MODE) */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,27 @@
|
|||
#endif
|
||||
#include <zmk/reset.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_RETENTION_BOOT_MODE)
|
||||
|
||||
#include <zephyr/retention/bootmode.h>
|
||||
|
||||
#endif /* IS_ENABLED(CONFIG_RETENTION_BOOT_MODE) */
|
||||
|
||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
// AdaFruit nrf52 Bootloader Specific. See
|
||||
// https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/d6b28e66053eea467166f44875e3c7ec741cb471/src/main.c#L107
|
||||
#define ADAFRUIT_MAGIC_UF2 0x57
|
||||
|
||||
FUNC_NORETURN void zmk_reset(int type) {
|
||||
void zmk_reset(int type) {
|
||||
#if IS_ENABLED(CONFIG_RETENTION_BOOT_MODE)
|
||||
int ret = bootmode_set(type);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Failed to set the bootloader mode (%d)", ret);
|
||||
} else {
|
||||
sys_reboot(SYS_REBOOT_WARM);
|
||||
}
|
||||
#else
|
||||
switch (type) {
|
||||
case ZMK_RESET_WARM:
|
||||
sys_reboot(SYS_REBOOT_WARM);
|
||||
|
|
@ -38,6 +52,7 @@ FUNC_NORETURN void zmk_reset(int type) {
|
|||
LOG_ERR("Unknown reset type %d", type);
|
||||
break;
|
||||
}
|
||||
#endif /* IS_ENABLED(CONFIG_RETENTION_BOOT_MODE) */
|
||||
}
|
||||
|
||||
void zmk_reset_settings(void) {
|
||||
|
|
@ -45,4 +60,4 @@ void zmk_reset_settings(void) {
|
|||
zmk_ble_unpair_all();
|
||||
#endif
|
||||
// TODO: clear settings for all subsystems.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Definition file: [zmk/app/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/
|
|||
### General
|
||||
|
||||
| Config | Type | Description | Default |
|
||||
|----------------------------------------|--------|---------------------------------------------------------------------------------------|---------|
|
||||
| -------------------------------------- | ------ | ------------------------------------------------------------------------------------- | ------- |
|
||||
| `CONFIG_ZMK_KEYBOARD_NAME` | string | The name of the keyboard (max 16 characters) | |
|
||||
| `CONFIG_ZMK_BOOT_MAGIC_KEY_TIMEOUT_MS` | int | Milliseconds to watch for [boot magic keys](../features/boot-magic-key.md) at startup | 500 |
|
||||
| `CONFIG_ZMK_WPM` | bool | Enable calculating words per minute | n |
|
||||
|
|
|
|||
|
|
@ -1,95 +1,11 @@
|
|||
module.exports = {
|
||||
docs: {
|
||||
"Getting Started": [
|
||||
"intro",
|
||||
"hardware",
|
||||
"faq",
|
||||
"user-setup",
|
||||
"customization",
|
||||
"troubleshooting",
|
||||
],
|
||||
Features: [
|
||||
"features/keymaps",
|
||||
"features/bluetooth",
|
||||
"features/boot-magic-key",
|
||||
"features/combos",
|
||||
"features/conditional-layers",
|
||||
"features/debouncing",
|
||||
"features/displays",
|
||||
"features/encoders",
|
||||
"features/underglow",
|
||||
"features/backlight",
|
||||
"features/battery",
|
||||
"features/beta-testing",
|
||||
],
|
||||
Behaviors: [
|
||||
"behaviors/key-press",
|
||||
"behaviors/layers",
|
||||
"behaviors/misc",
|
||||
"behaviors/hold-tap",
|
||||
"behaviors/mod-tap",
|
||||
"behaviors/mod-morph",
|
||||
"behaviors/macros",
|
||||
"behaviors/key-toggle",
|
||||
"behaviors/sticky-key",
|
||||
"behaviors/sticky-layer",
|
||||
"behaviors/tap-dance",
|
||||
"behaviors/caps-word",
|
||||
"behaviors/key-repeat",
|
||||
"behaviors/sensor-rotate",
|
||||
"behaviors/reset",
|
||||
"behaviors/bluetooth",
|
||||
"behaviors/outputs",
|
||||
"behaviors/underglow",
|
||||
"behaviors/backlight",
|
||||
"behaviors/power",
|
||||
],
|
||||
Codes: [
|
||||
"codes/index",
|
||||
"codes/keyboard-keypad",
|
||||
"codes/modifiers",
|
||||
"codes/editing",
|
||||
"codes/media",
|
||||
"codes/applications",
|
||||
"codes/input-assist",
|
||||
"codes/power",
|
||||
"codes/keymap-upgrader",
|
||||
],
|
||||
Configuration: [
|
||||
"config/index",
|
||||
"config/backlight",
|
||||
"config/battery",
|
||||
"config/behaviors",
|
||||
"config/bluetooth",
|
||||
"config/combos",
|
||||
"config/displays",
|
||||
"config/encoders",
|
||||
"config/keymap",
|
||||
"config/kscan",
|
||||
"config/power",
|
||||
"config/underglow",
|
||||
"config/system",
|
||||
],
|
||||
Development: [
|
||||
"development/clean-room",
|
||||
"development/pre-commit",
|
||||
"development/documentation",
|
||||
"development/setup",
|
||||
"development/build-flash",
|
||||
"development/boards-shields-keymaps",
|
||||
"development/posix-board",
|
||||
"development/tests",
|
||||
"development/usb-logging",
|
||||
"development/ide-integration",
|
||||
{
|
||||
type: "category",
|
||||
label: "Guides",
|
||||
collapsed: false,
|
||||
items: [
|
||||
"development/new-shield",
|
||||
"development/hardware-metadata-files",
|
||||
"development/new-behavior",
|
||||
],
|
||||
docs: [
|
||||
{
|
||||
type: "category",
|
||||
label: "Getting Started",
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "intro",
|
||||
},
|
||||
collapsed: false,
|
||||
items: [
|
||||
|
|
|
|||
Loading…
Reference in New Issue