-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
hook.h
100 lines (75 loc) · 3.05 KB
/
hook.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
Copyright 2016 Jun Wako <wakojun@gmail.com>
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"
#include "action.h"
#ifdef __cplusplus
extern "C" {
#endif
/* -------------------------------------
* Protocol hooks
* ------------------------------------- */
/* Called once, very early stage of initialization, just after processor startup. */
/* Default behaviour: do nothing. */
void hook_early_init(void);
/* Called once, very last stage of initialization, just before keyboard loop. */
/* 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 repeatedly until getting to CONFIGURED state */
/* Default behaviour: do nothing. */
void hook_usb_startup_wait_loop(void);
/* Called periodically from main loop */
/* Default behaviour: do nothing. */
void hook_main_loop(void);
/* -------------------------------------
* Keyboard 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 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(uint32_t layer_state);
/* Called on indicator LED update event (when reported from host). */
/* 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_ */