1 # Custom Userspace Function handlers
3 Specifically QMK works by using customized handlers for everything. This allows for multiple levels of customization.
5 `matrix_scan` calls `matrix_scan_quantum`, which calls `matrix_scan_kb`, which calls `matrix_scan_user`.
6 `process_record` calls a bunch of stuff, but eventually calls `process_record_kb` which calls `process_record_user`
7 The same goes for `matrix_init`, `layer_state_set`, `led_set`, and a few other functions.
9 All (most) `_user` functions are handled here, in the userspace instead. To allow keyboard specific configuration, I've created `_keymap` functions that can be called by the keymap.c files instead.
11 This allows for keyboard specific configuration while maintaining the ability to customize the board.
13 My [Ergodox EZ Keymap](https://github.com/qmk/qmk_firmware/blob/master/layouts/community/ergodox/drashna/keymap.c) is a good example of this, as it uses the LEDs as modifier indicators.
18 __attribute__ ((weak))
19 void matrix_init_keymap(void) {}
21 void matrix_init_user(void) {
26 void keyboard_post_init_keymap(void){ }
28 void keyboard_post_init_user(void){
29 keyboard_post_init_keymap();
32 __attribute__ ((weak))
33 void matrix_scan_keymap(void) {}
35 void matrix_scan_user(void) {
40 __attribute__ ((weak))
41 bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
45 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
46 return process_record_keymap(keycode, record);
50 __attribute__ ((weak))
51 layer_state_t layer_state_set_keymap (layer_state_t state) {
55 layer_state_t layer_state_set_user (layer_state_t state) {
56 return layer_state_set_keymap (state);
60 __attribute__ ((weak))
61 void led_set_keymap(uint8_t usb_led) {}
63 void led_set_user(uint8_t usb_led) {
64 led_set_keymap(usb_led);
68 __attribute__ ((weak))
69 void suspend_power_down_keymap(void) {}
71 void suspend_power_down_user(void) {
72 suspend_power_down_keymap();
76 __attribute__ ((weak))
77 void suspend_wakeup_init_keymap(void) {}
79 void suspend_wakeup_init_user(void) {
80 suspend_wakeup_init_keymap();
84 __attribute__ ((weak))
85 void shutdown_keymap(void) {}
87 void shutdown_user (void) {
91 __attribute__ ((weak))
92 void eeconfig_init_keymap(void) {}
94 void eeconfig_init_user(void) {
95 eeconfig_init_keymap();