1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#include <stdbool.h>
#include <stdint.h>
/**
* \file
*
* \defgroup leader Leader Key
* \{
*/
/**
* \brief User callback, invoked when the leader sequence begins.
*/
void leader_start_user(void);
/**
* \brief User callback, invoked when the leader sequence ends.
*/
void leader_end_user(void);
/**
* Begin the leader sequence, resetting the buffer and timer.
*/
void leader_start(void);
/**
* End the leader sequence.
*/
void leader_end(void);
void leader_task(void);
/**
* Whether the leader sequence is active.
*/
bool leader_sequence_active(void);
/**
* Add the given keycode to the sequence buffer.
*
* If `LEADER_NO_TIMEOUT` is defined, the timer is reset if the buffer is empty.
*
* \param keycode The keycode to add.
*
* \return `true` if the keycode was added, `false` if the buffer is full.
*/
bool leader_sequence_add(uint16_t keycode);
/**
* Whether the leader sequence has reached the timeout.
*
* If `LEADER_NO_TIMEOUT` is defined, the buffer must also contain at least one key.
*/
bool leader_sequence_timed_out(void);
/**
* Reset the leader sequence timer.
*/
void leader_reset_timer(void);
/**
* Check the sequence buffer for the given keycode.
*
* \param kc The keycode to check.
*
* \return `true` if the sequence buffer matches.
*/
bool leader_sequence_one_key(uint16_t kc);
/**
* Check the sequence buffer for the given keycodes.
*
* \param kc1 The first keycode to check.
* \param kc2 The second keycode to check.
*
* \return `true` if the sequence buffer matches.
*/
bool leader_sequence_two_keys(uint16_t kc1, uint16_t kc2);
/**
* Check the sequence buffer for the given keycodes.
*
* \param kc1 The first keycode to check.
* \param kc2 The second keycode to check.
* \param kc3 The third keycode to check.
*
* \return `true` if the sequence buffer matches.
*/
bool leader_sequence_three_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3);
/**
* Check the sequence buffer for the given keycodes.
*
* \param kc1 The first keycode to check.
* \param kc2 The second keycode to check.
* \param kc3 The third keycode to check.
* \param kc4 The fourth keycode to check.
*
* \return `true` if the sequence buffer matches.
*/
bool leader_sequence_four_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4);
/**
* Check the sequence buffer for the given keycodes.
*
* \param kc1 The first keycode to check.
* \param kc2 The second keycode to check.
* \param kc3 The third keycode to check.
* \param kc4 The fourth keycode to check.
* \param kc5 The fifth keycode to check.
*
* \return `true` if the sequence buffer matches.
*/
bool leader_sequence_five_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4, uint16_t kc5);
/** \} */
|