You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/hook.txt
+24-25Lines changed: 24 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,23 @@ Hooks allow you to execute custom code at certain predefined points in the firmw
4
4
5
5
The following hooks are available available:
6
6
7
-
Hook function | Called in file | Timing
8
-
---|---|---
9
-
`hook_keyboard_start(void)` | *protocol/\<protocol>.c* | Early in the boot process, before the matrix is initialized and before a connection is made with the host. Thus, this hook has access to very few parameters, but it is a good place to define any custom parameters needed by other early processes.
10
-
`hook_keyboard_init(void)` | *protocol/\<protocol>.c* | Near the end of the boot process, after Boot Magic has run and LEDs have been initialized.
11
-
`hook_bootmagic(void)` | *common/bootmagic.c* | During the Boot Magic window, after EEPROM and Bootloader checks are made, but before any other built-in Boot Magic checks are made.
12
-
`hook_usb_suspend(void)` | *protocol/\<protocol>.c* | When the device enters USB suspend state. *Default action:* enable LED breathing.
13
-
`hook_usb_wakeup(void)` | *protocol/\<protocol>.c* | When the device wakes up from USB suspend state. *Default action:* disable LED breathing.
14
-
`hook_suspend_loop(void)` | *protocol/\<protocol>.c* | Continuously, while the device is in USB suspend state. *Default action:* power down and periodically check the matrix, causing wakeup if needed.
15
-
`hook_keyboard_loop(void)` | *common/keyboard.c* | Continuously, during the main loop, after the matrix is checked. Note that the protocol and interrupt configuration may affect the timing. If you need precise timing, use one of the `hook_interval_*` functions listed below.
16
-
`hook_matrix_change(keyevent_t event)` | *common/action.c* | When a keypress event is detected, before any other actions are processed.
17
-
`hook_layer_state_change(uint32_t layer_state)` | *common/action_layer.c* | When any layer is turned on or off. `layer_state` is a 32-bit integer containing the 0/1 state of all 32 layers, one bit per layer (see [keymap documentation](tmk_core/doc/keymap.md)).
18
-
`hook_default_layer_state_change(uint32_t default_layer_state)` | *common/action_layer.c* | When the default layer is changed. `default_layer_state` is a 32-bit integer with a single bit set to 1 indicating the default layer (see [keymap documentation](tmk_core/doc/keymap.md)).
19
-
`hook_leds_change(uint8_t led_status)` | *common/keyboard.c* | Whenever a change in the LED status is performed. *Default action:* call `keyboard_set_leds(led_status)`
`hook_early_init(void)` | Early in the boot process, before the matrix is initialized and before a connection is made with the host. Thus, this hook has access to very few parameters, but it is a good place to define any custom parameters needed by other early processes.
10
+
`hook_late_init(void)` | Near the end of the boot process, after Boot Magic has run and LEDs have been initialized.
11
+
`hook_bootmagic(void)` | During the Boot Magic window, after EEPROM and Bootloader checks are made, but before any other built-in Boot Magic checks are made.
12
+
`hook_usb_wakeup(void)` | When the device wakes up from USB suspend state.
13
+
`hook_usb_suspend_entry(void)` | When the device enters USB suspend state.
14
+
`hook_usb_suspend_loop(void)` | Continuously, while the device is in USB suspend state. *Default action:* power down and periodically check the matrix, causing wakeup if needed.
15
+
`hook_keyboard_loop(void)` | Continuously, during the main loop, after the matrix is checked.
16
+
`hook_matrix_change(keyevent_t event)` | When a matrix state change is detected, before any other actions are processed.
17
+
`hook_layer_change(uint32_t layer_state)` | When any layer is changed.
18
+
`hook_default_layer_change(uint32_t default_layer_state)` | When any default layer is changed.
19
+
`hook_keyboard_leds_change(uint8_t led_status)` | Whenever a change in the LED status is performed. *Default action:* call `keyboard_set_leds(led_status)`
20
+
21
+
22
+
23
+
20
24
21
25
### Hooks Examples
22
26
@@ -27,7 +31,7 @@ You can try these out by copying the code to your keymap file, or any .c file in
0 commit comments