瀏覽代碼

Add bootmagic salt key to avoid accidental configuration

led_matrix
tmk 10 年之前
父節點
當前提交
05225dd9d8
共有 4 個文件被更改,包括 20 次插入1 次删除
  1. 2
    0
      README.md
  2. 9
    1
      common/bootmagic.c
  3. 6
    0
      common/bootmagic.h
  4. 3
    0
      keyboard/hhkb/config.h

+ 2
- 0
README.md 查看文件

Boot Magic are executed during boot up time. Press Magic key below then pulgin keyboard cable. Boot Magic are executed during boot up time. Press Magic key below then pulgin keyboard cable.
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. 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.


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).

#### General #### General
- Skip reading EEPROM to start with default configuration(`ESC`) - Skip reading EEPROM to start with default configuration(`ESC`)
- Clear configuration stored in EEPROM to reset configuration(`Backspace`) - Clear configuration stored in EEPROM to reset configuration(`Backspace`)

+ 9
- 1
common/bootmagic.c 查看文件

#include "bootloader.h" #include "bootloader.h"
#include "debug.h" #include "debug.h"
#include "keymap.h" #include "keymap.h"
#include "action_layer.h"
#include "eeconfig.h" #include "eeconfig.h"
#include "bootmagic.h" #include "bootmagic.h"


} }
} }


bool bootmagic_scan_keycode(uint8_t keycode)
static bool scan_keycode(uint8_t keycode)
{ {
for (uint8_t r = 0; r < MATRIX_ROWS; r++) { for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
matrix_row_t matrix_row = matrix_get_row(r); matrix_row_t matrix_row = matrix_get_row(r);
} }
return false; return false;
} }

bool bootmagic_scan_keycode(uint8_t keycode)
{
if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false;

return scan_keycode(keycode);
}

+ 6
- 0
common/bootmagic.h 查看文件

#define BOOTMAGIC_H #define BOOTMAGIC_H




/* bootmagic salt key */
#ifndef BOOTMAGIC_KEY_SALT
#define BOOTMAGIC_KEY_SALT KC_SPACE
#endif

/* skip bootmagic and eeconfig */
#ifndef BOOTMAGIC_KEY_SKIP #ifndef BOOTMAGIC_KEY_SKIP
#define BOOTMAGIC_KEY_SKIP KC_ESC #define BOOTMAGIC_KEY_SKIP KC_ESC
#endif #endif

+ 3
- 0
keyboard/hhkb/config.h 查看文件

#define TAPPING_TOGGLE 5 #define TAPPING_TOGGLE 5




/* Boot Magic salt key: Space */
#define BOOTMAGIC_KEY_SALT KC_FN6

/* /*
* Feature disable options * Feature disable options
* These options are also useful to firmware size reduction. * These options are also useful to firmware size reduction.