]> git.gir.st - tmk_keyboard.git/blob - tmk_core/common/hook.h
core: Fix suspend/wake for converters #386
[tmk_keyboard.git] / tmk_core / common / hook.h
1 /*
2 Copyright 2016 Jun Wako <wakojun@gmail.com>
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 * Protocol hooks
26 * ------------------------------------- */
27
28 /* Called once, very early stage of initialization, just after processor startup. */
29 /* Default behaviour: do nothing. */
30 void hook_early_init(void);
31
32 /* Called once, very last stage of initialization, just before keyboard loop. */
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
51 /* -------------------------------------
52 * Keyboard hooks
53 * ------------------------------------- */
54
55 /* Called periodically from the keyboard loop (very often!) */
56 /* Default behaviour: do nothing. */
57 void hook_keyboard_loop(void);
58
59 /* Called on matrix state change event (every keypress => often!) */
60 /* Default behaviour: do nothing. */
61 void hook_matrix_change(keyevent_t event);
62
63 /* Called on default layer state change event. */
64 /* Default behaviour: do nothing. */
65 void hook_default_layer_change(uint32_t default_layer_state);
66
67 /* Called on layer state change event. */
68 /* Default behaviour: do nothing. */
69 void hook_layer_change(uint32_t layer_state);
70
71 /* Called on indicator LED update event (when reported from host). */
72 /* Default behaviour: calls keyboard_set_leds. */
73 void hook_keyboard_leds_change(uint8_t led_status);
74
75 /* Called once, on checking the bootmagic combos. */
76 /* Default behaviour: do nothing. */
77 void hook_bootmagic(void);
78
79
80 #endif /* _HOOKS_H_ */
Imprint / Impressum