Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add swap hands toggle functions #20381

Merged
merged 1 commit into from
Apr 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions docs/feature_swap_hands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
12 changes: 12 additions & 0 deletions quantum/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
13 changes: 13 additions & 0 deletions quantum/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,26 @@ typedef uint32_t swap_state_row_t;
# error "MATRIX_COLS: invalid value"
# 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

Expand Down