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

feat: adds an helper function to check if layer lock is active #386

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 5 additions & 0 deletions quantum/layer_lock.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2023 Google LLC

Check failure on line 1 in quantum/layer_lock.c

View workflow job for this annotation

GitHub Actions / lint

Requires Formatting
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,6 +31,11 @@
}
# 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
@@ -1,4 +1,4 @@
// Copyright 2022-2023 Google LLC

Check failure on line 1 in quantum/layer_lock.h

View workflow job for this annotation

GitHub Actions / lint

Requires Formatting
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down 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
Loading