-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit '71381457fa1311dfa0b58ba882a96db740640871'
Conflicts: tmk_core/doc/keymap.md
- Loading branch information
Showing
17 changed files
with
372 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
Copyright 2016 Jun Wako <[email protected]> | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "keyboard.h" | ||
#include "hook.h" | ||
|
||
/* ------------------------------------------------- | ||
* Definitions of hardware-independent default hooks | ||
* ------------------------------------------------- */ | ||
|
||
/* Called on layer state change event. */ | ||
/* Default behaviour: do nothing. */ | ||
__attribute__((weak)) | ||
void hook_layer_change(uint8_t layer_state) { | ||
(void)layer_state; | ||
} | ||
|
||
/* Called periodically from the matrix scan loop (very often!) */ | ||
/* Default behaviour: do nothing. */ | ||
__attribute__((weak)) | ||
void hook_keyboard_loop(void) {} | ||
|
||
/* Called on matrix state change event (every keypress => often!) */ | ||
/* Default behaviour: do nothing. */ | ||
__attribute__((weak)) | ||
void hook_matrix_change(keyevent_t event) { | ||
(void)event; | ||
} | ||
|
||
/* Called on indicator LED update event (when reported from host). */ | ||
/* Default behaviour: calls led_set (for compatibility). */ | ||
__attribute__((weak)) | ||
void hook_keyboard_leds_change(uint8_t led_status) { | ||
keyboard_set_leds(led_status); | ||
} | ||
|
||
/* Called once, on checking the bootmagic combos. */ | ||
/* Default behaviour: do nothing. */ | ||
__attribute__((weak)) | ||
void hook_bootmagic(void) { | ||
/* An example: */ | ||
// #include "bootmagic.h" | ||
// #include "keymap.h" | ||
// if(bootmagic_scan_keycode(KC_W)) { | ||
// // do something | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
Copyright 2016 Jun Wako <[email protected]> | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef _HOOKS_H_ | ||
#define _HOOKS_H_ | ||
|
||
#include "keyboard.h" | ||
#include "led.h" | ||
|
||
/* ------------------------------------- | ||
* Hardware / one-off hooks | ||
* ------------------------------------- */ | ||
|
||
/* Called once, before initialising USB. */ | ||
/* Default behaviour: do nothing. */ | ||
void hook_early_init(void); | ||
|
||
/* Called once, after USB is connected and keyboard initialised. */ | ||
/* Default behaviour: do nothing. */ | ||
void hook_late_init(void); | ||
|
||
/* Called once, on getting SUSPEND event from USB. */ | ||
/* Default behaviour: do nothing. */ | ||
void hook_usb_suspend_entry(void); | ||
|
||
/* Called repeatedly during the SUSPENDed state. */ | ||
/* Default behaviour: power down and periodically check | ||
* the matrix, cause wakeup if needed. */ | ||
void hook_usb_suspend_loop(void); | ||
|
||
/* Called once, on getting WAKE event from USB. */ | ||
/* Default behaviour: disables sleep LED breathing and restores | ||
* the "normal" indicator LED status by default. */ | ||
void hook_usb_wakeup(void); | ||
|
||
/* Called once, on checking the bootmagic combos. */ | ||
/* Default behaviour: do nothing. */ | ||
void hook_bootmagic(void); | ||
|
||
/* ------------------------------------- | ||
* Keyboard / periodic hooks | ||
* ------------------------------------- */ | ||
|
||
/* Called periodically from the keyboard loop (very often!) */ | ||
/* Default behaviour: do nothing. */ | ||
void hook_keyboard_loop(void); | ||
|
||
/* Called on matrix state change event (every keypress => often!) */ | ||
/* Default behaviour: do nothing. */ | ||
void hook_matrix_change(keyevent_t event); | ||
|
||
/* Called on layer state change event. */ | ||
/* Default behaviour: do nothing. */ | ||
void hook_layer_change(uint8_t layer_state); | ||
|
||
/* Called on indicator LED update event (when reported from host). */ | ||
/* Default behaviour: calls keyboard_set_leds (for compatibility). */ | ||
void hook_keyboard_leds_change(uint8_t led_status); | ||
|
||
#endif /* _HOOKS_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.