diff options
Diffstat (limited to 'tmk_core/common')
-rw-r--r-- | tmk_core/common/keyboard.c | 8 | ||||
-rw-r--r-- | tmk_core/common/keymap.h | 3 | ||||
-rw-r--r-- | tmk_core/common/magic.c | 36 | ||||
-rw-r--r-- | tmk_core/common/magic.h | 6 |
4 files changed, 49 insertions, 4 deletions
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 302b3ec87..1d9981848 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
@@ -27,7 +27,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
27 | #include "command.h" | 27 | #include "command.h" |
28 | #include "util.h" | 28 | #include "util.h" |
29 | #include "sendchar.h" | 29 | #include "sendchar.h" |
30 | #include "bootmagic.h" | 30 | #ifdef BOOTMAGIC_ENABLE |
31 | #include "bootmagic.h" | ||
32 | #else | ||
33 | #include "magic.h" | ||
34 | #endif | ||
31 | #include "eeconfig.h" | 35 | #include "eeconfig.h" |
32 | #include "backlight.h" | 36 | #include "backlight.h" |
33 | #ifdef MOUSEKEY_ENABLE | 37 | #ifdef MOUSEKEY_ENABLE |
@@ -86,6 +90,8 @@ void keyboard_init(void) | |||
86 | 90 | ||
87 | #ifdef BOOTMAGIC_ENABLE | 91 | #ifdef BOOTMAGIC_ENABLE |
88 | bootmagic(); | 92 | bootmagic(); |
93 | #else | ||
94 | magic(); | ||
89 | #endif | 95 | #endif |
90 | 96 | ||
91 | #ifdef BACKLIGHT_ENABLE | 97 | #ifdef BACKLIGHT_ENABLE |
diff --git a/tmk_core/common/keymap.h b/tmk_core/common/keymap.h index e1a6f992e..abc9bdb32 100644 --- a/tmk_core/common/keymap.h +++ b/tmk_core/common/keymap.h | |||
@@ -22,8 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include "action.h" | 23 | #include "action.h" |
24 | 24 | ||
25 | |||
26 | #ifdef BOOTMAGIC_ENABLE | ||
27 | /* NOTE: Not portable. Bit field order depends on implementation */ | 25 | /* NOTE: Not portable. Bit field order depends on implementation */ |
28 | typedef union { | 26 | typedef union { |
29 | uint8_t raw; | 27 | uint8_t raw; |
@@ -39,7 +37,6 @@ typedef union { | |||
39 | }; | 37 | }; |
40 | } keymap_config_t; | 38 | } keymap_config_t; |
41 | keymap_config_t keymap_config; | 39 | keymap_config_t keymap_config; |
42 | #endif | ||
43 | 40 | ||
44 | 41 | ||
45 | /* translates key to keycode */ | 42 | /* translates key to keycode */ |
diff --git a/tmk_core/common/magic.c b/tmk_core/common/magic.c new file mode 100644 index 000000000..f21d1346c --- /dev/null +++ b/tmk_core/common/magic.c | |||
@@ -0,0 +1,36 @@ | |||
1 | #include <stdint.h> | ||
2 | #include <stdbool.h> | ||
3 | #include <util/delay.h> | ||
4 | #include "matrix.h" | ||
5 | #include "bootloader.h" | ||
6 | #include "debug.h" | ||
7 | #include "keymap.h" | ||
8 | #include "host.h" | ||
9 | #include "action_layer.h" | ||
10 | #include "eeconfig.h" | ||
11 | #include "magic.h" | ||
12 | |||
13 | keymap_config_t keymap_config; | ||
14 | |||
15 | void magic(void) | ||
16 | { | ||
17 | /* check signature */ | ||
18 | if (!eeconfig_is_enabled()) { | ||
19 | eeconfig_init(); | ||
20 | } | ||
21 | |||
22 | /* debug enable */ | ||
23 | debug_config.raw = eeconfig_read_debug(); | ||
24 | |||
25 | /* keymap config */ | ||
26 | keymap_config.raw = eeconfig_read_keymap(); | ||
27 | |||
28 | #ifdef NKRO_ENABLE | ||
29 | keyboard_nkro = keymap_config.nkro; | ||
30 | #endif | ||
31 | |||
32 | uint8_t default_layer = 0; | ||
33 | default_layer = eeconfig_read_default_layer(); | ||
34 | default_layer_set((uint32_t)default_layer); | ||
35 | |||
36 | } \ No newline at end of file | ||
diff --git a/tmk_core/common/magic.h b/tmk_core/common/magic.h new file mode 100644 index 000000000..3fa2d8b81 --- /dev/null +++ b/tmk_core/common/magic.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef MAGIC_H | ||
2 | #define MAGIC_H | ||
3 | |||
4 | void magic(void); | ||
5 | |||
6 | #endif | ||