aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/bootmagic.c22
-rw-r--r--common/bootmagic.h40
-rw-r--r--common/command.c4
-rw-r--r--common/eeconfig.c19
-rw-r--r--common/eeconfig.h21
5 files changed, 83 insertions, 23 deletions
diff --git a/common/bootmagic.c b/common/bootmagic.c
index 31b8ae5e6..46fbc180a 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 7aa224def..d32a5bef8 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 b82d1884c..cf8d969f8 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 a5834aa2c..f536dc06c 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 088171f57..9cf2ff680 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