Squashed 'tmk_core/' changes from d5c5ac6..8da1898
8da1898 Merge remote-tracking branch 'flabbergast/chibios' f0fdd8a ChibiOS: update instructions.md. 24dd0b5 ChibiOS: update mk to match chibios/master. cdee266 Merge branch 'develop' into chibios 221663c Fix signatre of layer state change hooks 5a364cb Merge branch 'hotfix-chibios' into develop af664cd Merge branch 'newapi' into develop 04feeaa Clean hook codes 0ca106d Fix code and table in hook.txt 714d418 Add hook document from njbair's work b715129 Chibios: add default location for chibios-contrib. fb3a323 Merge branch 'master' into newapi 8b7fbbd Merge branch 'master' into develop e49851a Chibios: add default location for chibios-contrib. git-subtree-dir: tmk_core git-subtree-split: 8da189851ba83b9bb46a4290cd76b7b7fef6134e
This commit is contained in:
parent
71381457fa
commit
20b787fc12
7 changed files with 157 additions and 49 deletions
|
|
@ -22,6 +22,7 @@ static void default_layer_state_set(uint32_t state)
|
|||
debug("default_layer_state: ");
|
||||
default_layer_debug(); debug(" to ");
|
||||
default_layer_state = state;
|
||||
hook_default_layer_change(default_layer_state);
|
||||
default_layer_debug(); debug("\n");
|
||||
clear_keyboard_but_mods(); // To avoid stuck keys
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,43 +19,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "hook.h"
|
||||
|
||||
/* -------------------------------------------------
|
||||
* Definitions of hardware-independent default hooks
|
||||
* Definitions of 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;
|
||||
(void)event;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void hook_default_layer_change(uint32_t default_layer_state) {
|
||||
(void)default_layer_state;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void hook_layer_change(uint32_t layer_state) {
|
||||
(void)layer_state;
|
||||
}
|
||||
|
||||
/* 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
|
||||
// }
|
||||
}
|
||||
void hook_bootmagic(void) {}
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "led.h"
|
||||
|
||||
/* -------------------------------------
|
||||
* Hardware / one-off hooks
|
||||
* Protocol hooks
|
||||
* ------------------------------------- */
|
||||
|
||||
/* Called once, before initialising USB. */
|
||||
/* Called once, very early stage of initialization, just after processor startup. */
|
||||
/* Default behaviour: do nothing. */
|
||||
void hook_early_init(void);
|
||||
|
||||
/* Called once, after USB is connected and keyboard initialised. */
|
||||
/* Called once, very last stage of initialization, just before keyboard loop. */
|
||||
/* Default behaviour: do nothing. */
|
||||
void hook_late_init(void);
|
||||
|
||||
|
|
@ -47,12 +47,9 @@ void hook_usb_suspend_loop(void);
|
|||
* 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
|
||||
* Keyboard hooks
|
||||
* ------------------------------------- */
|
||||
|
||||
/* Called periodically from the keyboard loop (very often!) */
|
||||
|
|
@ -63,12 +60,21 @@ void hook_keyboard_loop(void);
|
|||
/* Default behaviour: do nothing. */
|
||||
void hook_matrix_change(keyevent_t event);
|
||||
|
||||
/* Called on default layer state change event. */
|
||||
/* Default behaviour: do nothing. */
|
||||
void hook_default_layer_change(uint32_t default_layer_state);
|
||||
|
||||
/* Called on layer state change event. */
|
||||
/* Default behaviour: do nothing. */
|
||||
void hook_layer_change(uint8_t layer_state);
|
||||
void hook_layer_change(uint32_t layer_state);
|
||||
|
||||
/* Called on indicator LED update event (when reported from host). */
|
||||
/* Default behaviour: calls keyboard_set_leds (for compatibility). */
|
||||
/* Default behaviour: calls keyboard_set_leds. */
|
||||
void hook_keyboard_leds_change(uint8_t led_status);
|
||||
|
||||
/* Called once, on checking the bootmagic combos. */
|
||||
/* Default behaviour: do nothing. */
|
||||
void hook_bootmagic(void);
|
||||
|
||||
|
||||
#endif /* _HOOKS_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue