diff options
author | Albert Y <76888457+filterpaper@users.noreply.github.com> | 2023-04-10 00:37:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-09 09:37:31 -0700 |
commit | f5b74918837bacc5aaa98641428309380d591707 (patch) | |
tree | 54e452545a995599c9962515bd9838f78455fe45 | |
parent | 5d6d9594212073ca52b80a1a949510187af47b13 (diff) |
Add swap hands toggle functions (#20381)
-rw-r--r-- | docs/feature_swap_hands.md | 11 | ||||
-rw-r--r-- | quantum/action.c | 12 | ||||
-rw-r--r-- | quantum/action.h | 13 |
3 files changed, 33 insertions, 3 deletions
diff --git a/docs/feature_swap_hands.md b/docs/feature_swap_hands.md index 4d0d554093..e9c1d4b7ba 100644 --- a/docs/feature_swap_hands.md +++ b/docs/feature_swap_hands.md @@ -47,6 +47,11 @@ const uint8_t PROGMEM encoder_hand_swap_config[NUM_ENCODERS] = { 1, 0 }; ### Functions :id=functions -| Function | Description | -|----------------------|---------------------------------------------| -| `is_swap_hands_on()` | Returns true if Swap-Hands is currently on. | +User callback functions to manipulate Swap-Hands: + +| Function | Description | +|-----------------------|---------------------------------------------| +| `swap_hands_on()` | Turns Swap-Hands on. | +| `swap_hands_off()` | Turns Swap-Hands off. | +| `swap_hands_toggle()` | Toggles Swap-Hands. | +| `is_swap_hands_on()` | Returns true if Swap-Hands is currently on. | diff --git a/quantum/action.c b/quantum/action.c index dadb88e9df..9a6bbcca11 100644 --- a/quantum/action.c +++ b/quantum/action.c @@ -165,6 +165,18 @@ void set_swap_hands_state(size_t index, uint8_t *swap_state, bool on) { } } +void swap_hands_on(void) { + swap_hands = true; +} + +void swap_hands_off(void) { + swap_hands = false; +} + +void swap_hands_toggle(void) { + swap_hands = !swap_hands; +} + bool is_swap_hands_on(void) { return swap_hands; } diff --git a/quantum/action.h b/quantum/action.h index 8ef6db6781..2a2c294c5a 100644 --- a/quantum/action.h +++ b/quantum/action.h @@ -85,12 +85,25 @@ typedef uint32_t swap_state_row_t; # endif /** + * @brief Enable swap hands + */ +void swap_hands_on(void); +/** + * @brief Disable swap hands + */ +void swap_hands_off(void); +/** + * @brief Toggle swap hands enable state + */ +void swap_hands_toggle(void); +/** * @brief Get the swap hands enable state * * @return true * @return false */ bool is_swap_hands_on(void); + void process_hand_swap(keyevent_t *record); #endif |