From 5ab572bcf3e81d8de561b4a8475fd73e638f5244 Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 5 Mar 2024 21:05:56 +0700 Subject: [PATCH] feat: adds an helper function to check if layer lock is active --- quantum/layer_lock.c | 5 +++++ quantum/layer_lock.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/quantum/layer_lock.c b/quantum/layer_lock.c index 3eaf0305b404..039522478247 100644 --- a/quantum/layer_lock.c +++ b/quantum/layer_lock.c @@ -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); } diff --git a/quantum/layer_lock.h b/quantum/layer_lock.h index 40abfa1ffd44..d5235754b027 100644 --- a/quantum/layer_lock.h +++ b/quantum/layer_lock.h @@ -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);