]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
extract reset keyboard into a function
authorPavlos Vinieratos <pvinis@gmail.com>
Wed, 13 Jul 2016 14:38:02 +0000 (16:38 +0200)
committerPavlos Vinieratos <pvinis@gmail.com>
Wed, 13 Jul 2016 14:38:02 +0000 (16:38 +0200)
that makes it easy to call reset_keyboard() from a function in a keymap

quantum/quantum.c
quantum/quantum.h

index d5b9753b765039ea4336ca342963213e81e18a81..bc2da510f2f902149a9a1c93e217474b29d559c3 100644 (file)
@@ -15,6 +15,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
   return true;
 }
 
+void reset_keyboard(void) {
+  clear_keyboard();
+#ifdef AUDIO_ENABLE
+  stop_all_notes();
+  shutdown_user();
+#endif
+  wait_ms(250);
+#ifdef CATERINA_BOOTLOADER
+  *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
+#endif
+  bootloader_jump();
+}
+
 // Shift / paren setup
 
 #ifndef LSPO_KEY
@@ -83,16 +96,7 @@ bool process_record_quantum(keyrecord_t *record) {
   switch(keycode) {
     case RESET:
       if (record->event.pressed) {
-        clear_keyboard();
-        #ifdef AUDIO_ENABLE
-          stop_all_notes();
-          shutdown_user();
-        #endif
-        wait_ms(250);
-        #ifdef CATERINA_BOOTLOADER
-            *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
-        #endif
-        bootloader_jump();
+        reset_keyboard();
       }
          return false;
       break;
index 3a0b742028d934a0db07d9deb72c318e8e90987a..7ebfb24e302d5d1de0a8cd0a26d31f349518fb43 100644 (file)
@@ -77,6 +77,8 @@ bool process_action_kb(keyrecord_t *record);
 bool process_record_kb(uint16_t keycode, keyrecord_t *record);
 bool process_record_user(uint16_t keycode, keyrecord_t *record);
 
+void reset_keyboard(void);
+
 void startup_user(void);
 void shutdown_user(void);