diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md index 10a71843..544ab240 100644 --- a/docs/custom_quantum_functions.md +++ b/docs/custom_quantum_functions.md @@ -36,16 +36,16 @@ enum my_keycodes { ## Programming The Behavior Of Any Keycode -When you want to override the behavior of an existing key, or define the behavior for a new key, you should use the `process_record_kb()` and `process_record_user()` functions. These are called by QMK during key processing before the actual key event is handled. If these functions return `true` QMK will process the keycodes as usual. That can be handy for extending the functionality of a key rather than replacing it. If these functions return `false` QMK will skip the normal key handling, and it will be up you to send any key up or down events that are required. +When you want to override the behavior of an existing key, or define the behavior for a new key, you should use the `process_keyboard()` and `process_user()` functions. These are called by QMK during key processing before the actual key event is handled. If these functions return `true` QMK will process the keycodes as usual. That can be handy for extending the functionality of a key rather than replacing it. If these functions return `false` QMK will skip the normal key handling, and it will be up you to send any key up or down events that are required. These function are called every time a key is pressed or released. -### Example `process_record_user()` implementation +### Example `process_user()` implementation This example does two things. It defines the behavior for a custom keycode called `FOO`, and it supplements our Enter key by playing a tone whenever it is pressed. ``` -bool process_record_user(uint16_t keycode, keyrecord_t *record) { +level_t process_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case FOO: if (record->event.pressed) { @@ -53,21 +53,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } else { // Do something else when release } - return false; // Skip all further processing of this key + return STOP_FEATURE; // Skip all further processing of this key case KC_ENTER: // Play a tone when enter is pressed if (record->event.pressed) { PLAY_NOTE_ARRAY(tone_qwerty); } - return true; // Let QMK send the enter press/release events + return CONTINUE_PROCESSING; // Let QMK send the enter press/release events } } ``` ### `process_record_*` Function documentation -* Keyboard/Revision: `bool process_record_kb(uint16_t keycode, keyrecord_t *record)` -* Keymap: `bool process_record_user(uint16_t keycode, keyrecord_t *record)` +* Keyboard/Revision: `level_t process_kb(uint16_t keycode, keyrecord_t *record)` +* Keymap: `level_t process_user(uint16_t keycode, keyrecord_t *record)` The `keycode` argument is whatever is defined in your keymap, eg `MO(1)`, `KC_L`, etc. You should use a `switch...case` block to handle these events. diff --git a/docs/quantum_keycodes.md b/docs/quantum_keycodes.md index 36dbda7a..2a8802b7 100644 --- a/docs/quantum_keycodes.md +++ b/docs/quantum_keycodes.md @@ -337,10 +337,10 @@ enum my_keycodes { }; ``` -You can then use `process_record_user()` to do something with your keycode: +You can then use `process_user()` to do something with your keycode: ``` -bool process_record_user(uint16_t keycode, keyrecord_t *record) { +level_t process_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case FOO: // Do something here diff --git a/docs/understanding_qmk.md b/docs/understanding_qmk.md index 28927f0e..5d212546 100644 --- a/docs/understanding_qmk.md +++ b/docs/understanding_qmk.md @@ -135,8 +135,8 @@ The `process_record()` function itself is deceptively simple, but hidden within * [`void process_record(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action.c#L128) * [`bool process_record_quantum(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L140) * [Map this record to a keycode](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L143) - * [`bool process_record_kb(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/cluecard.c#L20) - * [`bool process_record_user(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/keymaps/default/keymap.c#L58) + * [`level_t process_kb(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/cluecard.c#L20) + * [`level_t process_user(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/keymaps/default/keymap.c#L58) * [`bool process_midi(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_midi.c#L102) * [`bool process_audio(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_audio.c#L10) * [`bool process_music(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_music.c#L69) @@ -150,7 +150,7 @@ The `process_record()` function itself is deceptively simple, but hidden within * [`bool process_unicode_map(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicodemap.c#L47) * [Identify and process quantum specific keycodes](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L211) -At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing. +At any step during this chain of events a function (such as `process_kb()`) can `return false` to halt all further processing.