diff options
author | Colin T.A. Gray <[email protected]> | 2017-12-05 11:59:53 -0700 |
---|---|---|
committer | Jack Humbert <[email protected]> | 2017-12-08 16:09:47 -0500 |
commit | 1620d78e73f8e01ed1d48255c655d9eb6cc1b135 (patch) | |
tree | 761d0d19cbcaff55b07970108e902e5101ff999a /tmk_core/common/action_layer.c | |
parent | fc54d62111204a01b75dc24a427c2f5aa2ea3c3c (diff) | |
download | qmk_firmware-0.5.186.tar.gz qmk_firmware-0.5.186.zip |
Performs the same bit comparison that the layer_move
functions perform
Diffstat (limited to 'tmk_core/common/action_layer.c')
-rw-r--r-- | tmk_core/common/action_layer.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index 277a8f5d95..46ea58727c 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -88,6 +88,16 @@ void layer_clear(void) layer_state_set(0); } +bool layer_state_is(uint8_t layer) +{ + return layer_state_cmp(layer_state, layer); +} + +bool layer_state_cmp(uint32_t cmp_layer_state, uint8_t layer) { + if (layer == 0) { return cmp_layer_state == 0; } + return (cmp_layer_state & (1UL<<layer)) > 0; +} + void layer_move(uint8_t layer) { layer_state_set(1UL<<layer); |