diff options
Diffstat (limited to 'keyboards/claw44/lib/layer_state_reader.c')
| -rw-r--r-- | keyboards/claw44/lib/layer_state_reader.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/keyboards/claw44/lib/layer_state_reader.c b/keyboards/claw44/lib/layer_state_reader.c new file mode 100644 index 000000000..d92b6df58 --- /dev/null +++ b/keyboards/claw44/lib/layer_state_reader.c | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | |||
| 2 | #include QMK_KEYBOARD_H | ||
| 3 | #include <stdio.h> | ||
| 4 | #include "claw44.h" | ||
| 5 | |||
| 6 | #define L_BASE 0 | ||
| 7 | #define L_LOWER (1<<_LOWER) | ||
| 8 | #define L_RAISE (1<<_RAISE) | ||
| 9 | #define L_ADJUST (1<<_ADJUST) | ||
| 10 | #define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER) | ||
| 11 | |||
| 12 | char layer_state_str[24]; | ||
| 13 | |||
| 14 | const char *read_layer_state(void) { | ||
| 15 | switch (layer_state) | ||
| 16 | { | ||
| 17 | case L_BASE: | ||
| 18 | snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Default"); | ||
| 19 | break; | ||
| 20 | case L_RAISE: | ||
| 21 | snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Raise"); | ||
| 22 | break; | ||
| 23 | case L_LOWER: | ||
| 24 | snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Lower"); | ||
| 25 | break; | ||
| 26 | case L_ADJUST: | ||
| 27 | case L_ADJUST_TRI: | ||
| 28 | snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Adjust"); | ||
| 29 | break; | ||
| 30 | default: | ||
| 31 | snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Undef-%ld", layer_state); | ||
| 32 | } | ||
| 33 | |||
| 34 | return layer_state_str; | ||
| 35 | } | ||
