X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=tmk_core%2Fcommon%2Fhook.h;h=ddd05c6fcb1e32cb64bc3c089f9105e003b7cd12;hb=c2e8c0d43ead80d466d6ca892378b4f46b2ff1b1;hp=ff569d49c9caa5db564f2d6a57397456ff0b2c9c;hpb=b1d691bcfdd3f30fc9d6e4aeecb1b620208991cd;p=max%2Ftmk_keyboard.git diff --git a/tmk_core/common/hook.h b/tmk_core/common/hook.h index ff569d49..ddd05c6f 100644 --- a/tmk_core/common/hook.h +++ b/tmk_core/common/hook.h @@ -20,16 +20,21 @@ along with this program. If not, see . #include "keyboard.h" #include "led.h" +#include "action.h" + +#ifdef __cplusplus +extern "C" { +#endif /* ------------------------------------- - * 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 +52,13 @@ 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. */ +/* Called repeatedly until getting to CONFIGURED state */ /* Default behaviour: do nothing. */ -void hook_bootmagic(void); +void hook_usb_startup_wait_loop(void); + /* ------------------------------------- - * Keyboard / periodic hooks + * Keyboard hooks * ------------------------------------- */ /* Called periodically from the keyboard loop (very often!) */ @@ -63,12 +69,28 @@ 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); + +/* Called on before processing key event */ +/* returns true if the event is consumed and default action is not needed. */ +bool hook_process_action(keyrecord_t *record); + +#ifdef __cplusplus +} +#endif + #endif /* _HOOKS_H_ */