diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | common/bootmagic.c | 10 | ||||
| -rw-r--r-- | common/bootmagic.h | 6 | ||||
| -rw-r--r-- | keyboard/hhkb/config.h | 3 |
4 files changed, 20 insertions, 1 deletions
| @@ -124,6 +124,8 @@ Following commands can be also executed with `Magic` + key. In console mode `Mag | |||
| 124 | Boot Magic are executed during boot up time. Press Magic key below then pulgin keyboard cable. | 124 | Boot Magic are executed during boot up time. Press Magic key below then pulgin keyboard cable. |
| 125 | Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles. | 125 | Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles. |
| 126 | 126 | ||
| 127 | To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be pressed along with the following configuration keys. The salt key is configurable in `config.h`. See [common/bootmagic.h](common/bootmagic.h). | ||
| 128 | |||
| 127 | #### General | 129 | #### General |
| 128 | - Skip reading EEPROM to start with default configuration(`ESC`) | 130 | - Skip reading EEPROM to start with default configuration(`ESC`) |
| 129 | - Clear configuration stored in EEPROM to reset configuration(`Backspace`) | 131 | - Clear configuration stored in EEPROM to reset configuration(`Backspace`) |
diff --git a/common/bootmagic.c b/common/bootmagic.c index 11eef3c3c..410dc6836 100644 --- a/common/bootmagic.c +++ b/common/bootmagic.c | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include "bootloader.h" | 5 | #include "bootloader.h" |
| 6 | #include "debug.h" | 6 | #include "debug.h" |
| 7 | #include "keymap.h" | 7 | #include "keymap.h" |
| 8 | #include "action_layer.h" | ||
| 8 | #include "eeconfig.h" | 9 | #include "eeconfig.h" |
| 9 | #include "bootmagic.h" | 10 | #include "bootmagic.h" |
| 10 | 11 | ||
| @@ -94,7 +95,7 @@ void bootmagic(void) | |||
| 94 | } | 95 | } |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | bool bootmagic_scan_keycode(uint8_t keycode) | 98 | static bool scan_keycode(uint8_t keycode) |
| 98 | { | 99 | { |
| 99 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) { | 100 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) { |
| 100 | matrix_row_t matrix_row = matrix_get_row(r); | 101 | matrix_row_t matrix_row = matrix_get_row(r); |
| @@ -108,3 +109,10 @@ bool bootmagic_scan_keycode(uint8_t keycode) | |||
| 108 | } | 109 | } |
| 109 | return false; | 110 | return false; |
| 110 | } | 111 | } |
| 112 | |||
| 113 | bool bootmagic_scan_keycode(uint8_t keycode) | ||
| 114 | { | ||
| 115 | if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false; | ||
| 116 | |||
| 117 | return scan_keycode(keycode); | ||
| 118 | } | ||
diff --git a/common/bootmagic.h b/common/bootmagic.h index 68935e970..2d14b3e76 100644 --- a/common/bootmagic.h +++ b/common/bootmagic.h | |||
| @@ -2,6 +2,12 @@ | |||
| 2 | #define BOOTMAGIC_H | 2 | #define BOOTMAGIC_H |
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | /* bootmagic salt key */ | ||
| 6 | #ifndef BOOTMAGIC_KEY_SALT | ||
| 7 | #define BOOTMAGIC_KEY_SALT KC_SPACE | ||
| 8 | #endif | ||
| 9 | |||
| 10 | /* skip bootmagic and eeconfig */ | ||
| 5 | #ifndef BOOTMAGIC_KEY_SKIP | 11 | #ifndef BOOTMAGIC_KEY_SKIP |
| 6 | #define BOOTMAGIC_KEY_SKIP KC_ESC | 12 | #define BOOTMAGIC_KEY_SKIP KC_ESC |
| 7 | #endif | 13 | #endif |
diff --git a/keyboard/hhkb/config.h b/keyboard/hhkb/config.h index 613e66d13..8c93f97da 100644 --- a/keyboard/hhkb/config.h +++ b/keyboard/hhkb/config.h | |||
| @@ -59,6 +59,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 59 | #define TAPPING_TOGGLE 5 | 59 | #define TAPPING_TOGGLE 5 |
| 60 | 60 | ||
| 61 | 61 | ||
| 62 | /* Boot Magic salt key: Space */ | ||
| 63 | #define BOOTMAGIC_KEY_SALT KC_FN6 | ||
| 64 | |||
| 62 | /* | 65 | /* |
| 63 | * Feature disable options | 66 | * Feature disable options |
| 64 | * These options are also useful to firmware size reduction. | 67 | * These options are also useful to firmware size reduction. |
