diff options
author | tmk <nobody@nowhere> | 2013-06-22 16:14:56 +0900 |
---|---|---|
committer | tmk <nobody@nowhere> | 2013-06-22 16:24:56 +0900 |
commit | 9de9d719527c7a8cac71d0bc49ba1d2d4f63cf06 (patch) | |
tree | 5cfd02ffd53d5be7c40453644558319f75b48fa8 /common/bootmagic.c | |
parent | 2593ae132812414f02e7cf483bb141cd2c78595c (diff) |
Add default layer config to bootmagic
Diffstat (limited to 'common/bootmagic.c')
-rw-r--r-- | common/bootmagic.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/bootmagic.c b/common/bootmagic.c index 716f5d956b..11eef3c3c6 100644 --- a/common/bootmagic.c +++ b/common/bootmagic.c @@ -74,6 +74,24 @@ void bootmagic(void) keymap_config.swap_backslash_backspace = !keymap_config.swap_backslash_backspace; } eeconfig_write_keymap(keymap_config.raw); + + /* default layer */ + uint8_t default_layer = 0; + if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); } + if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) { default_layer |= (1<<1); } + if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) { default_layer |= (1<<2); } + if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) { default_layer |= (1<<3); } + if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) { default_layer |= (1<<4); } + if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) { default_layer |= (1<<5); } + if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) { default_layer |= (1<<6); } + if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) { default_layer |= (1<<7); } + if (default_layer) { + eeconfig_write_default_layer(default_layer); + default_layer_set((uint32_t)default_layer); + } else { + default_layer = eeconfig_read_default_layer(); + default_layer_set((uint32_t)default_layer); + } } bool bootmagic_scan_keycode(uint8_t keycode) |