Skip to content

Commit

Permalink
extract reset keyboard into a function
Browse files Browse the repository at this point in the history
that makes it easy to call reset_keyboard() from a function in a keymap
  • Loading branch information
pvinis committed Jul 13, 2016
1 parent a998a48 commit a28a6e5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
24 changes: 14 additions & 10 deletions quantum/quantum.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions quantum/quantum.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit a28a6e5

Please sign in to comment.