Skip to content

Commit

Permalink
feat: adds an helper function to check if layer lock is active
Browse files Browse the repository at this point in the history
  • Loading branch information
fdidron committed Mar 5, 2024
1 parent 983736e commit 5ab572b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions quantum/layer_lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ void layer_lock_task(void) {
}
# endif // LAYER_LOCK_IDLE_TIMEOUT > 0

bool are_any_layer_locked(void) {
return locked_layers != 0;
}


bool is_layer_locked(uint8_t layer) {
return locked_layers & ((layer_state_t)1 << layer);
}
Expand Down
3 changes: 3 additions & 0 deletions quantum/layer_lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
*/

#ifndef NO_ACTION_LAYER
/** Returns true if a layer is currently locked. */
bool are_any_layer_locked(void);

/** Returns true if `layer` is currently locked. */
bool is_layer_locked(uint8_t layer);

Expand Down

0 comments on commit 5ab572b

Please sign in to comment.