|
| 1 | +/* |
| 2 | +Copyright 2016 Jun Wako <[email protected]> |
| 3 | +
|
| 4 | +This program is free software: you can redistribute it and/or modify |
| 5 | +it under the terms of the GNU General Public License as published by |
| 6 | +the Free Software Foundation, either version 2 of the License, or |
| 7 | +(at your option) any later version. |
| 8 | +
|
| 9 | +This program is distributed in the hope that it will be useful, |
| 10 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | +GNU General Public License for more details. |
| 13 | +
|
| 14 | +You should have received a copy of the GNU General Public License |
| 15 | +along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | +*/ |
| 17 | + |
| 18 | +#ifndef _HOOKS_H_ |
| 19 | +#define _HOOKS_H_ |
| 20 | + |
| 21 | +#include "keyboard.h" |
| 22 | +#include "led.h" |
| 23 | + |
| 24 | +/* ------------------------------------- |
| 25 | + * Hardware / one-off hooks |
| 26 | + * ------------------------------------- */ |
| 27 | + |
| 28 | +/* Called once, before initialising USB. */ |
| 29 | +/* Default behaviour: do nothing. */ |
| 30 | +void hook_early_init(void); |
| 31 | + |
| 32 | +/* Called once, after USB is connected and keyboard initialised. */ |
| 33 | +/* Default behaviour: do nothing. */ |
| 34 | +void hook_late_init(void); |
| 35 | + |
| 36 | +/* Called once, on getting SUSPEND event from USB. */ |
| 37 | +/* Default behaviour: do nothing. */ |
| 38 | +void hook_usb_suspend_entry(void); |
| 39 | + |
| 40 | +/* Called repeatedly during the SUSPENDed state. */ |
| 41 | +/* Default behaviour: power down and periodically check |
| 42 | + * the matrix, cause wakeup if needed. */ |
| 43 | +void hook_usb_suspend_loop(void); |
| 44 | + |
| 45 | +/* Called once, on getting WAKE event from USB. */ |
| 46 | +/* Default behaviour: disables sleep LED breathing and restores |
| 47 | + * the "normal" indicator LED status by default. */ |
| 48 | +void hook_usb_wakeup(void); |
| 49 | + |
| 50 | +/* Called once, on checking the bootmagic combos. */ |
| 51 | +/* Default behaviour: do nothing. */ |
| 52 | +void hook_bootmagic(void); |
| 53 | + |
| 54 | +/* ------------------------------------- |
| 55 | + * Keyboard / periodic hooks |
| 56 | + * ------------------------------------- */ |
| 57 | + |
| 58 | +/* Called periodically from the keyboard loop (very often!) */ |
| 59 | +/* Default behaviour: do nothing. */ |
| 60 | +void hook_keyboard_loop(void); |
| 61 | + |
| 62 | +/* Called on matrix state change event (every keypress => often!) */ |
| 63 | +/* Default behaviour: do nothing. */ |
| 64 | +void hook_matrix_change(keyevent_t event); |
| 65 | + |
| 66 | +/* Called on layer state change event. */ |
| 67 | +/* Default behaviour: do nothing. */ |
| 68 | +void hook_layer_change(uint8_t layer_state); |
| 69 | + |
| 70 | +/* Called on indicator LED update event (when reported from host). */ |
| 71 | +/* Default behaviour: calls keyboard_set_leds (for compatibility). */ |
| 72 | +void hook_keyboard_leds_change(uint8_t led_status); |
| 73 | + |
| 74 | +#endif /* _HOOKS_H_ */ |
0 commit comments