diff options
Diffstat (limited to 'docs/Home.md')
-rw-r--r-- | docs/Home.md | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/docs/Home.md b/docs/Home.md index 600438718..500712a22 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -132,52 +132,3 @@ case MACRO_RAISED: Enable the backlight from the Makefile. -# Custom Quantum functions - -All of these functions are available in the `*_kb()` or `*_user()` variety. `kb` ones should only be used in the `<keyboard>/<keyboard>.c` file, and `user` ones should only be used in the `keymap.c`. The keyboard ones call the user ones - it's necessary to keep these calls to allow the keymap functions to work correctly. - -## `void matrix_init_user(void)`/`void matrix_init_kb(void)` - -This function gets called when the matrix is initiated, and can contain start-up code for your keyboard/keymap. - -## `void matrix_scan_user(void)`/`void matrix_scan_kb(void)` - -This function gets called at every matrix scan, which is basically as often as the MCU can handle. Be careful what you put here, as it will get run a lot. - -## `bool process_record_user(uint16_t keycode, keyrecord_t *record)`/`bool process_record_kb(uint16_t keycode, keyrecord_t *record)` - -This function gets called on every keypress/release, and is where you can define custom functionality. The return value is whether or not QMK should continue processing the keycode - returning `false` stops the execution. - -The `keycode` variable is whatever is defined in your keymap, eg `MO(1)`, `KC_L`, etc. and can be switch-cased to execute code whenever a particular code is pressed. - -The `record` variable contains infomation about the actual press: - -``` -keyrecord_t record { - keyevent_t event { - keypos_t key { - uint8_t col - uint8_t row - } - bool pressed - uint16_t time - } -} -``` - -The conditional `if (record->event.pressed)` can tell if the key is being pressed or released, and you can execute code based on that. - -## `void led_set_user(uint8_t usb_led)`/`void led_set_kb(uint8_t usb_led)` - -This gets called whenever there is a state change on your host LEDs \(eg caps lock, scroll lock, etc\). The LEDs are defined as: - -``` -#define USB_LED_NUM_LOCK 0 -#define USB_LED_CAPS_LOCK 1 -#define USB_LED_SCROLL_LOCK 2 -#define USB_LED_COMPOSE 3 -#define USB_LED_KANA 4 -``` - -and can be tested against the `usb_led` with a conditional like `if (usb_led & (1<<USB_LED_CAPS_LOCK))` - if this is true, you can turn your LED on, otherwise turn it off. - |