]> git.friedersdorff.com Git - max/tmk_keyboard.git/blobdiff - common/keyboard.c
Add build option BOOTMAGIC_ENABLE
[max/tmk_keyboard.git] / common / keyboard.c
index 0a0bacd4330dea81d623fed8ceab53906ebcb955..401fdb4e17f311be9bdae5d6f991f8ac4aff6bd1 100644 (file)
@@ -29,10 +29,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "util.h"
 #include "sendchar.h"
 #include "bootmagic.h"
-#ifdef MOUSEKEY_ENABLE
-#include "mousekey.h"
-#endif
 #include "eeconfig.h"
+#include "mousekey.h"
 
 
 #ifdef MATRIX_HAS_GHOST
@@ -64,18 +62,21 @@ void keyboard_init(void)
     ps2_mouse_init();
 #endif
 
+#ifdef BOOTMAGIC_ENABLE
     bootmagic();
 
-    if (eeconfig_initialized()) {
+    if (eeconfig_is_enabled()) {
         uint8_t config;
         config = eeconfig_read_debug();
-        debug_enable = (config & EECONFIG_DEBUG_ENABLE);
-        debug_matrix = (config & EECONFIG_DEBUG_MATRIX);
-        debug_keyboard = (config & EECONFIG_DEBUG_KEYBOARD);
-        debug_mouse = (config & EECONFIG_DEBUG_MOUSE);
+        // ignored if debug is enabled by program before.
+        if (!debug_enable)   debug_enable   = (config & EECONFIG_DEBUG_ENABLE);
+        if (!debug_matrix)   debug_matrix   = (config & EECONFIG_DEBUG_MATRIX);
+        if (!debug_keyboard) debug_keyboard = (config & EECONFIG_DEBUG_KEYBOARD);
+        if (!debug_mouse)    debug_mouse    = (config & EECONFIG_DEBUG_MOUSE);
     } else {
         eeconfig_init();
     }
+#endif
 }
 
 /*