A custom keyboard is about more than sending button presses to your computer. QMK has designed hooks to allow you to inject, override, and otherwise customize how your keyboard responds in different situations. These allow you to control status LED's, write complex macros, or even change a key's behavior based on the keyboard's state. ## A Word on Keyboards vs Keymap We have structured QMK as a hierarchy: * Core * Keyboard/Revision (`_kb`) * Keymap (`_user`) Each of the functions described below can be defined with a `_kb()` suffix or an `_user()` suffix. We intend for you to use the `_kb()` suffix at the Keyboard/Revision level, while the `_user()` suffix should be used at the Keymap level. When defining functions at the Keyboard/Revision level it is important that your `_kb()` implementation call `_user()` before executing anything else- otherwise the keymap level function will never be called. ## Matrix Initialization Code * Keyboard/Revision: `void matrix_init_kb(void)` * Keymap: `void matrix_init_user(void)` This function gets called when the matrix is initiated. You should use this function to initialize any custom hardware you may have, such as speakers, LED drivers, or other features which need to be setup after the keyboard powers on. ### Example ``` void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up matrix_init_user(); // JTAG disable for PORT F. write JTD bit twice within four cycles. MCUCR |= (1<event.pressed)` can tell if the key is being pressed or released, and you can execute code based on that. ## LED Control * Keyboard/Revision: `void led_set_kb(uint8_t usb_led)` * Keymap: `void led_set_user(uint8_t usb_led)` This allows you to control the 5 LED's defined as part of the USB Keyboard spec. It will be called when the state of one of those 5 LEDs changes. * `USB_LED_NUM_LOCK` * `USB_LED_CAPS_LOCK` * `USB_LED_SCROLL_LOCK` * `USB_LED_COMPOSE` * `USB_LED_KANA` ### Example: ``` void led_set_kb(uint8_t usb_led) { if (usb_led & (1<