summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-07-14 10:53:51 -0400
committerGitHub <noreply@github.com>2016-07-14 10:53:51 -0400
commit8bbbbcddf909fe14751b30cb5ab61bd67d06a2f5 (patch)
treef61856ff5d0ab34e5bab8dc69a5cda12f89d4b29
parenta998a48673372e409991066d7d2d9ba282f79d59 (diff)
parenta28a6e5b79c819e5f9323f62686498eca3ef399f (diff)
downloadqmk_firmware-8bbbbcddf909fe14751b30cb5ab61bd67d06a2f5.tar.gz
qmk_firmware-8bbbbcddf909fe14751b30cb5ab61bd67d06a2f5.zip
Merge pull request #515 from pvinis/reset-function
extract reset keyboard into a function
-rw-r--r--quantum/quantum.c24
-rw-r--r--quantum/quantum.h2
2 files changed, 16 insertions, 10 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index d5b9753b76..bc2da510f2 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -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;
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 3a0b742028..7ebfb24e30 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -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);