Add keycode parameter to leader_add_user callback

This commit is contained in:
willbsp 2024-09-06 12:01:09 +01:00
parent 0de31e3318
commit 6a54422a41
3 changed files with 12 additions and 5 deletions

View File

@ -154,11 +154,16 @@ User callback, invoked when the leader sequence ends.
---
### `bool leader_add_user(void)` {#api-leader-add-user}
### `bool leader_add_user(uint16_t keycode)` {#api-leader-add-user}
User callback, invoked when a keycode is added to the leader sequence.
#### Return Value {#api-leader-sequence-add-return}
#### 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.

View File

@ -21,7 +21,7 @@ __attribute__((weak)) void leader_start_user(void) {}
__attribute__((weak)) void leader_end_user(void) {}
__attribute__((weak)) bool leader_add_user(void) { return false; }
__attribute__((weak)) bool leader_add_user(uint16_t keycode) { return false; }
void leader_start(void) {
if (leading) {
@ -63,7 +63,7 @@ bool leader_sequence_add(uint16_t keycode) {
leader_sequence[leader_sequence_size] = keycode;
leader_sequence_size++;
if (leader_add_user()) {
if (leader_add_user(keycode)) {
leader_end();
}
return true;

View File

@ -24,9 +24,11 @@ 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(void);
bool leader_add_user(uint16_t keycode);
/**
* Begin the leader sequence, resetting the buffer and timer.