mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-28 14:10:13 +00:00
Merge 80425b0964
into 36b5559b99
This commit is contained in:
commit
62c2b60133
@ -154,6 +154,21 @@ User callback, invoked when the leader sequence ends.
|
||||
|
||||
---
|
||||
|
||||
### `bool leader_add_user(uint16_t keycode)` {#api-leader-add-user}
|
||||
|
||||
User callback, invoked when a keycode is added to the leader sequence.
|
||||
|
||||
#### Arguments {#api-leader-add-user-arguments}
|
||||
|
||||
- `uint16_t keycode`
|
||||
The keycode to added to the leader sequence.
|
||||
|
||||
#### Return Value {#api-leader-add-user-return}
|
||||
|
||||
`true` to finish the key sequence, `false` to continue.
|
||||
|
||||
---
|
||||
|
||||
### `void leader_start(void)` {#api-leader-start}
|
||||
|
||||
Begin the leader sequence, resetting the buffer and timer.
|
||||
|
@ -21,6 +21,10 @@ __attribute__((weak)) void leader_start_user(void) {}
|
||||
|
||||
__attribute__((weak)) void leader_end_user(void) {}
|
||||
|
||||
__attribute__((weak)) bool leader_add_user(uint16_t keycode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void leader_start(void) {
|
||||
if (leading) {
|
||||
return;
|
||||
@ -61,6 +65,9 @@ bool leader_sequence_add(uint16_t keycode) {
|
||||
leader_sequence[leader_sequence_size] = keycode;
|
||||
leader_sequence_size++;
|
||||
|
||||
if (leader_add_user(keycode)) {
|
||||
leader_end();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,15 @@ void leader_start_user(void);
|
||||
*/
|
||||
void leader_end_user(void);
|
||||
|
||||
/**
|
||||
* \brief User callback, invoked when a keycode is added to the leader sequence.
|
||||
*
|
||||
* \param keycode The keycode added to the leader sequence.
|
||||
*
|
||||
* \return `true` to finish the key sequence, `false` to continue.
|
||||
*/
|
||||
bool leader_add_user(uint16_t keycode);
|
||||
|
||||
/**
|
||||
* Begin the leader sequence, resetting the buffer and timer.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user