Removal of bootmagic lite terminology (#22979)

This commit is contained in:
Joel Challis 2024-02-17 12:27:34 +00:00 committed by GitHub
parent 5383335717
commit e2dbe39b94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 103 additions and 78 deletions

View File

@ -36,10 +36,10 @@
"BACKLIGHT_DEFAULT_LEVEL": {"info_key": "backlight.default.brightness", "value_type": "int"},
// Bootmagic
"BOOTMAGIC_LITE_COLUMN": {"info_key": "bootmagic.matrix.1", "value_type": "int"},
"BOOTMAGIC_LITE_COLUMN_RIGHT": {"info_key": "split.bootmagic.matrix.1", "value_type": "int"},
"BOOTMAGIC_LITE_ROW": {"info_key": "bootmagic.matrix.0", "value_type": "int"},
"BOOTMAGIC_LITE_ROW_RIGHT": {"info_key": "split.bootmagic.matrix.0", "value_type": "int"},
"BOOTMAGIC_COLUMN": {"info_key": "bootmagic.matrix.1", "value_type": "int"},
"BOOTMAGIC_COLUMN_RIGHT": {"info_key": "split.bootmagic.matrix.1", "value_type": "int"},
"BOOTMAGIC_ROW": {"info_key": "bootmagic.matrix.0", "value_type": "int"},
"BOOTMAGIC_ROW_RIGHT": {"info_key": "split.bootmagic.matrix.0", "value_type": "int"},
// Caps Word
"BOTH_SHIFTS_TURNS_ON_CAPS_WORD": {"info_key": "caps_word.both_shifts_turns_on", "value_type": "flag"},

View File

@ -1,8 +1,8 @@
# Bootmagic Lite :id=bootmagic-lite
# Bootmagic :id=bootmagic
The Bootmagic Lite feature that only handles jumping into the bootloader. This is great for boards that don't have a physical reset button, giving you a way to jump into the bootloader
The Bootmagic feature that only handles jumping into the bootloader. This is great for boards that don't have a physical reset button, giving you a way to jump into the bootloader
On some keyboards Bootmagic Lite is disabled by default. If this is the case, it must be explicitly enabled in your `rules.mk` with:
On some keyboards Bootmagic is disabled by default. If this is the case, it must be explicitly enabled in your `rules.mk` with:
```make
BOOTMAGIC_ENABLE = yes
@ -11,15 +11,15 @@ BOOTMAGIC_ENABLE = yes
Additionally, you may want to specify which key to use. This is especially useful for keyboards that have unusual matrices. To do so, you need to specify the row and column of the key that you want to use. Add these entries to your `config.h` file:
```c
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 1
#define BOOTMAGIC_ROW 0
#define BOOTMAGIC_COLUMN 1
```
By default, these are set to 0 and 0, which is usually the "ESC" key on a majority of keyboards.
And to trigger the bootloader, you hold this key down when plugging the keyboard in. Just the single key.
!> Using Bootmagic Lite will **always reset** the EEPROM, so you will lose any settings that have been saved.
!> Using Bootmagic will **always reset** the EEPROM, so you will lose any settings that have been saved.
## Split Keyboards
@ -44,35 +44,35 @@ When [handedness](feature_split_keyboard.md#setting-handedness) is predetermined
}
```
If you pick the top right key for the right half, it is `R05` on the top layout. Within the key matrix below, `R05` is located on row 4 columnn 4. To use that key as the right half's Bootmagic Lite trigger, add these entries to your `config.h` file:
If you pick the top right key for the right half, it is `R05` on the top layout. Within the key matrix below, `R05` is located on row 4 columnn 4. To use that key as the right half's Bootmagic trigger, add these entries to your `config.h` file:
```c
#define BOOTMAGIC_LITE_ROW_RIGHT 4
#define BOOTMAGIC_LITE_COLUMN_RIGHT 4
#define BOOTMAGIC_ROW_RIGHT 4
#define BOOTMAGIC_COLUMN_RIGHT 4
```
?> These values are not set by default.
## Advanced Bootmagic Lite
## Advanced Bootmagic
The `bootmagic_lite` function is defined weakly, so that you can replace this in your code, if you need. A great example of this is the Zeal60 boards that have some additional handling needed.
The `bootmagic_scan` function is defined weakly, so that you can replace this in your code, if you need. A great example of this is the Zeal60 boards that have some additional handling needed.
To replace the function, all you need to do is add something like this to your code:
```c
void bootmagic_lite(void) {
void bootmagic_scan(void) {
matrix_scan();
wait_ms(DEBOUNCE * 2);
matrix_scan();
if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
if (matrix_get_row(BOOTMAGIC_ROW) & (1 << BOOTMAGIC_COLUMN)) {
// Jump to bootloader.
bootloader_jump();
}
}
```
You can define additional logic here. For instance, resetting the EEPROM or requiring additional keys to be pressed to trigger Bootmagic Lite. Keep in mind that `bootmagic_lite` is called before a majority of features are initialized in the firmware.
You can define additional logic here. For instance, resetting the EEPROM or requiring additional keys to be pressed to trigger Bootmagic. Keep in mind that `bootmagic_scan` is called before a majority of features are initialized in the firmware.
## Addenda

View File

@ -139,8 +139,8 @@ BOOTMAGIC_ENABLE = lite
さらに、どのキーを使うかを指定したほうが良いかもしれません。これは普通ではないマトリックスを持つキーボードで特に便利です。そのためには、使いたいキーの行と列を指定する必要があります。`config.h` ファイルにこれらのエントリを追加します:
```c
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 1
#define BOOTMAGIC_ROW 0
#define BOOTMAGIC_COLUMN 1
```
デフォルトでは、これらは 0 と 0 に設定されます。これは通常はほとんどのキーボードで "ESC" キーです。
@ -154,8 +154,8 @@ BOOTMAGIC_ENABLE = lite
`SPLIT_HAND_PIN` のようなオプションで、左右の設定があらかじめ決められている場合は、キーボードの左右で別のキーを設定する必要があるかもしれません。これを行うには、`config.h` ファイルに以下のエントリを追加します。
```c
#define BOOTMAGIC_LITE_ROW_RIGHT 4
#define BOOTMAGIC_LITE_COLUMN_RIGHT 1
#define BOOTMAGIC_ROW_RIGHT 4
#define BOOTMAGIC_COLUMN_RIGHT 1
```
デフォルトでは、これらの値は設定されていません。
@ -172,7 +172,7 @@ void bootmagic_lite(void) {
wait_ms(DEBOUNCE * 2);
matrix_scan();
if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
if (matrix_get_row(BOOTMAGIC_ROW) & (1 << BOOTMAGIC_COLUMN)) {
// ブートローダにジャンプする。
bootloader_jump();
}

View File

@ -16,18 +16,18 @@
#pragma once
#ifndef BOOTMAGIC_LITE_ROW
# define BOOTMAGIC_LITE_ROW 0
#ifndef BOOTMAGIC_ROW
# define BOOTMAGIC_ROW 0
#endif
#ifndef BOOTMAGIC_LITE_COLUMN
# define BOOTMAGIC_LITE_COLUMN 1
#ifndef BOOTMAGIC_COLUMN
# define BOOTMAGIC_COLUMN 1
#endif
#ifndef BOOTMAGIC_LITE_ROW_RIGHT
# define BOOTMAGIC_LITE_ROW_RIGHT 4
#ifndef BOOTMAGIC_ROW_RIGHT
# define BOOTMAGIC_ROW_RIGHT 4
#endif
#ifndef BOOTMAGIC_LITE_COLUMN_RIGHT
# define BOOTMAGIC_LITE_COLUMN_RIGHT 1
#ifndef BOOTMAGIC_COLUMN_RIGHT
# define BOOTMAGIC_COLUMN_RIGHT 1
#endif
#ifdef RGBLIGHT_ENABLE

View File

@ -24,7 +24,7 @@ void matrix_scan_sub_kb(void) {
}
}
__attribute__((weak)) void bootmagic_lite(void) {
__attribute__((weak)) void bootmagic_scan(void) {
// We need multiple scans because debouncing can't be turned off.
matrix_scan();
#if defined(DEBOUNCE) && DEBOUNCE > 0
@ -34,13 +34,13 @@ __attribute__((weak)) void bootmagic_lite(void) {
#endif
matrix_scan();
uint8_t row = BOOTMAGIC_LITE_ROW;
uint8_t col = BOOTMAGIC_LITE_COLUMN;
uint8_t row = BOOTMAGIC_ROW;
uint8_t col = BOOTMAGIC_COLUMN;
#if defined(SPLIT_KEYBOARD) && defined(BOOTMAGIC_LITE_ROW_RIGHT) && defined(BOOTMAGIC_LITE_COLUMN_RIGHT)
#if defined(SPLIT_KEYBOARD) && defined(BOOTMAGIC_ROW_RIGHT) && defined(BOOTMAGIC_COLUMN_RIGHT)
if (!is_keyboard_left()) {
row = BOOTMAGIC_LITE_ROW_RIGHT;
col = BOOTMAGIC_LITE_COLUMN_RIGHT;
row = BOOTMAGIC_ROW_RIGHT;
col = BOOTMAGIC_COLUMN_RIGHT;
}
#endif

View File

@ -2,18 +2,18 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#ifndef BOOTMAGIC_LITE_ROW
# define BOOTMAGIC_LITE_ROW 0
#ifndef BOOTMAGIC_ROW
# define BOOTMAGIC_ROW 0
#endif
#ifndef BOOTMAGIC_LITE_COLUMN
# define BOOTMAGIC_LITE_COLUMN 1
#ifndef BOOTMAGIC_COLUMN
# define BOOTMAGIC_COLUMN 1
#endif
#ifndef BOOTMAGIC_LITE_ROW_RIGHT
# define BOOTMAGIC_LITE_ROW_RIGHT 4
#ifndef BOOTMAGIC_ROW_RIGHT
# define BOOTMAGIC_ROW_RIGHT 4
#endif
#ifndef BOOTMAGIC_LITE_COLUMN_RIGHT
# define BOOTMAGIC_LITE_COLUMN_RIGHT 1
#ifndef BOOTMAGIC_COLUMN_RIGHT
# define BOOTMAGIC_COLUMN_RIGHT 1
#endif
#ifdef RGBLIGHT_ENABLE

View File

@ -7,9 +7,9 @@
// Top left for left side is default in core
// Top right for right side
#ifndef BOOTMAGIC_LITE_ROW_RIGHT
# define BOOTMAGIC_LITE_ROW_RIGHT 5
#ifndef BOOTMAGIC_ROW_RIGHT
# define BOOTMAGIC_ROW_RIGHT 5
#endif
#ifndef BOOTMAGIC_LITE_COLUMN_RIGHT
# define BOOTMAGIC_LITE_COLUMN_RIGHT 0
#ifndef BOOTMAGIC_COLUMN_RIGHT
# define BOOTMAGIC_COLUMN_RIGHT 0
#endif

View File

@ -18,5 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
// Alternate boot pins for accessing the bootloader,
// since the boot switch is blocked by the OLED.
#define BOOTMAGIC_LITE_ROW 1
#define BOOTMAGIC_LITE_COLUMN 2
#define BOOTMAGIC_ROW 1
#define BOOTMAGIC_COLUMN 2

View File

@ -2,7 +2,7 @@
#include "usb_main.h"
#include "phoenix.h"
void bootmagic_lite(void) {
void bootmagic_scan(void) {
matrix_scan();
wait_ms(5);
matrix_scan();

View File

@ -20,44 +20,54 @@
#include "eeconfig.h"
#include "bootloader.h"
#ifndef BOOTMAGIC_DEBOUNCE
# if defined(DEBOUNCE) && DEBOUNCE > 0
# define BOOTMAGIC_DEBOUNCE (DEBOUNCE * 2)
# else
# define BOOTMAGIC_DEBOUNCE 30
# endif
#endif
/** \brief Reset eeprom
*
* ...just incase someone wants to only change the eeprom behaviour
*/
__attribute__((weak)) void bootmagic_lite_reset_eeprom(void) {
__attribute__((weak)) void bootmagic_reset_eeprom(void) {
eeconfig_disable();
}
/** \brief The lite version of TMK's bootmagic based on Wilba.
*
* 100% less potential for accidentally making the keyboard do stupid things.
/** \brief Decide reboot based on current matrix state
*/
__attribute__((weak)) void bootmagic_lite(void) {
// We need multiple scans because debouncing can't be turned off.
matrix_scan();
#if defined(DEBOUNCE) && DEBOUNCE > 0
wait_ms(DEBOUNCE * 2);
#else
wait_ms(30);
#endif
matrix_scan();
__attribute__((weak)) bool bootmagic_should_reset(void) {
// If the configured key (commonly Esc) is held down on power up,
// reset the EEPROM valid state and jump to bootloader.
// This isn't very generalized, but we need something that doesn't
// rely on user's keymaps in firmware or EEPROM.
uint8_t row = BOOTMAGIC_LITE_ROW;
uint8_t col = BOOTMAGIC_LITE_COLUMN;
uint8_t row = BOOTMAGIC_ROW;
uint8_t col = BOOTMAGIC_COLUMN;
#if defined(SPLIT_KEYBOARD) && defined(BOOTMAGIC_LITE_ROW_RIGHT) && defined(BOOTMAGIC_LITE_COLUMN_RIGHT)
#if defined(SPLIT_KEYBOARD) && defined(BOOTMAGIC_ROW_RIGHT) && defined(BOOTMAGIC_COLUMN_RIGHT)
if (!is_keyboard_left()) {
row = BOOTMAGIC_LITE_ROW_RIGHT;
col = BOOTMAGIC_LITE_COLUMN_RIGHT;
row = BOOTMAGIC_ROW_RIGHT;
col = BOOTMAGIC_COLUMN_RIGHT;
}
#endif
if (matrix_get_row(row) & (1 << col)) {
bootmagic_lite_reset_eeprom();
return matrix_get_row(row) & (1 << col);
}
/** \brief The abridged version of TMK's bootmagic based on Wilba.
*
* 100% less potential for accidentally making the keyboard do stupid things.
*/
__attribute__((weak)) void bootmagic_scan(void) {
// We need multiple scans because debouncing can't be turned off.
matrix_scan();
wait_ms(BOOTMAGIC_DEBOUNCE);
matrix_scan();
if (bootmagic_should_reset()) {
bootmagic_reset_eeprom();
// Jump to bootloader.
bootloader_jump();
@ -65,5 +75,5 @@ __attribute__((weak)) void bootmagic_lite(void) {
}
void bootmagic(void) {
bootmagic_lite();
bootmagic_scan();
}

View File

@ -15,11 +15,26 @@
*/
#pragma once
#ifndef BOOTMAGIC_LITE_COLUMN
# define BOOTMAGIC_LITE_COLUMN 0
// ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef BOOTMAGIC_LITE_ROW
# define BOOTMAGIC_ROW BOOTMAGIC_LITE_ROW
#endif
#ifndef BOOTMAGIC_LITE_ROW
# define BOOTMAGIC_LITE_ROW 0
#ifdef BOOTMAGIC_LITE_COLUMN
# define BOOTMAGIC_COLUMN BOOTMAGIC_LITE_COLUMN
#endif
#ifdef BOOTMAGIC_LITE_ROW_RIGHT
# define BOOTMAGIC_ROW_RIGHT BOOTMAGIC_LITE_ROW_RIGHT
#endif
#ifdef BOOTMAGIC_LITE_COLUMN_RIGHT
# define BOOTMAGIC_COLUMN_RIGHT BOOTMAGIC_LITE_COLUMN_RIGHT
#endif
// ========
#ifndef BOOTMAGIC_COLUMN
# define BOOTMAGIC_COLUMN 0
#endif
#ifndef BOOTMAGIC_ROW
# define BOOTMAGIC_ROW 0
#endif
void bootmagic(void);