diff options
author | tmk <nobody@nowhere> | 2013-03-10 19:22:54 +0900 |
---|---|---|
committer | tmk <nobody@nowhere> | 2013-03-10 19:22:54 +0900 |
commit | de8ef18a534163b40e307418b3af603142d5d6b0 (patch) | |
tree | 9f35a4795b40dc6328b9d9385b81460ba47143cb | |
parent | 51050875b7f1dd5216ba46298f95cf3030a36211 (diff) |
Add KEYCONF to eeconfig.c
-rw-r--r-- | common/bootmagic.c | 22 | ||||
-rw-r--r-- | common/bootmagic.h | 40 | ||||
-rw-r--r-- | common/command.c | 4 | ||||
-rw-r--r-- | common/eeconfig.c | 19 | ||||
-rw-r--r-- | common/eeconfig.h | 21 |
5 files changed, 83 insertions, 23 deletions
diff --git a/common/bootmagic.c b/common/bootmagic.c index 31b8ae5e62..46fbc180a4 100644 --- a/common/bootmagic.c +++ b/common/bootmagic.c @@ -27,6 +27,28 @@ void bootmagic(void) if (bootmagic_scan_keycode(BOOTMAGIC_EEPROM_CLEAR_KEY)) { eeconfig_init(); } + + if (bootmagic_scan_keycode(BOOTMAGIC_SWAP_CONTROL_CPASLOCK)) { + eeconfig_write_keyconf(eeconfig_read_keyconf() ^ EECONFIG_KEYCONF_SWAP_CONTROL_CAPSLOCK); + } + if (bootmagic_scan_keycode(BOOTMAGIC_CAPSLOCK_TO_CONTROL)) { + eeconfig_write_keyconf(eeconfig_read_keyconf() ^ EECONFIG_KEYCONF_CAPSLOCK_TO_CONTROL); + } + if (bootmagic_scan_keycode(BOOTMAGIC_SWAP_LALT_LGUI)) { + eeconfig_write_keyconf(eeconfig_read_keyconf() ^ EECONFIG_KEYCONF_SWAP_LALT_LGUI); + } + if (bootmagic_scan_keycode(BOOTMAGIC_SWAP_RALT_RGUI)) { + eeconfig_write_keyconf(eeconfig_read_keyconf() ^ EECONFIG_KEYCONF_SWAP_RALT_RGUI); + } + if (bootmagic_scan_keycode(BOOTMAGIC_NO_GUI)) { + eeconfig_write_keyconf(eeconfig_read_keyconf() ^ EECONFIG_KEYCONF_NO_GUI); + } + if (bootmagic_scan_keycode(BOOTMAGIC_SWAP_GRAVE_ESC)) { + eeconfig_write_keyconf(eeconfig_read_keyconf() ^ EECONFIG_KEYCONF_SWAP_GRAVE_ESC); + } + if (bootmagic_scan_keycode(BOOTMAGIC_SWAP_BACKSLASH_BACKSPACE)) { + eeconfig_write_keyconf(eeconfig_read_keyconf() ^ EECONFIG_KEYCONF_SWAP_BACKSLASH_BACKSPACE); + } } bool bootmagic_scan_keycode(uint8_t keycode) diff --git a/common/bootmagic.h b/common/bootmagic.h index 7aa224def9..d32a5bef88 100644 --- a/common/bootmagic.h +++ b/common/bootmagic.h @@ -6,7 +6,7 @@ #define BOOTMAGIC_IS_ENABLE() true #endif -/* bootloader */ +/* kick up bootloader */ #ifndef BOOTMAGIC_BOOTLOADER_KEY #define BOOTMAGIC_BOOTLOADER_KEY KC_B #endif @@ -19,7 +19,42 @@ #define BOOTMAGIC_EEPROM_CLEAR_KEY KC_BSPACE #endif -/* change default layer */ +/* + * key configure + */ +/* swap control and capslock */ +#ifndef BOOTMAGIC_SWAP_CONTROL_CPASLOCK +#define BOOTMAGIC_SWAP_CONTROL_CPASLOCK KC_LCTRL +#endif +/* capslock to control */ +#ifndef BOOTMAGIC_CAPSLOCK_TO_CONTROL +#define BOOTMAGIC_CAPSLOCK_TO_CONTROL KC_CAPSLOCK +#endif +/* swap alt and gui */ +#ifndef BOOTMAGIC_SWAP_LALT_LGUI +#define BOOTMAGIC_SWAP_LALT_LGUI KC_LALT +#endif +/* swap alt and gui */ +#ifndef BOOTMAGIC_SWAP_RALT_RGUI +#define BOOTMAGIC_SWAP_RALT_RGUI KC_RALT +#endif +/* no gui */ +#ifndef BOOTMAGIC_NO_GUI +#define BOOTMAGIC_NO_GUI KC_LGUI +#endif +/* swap esc and grave */ +#ifndef BOOTMAGIC_SWAP_GRAVE_ESC +#define BOOTMAGIC_SWAP_GRAVE_ESC KC_GRAVE +#endif +/* swap backslash and backspace */ +#ifndef BOOTMAGIC_SWAP_BACKSLASH_BACKSPACE +#define BOOTMAGIC_SWAP_BACKSLASH_BACKSPACE KC_BSLASH +#endif + + +/* + * change default layer + */ #ifndef BOOTMAGIC_DEFAULT_LAYER_0_KEY #define BOOTMAGIC_DEFAULT_LAYER_0_KEY KC_0 #endif @@ -33,6 +68,7 @@ #define BOOTMAGIC_DEFAULT_LAYER_3_KEY KC_3 #endif + void bootmagic(void); bool bootmagic_scan_keycode(uint8_t keycode); diff --git a/common/command.c b/common/command.c index b82d1884ce..cf8d969f81 100644 --- a/common/command.c +++ b/common/command.c @@ -133,8 +133,8 @@ static void print_eeprom_config(void) eebyte = eeconfig_read_defalt_layer(); print("defalt_layer: "); print_hex8(eebyte); print("\n"); - eebyte = eeconfig_read_modifier(); - print("modifiers: "); print_hex8(eebyte); print("\n"); + eebyte = eeconfig_read_keyconf(); + print("keyconf: "); print_hex8(eebyte); print("\n"); } static bool command_common(uint8_t code) diff --git a/common/eeconfig.c b/common/eeconfig.c index a5834aa2c7..f536dc06c9 100644 --- a/common/eeconfig.c +++ b/common/eeconfig.c @@ -6,11 +6,11 @@ void eeconfig_init(void) { - eeprom_write_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); - eeprom_write_byte(EECONFIG_DEBUG, 0); - eeprom_write_byte(EECONFIG_DEFAULT_LAYER, 0); - eeprom_write_byte(EECONFIG_MODIFIER, 0); - eeprom_write_byte(EECONFIG_MOUSEKEY_ACCEL, 0); + eeprom_write_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); + eeprom_write_byte(EECONFIG_DEBUG, 0); + eeprom_write_byte(EECONFIG_DEFAULT_LAYER, 0); + eeprom_write_byte(EECONFIG_KEYCONF, 0); + eeprom_write_byte(EECONFIG_MOUSEKEY_ACCEL, 0); } bool eeconfig_initialized(void) @@ -18,12 +18,11 @@ bool eeconfig_initialized(void) return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER); } -uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); } +uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); } void eeconfig_write_debug(uint8_t val) { eeprom_write_byte(EECONFIG_DEBUG, val); } -uint8_t eeconfig_read_defalt_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); } +uint8_t eeconfig_read_defalt_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); } void eeconfig_write_defalt_layer(uint8_t val) { eeprom_write_byte(EECONFIG_DEFAULT_LAYER, val); } -uint8_t eeconfig_read_modifier(void) { return eeprom_read_byte(EECONFIG_MODIFIER); } -void eeconfig_write_modifier(uint8_t val) { eeprom_write_byte(EECONFIG_MODIFIER, val); } - +uint8_t eeconfig_read_keyconf(void) { return eeprom_read_byte(EECONFIG_KEYCONF); } +void eeconfig_write_keyconf(uint8_t val) { eeprom_write_byte(EECONFIG_KEYCONF, val); } diff --git a/common/eeconfig.h b/common/eeconfig.h index 088171f575..9cf2ff6802 100644 --- a/common/eeconfig.h +++ b/common/eeconfig.h @@ -26,21 +26,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define EECONFIG_MAGIC (uint16_t *)0 #define EECONFIG_DEBUG (uint8_t *)2 #define EECONFIG_DEFAULT_LAYER (uint8_t *)3 -#define EECONFIG_MODIFIER (uint8_t *)4 +#define EECONFIG_KEYCONF (uint8_t *)4 #define EECONFIG_MOUSEKEY_ACCEL (uint8_t *)5 -/* config bit */ +/* debug bit */ #define EECONFIG_DEBUG_ENABLE (1<<0) #define EECONFIG_DEBUG_MATRIX (1<<1) #define EECONFIG_DEBUG_KEYBOARD (1<<2) #define EECONFIG_DEBUG_MOUSE (1<<3) -#define EECONFIG_MODIFIER_CONTROL_CAPSLOCK (1<<0) -#define EECONFIG_MODIFIER_ALT_GUI (1<<1) -#define EECONFIG_MODIFIER_ESC_GRAVE (1<<2) -#define EECONFIG_MODIFIER_BACKSPACE_BACKSLASH (1<<3) -#define EECONFIG_MODIFIER_NO_GUI (1<<4) +/* keyconf bit */ +#define EECONFIG_KEYCONF_SWAP_CONTROL_CAPSLOCK (1<<0) +#define EECONFIG_KEYCONF_CAPSLOCK_TO_CONTROL (1<<1) +#define EECONFIG_KEYCONF_SWAP_LALT_LGUI (1<<2) +#define EECONFIG_KEYCONF_SWAP_RALT_RGUI (1<<3) +#define EECONFIG_KEYCONF_NO_GUI (1<<4) +#define EECONFIG_KEYCONF_SWAP_GRAVE_ESC (1<<5) +#define EECONFIG_KEYCONF_SWAP_BACKSLASH_BACKSPACE (1<<6) bool eeconfig_initialized(void); @@ -53,7 +56,7 @@ void eeconfig_write_debug(uint8_t val); uint8_t eeconfig_read_defalt_layer(void); void eeconfig_write_defalt_layer(uint8_t val); -uint8_t eeconfig_read_modifier(void); -void eeconfig_write_modifier(uint8_t val); +uint8_t eeconfig_read_keyconf(void); +void eeconfig_write_keyconf(uint8_t val); #endif |