Skip to content

Commit

Permalink
Redefine IS_LAYER_ON/OFF() as aliases for existing layer functions (q…
Browse files Browse the repository at this point in the history
…mk#6352)

* Add IS_LAYER_ON_STATE()/IS_LAYER_OFF_STATE() macros

* Add docs for IS_LAYER_ON/OFF(_STATE) macros

* Remove IS_LAYER_ON/OFF_STATE redefinition in userspace

* Run clang-format on quantum/quantum.h

* Redefine IS_LAYER_ON/OFF(_STATE) as aliases of existing layer functions

Also update relevant doc entries.

Needs testing to check if this breaks existing IS_LAYER_ON/OFF usage in certain
edge cases (namely calling the macros with 0).

* Reformat layer check function docs
  • Loading branch information
vomindoraan authored and drashna committed Aug 9, 2020
1 parent 281a94c commit 6b318bd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions quantum/quantum.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,11 @@ void set_single_persistent_default_layer(uint8_t default_layer);

void tap_random_base64(void);

#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer)))
#define IS_LAYER_OFF(layer) (~layer_state & (1UL << (layer)))
#define IS_LAYER_ON(layer) layer_state_is(layer)
#define IS_LAYER_OFF(layer) !layer_state_is(layer)

#define IS_LAYER_ON_STATE(state, layer) layer_state_cmp(state, layer)
#define IS_LAYER_OFF_STATE(state, layer) !layer_state_cmp(state, layer)

void matrix_init_kb(void);
void matrix_scan_kb(void);
Expand Down

0 comments on commit 6b318bd

Please sign in to comment.