]> git.friedersdorff.com Git - max/tmk_keyboard.git/blobdiff - tmk_core/common/keymap.c
core: Fix variable init and header include
[max/tmk_keyboard.git] / tmk_core / common / keymap.c
index a43ca460f278447320805b82aa4f0107516916f9..f6a151721940d481cbbb3531b8da491a37c59777 100644 (file)
@@ -20,20 +20,17 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "action_layer.h"
 #include "action.h"
 #include "action_macro.h"
+#include "wait.h"
 #include "debug.h"
+#include "bootloader.h"
 
 
 static action_t keycode_to_action(uint8_t keycode);
 
 
 /* converts key to action */
-__attribute__((__weak__))
 action_t action_for_key(uint8_t layer, keypos_t key)
 {
-       return action_for_key_default(layer, key);
-}
-
-action_t action_for_key_default(uint8_t layer, keypos_t key)
     uint8_t keycode = keymap_key_to_keycode(layer, key);
     switch (keycode) {
         case KC_FN0 ... KC_FN31:
@@ -127,7 +124,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
 /* translates keycode to action */
 static action_t keycode_to_action(uint8_t keycode)
 {
-    action_t action;
+    action_t action = {};
     switch (keycode) {
         case KC_A ... KC_EXSEL:
         case KC_LCTRL ... KC_RGUI:
@@ -145,6 +142,11 @@ static action_t keycode_to_action(uint8_t keycode)
         case KC_TRNS:
             action.code = ACTION_TRANSPARENT;
             break;
+        case KC_BOOTLOADER:
+            clear_keyboard();
+            wait_ms(50);
+            bootloader_jump(); // not return
+            break;
         default:
             action.code = ACTION_NO;
             break;