2018-08-22 16:51:37 +00:00
|
|
|
|
|
|
|
#include QMK_KEYBOARD_H
|
|
|
|
#include <stdio.h>
|
2018-06-08 22:28:28 +00:00
|
|
|
#include "crkbd.h"
|
|
|
|
|
2019-04-18 21:02:32 +00:00
|
|
|
// in the future, should use (1U<<_LAYER_NAME) instead, but needs to be moved to keymap,c
|
2018-06-08 22:28:28 +00:00
|
|
|
#define L_BASE 0
|
2019-04-18 21:02:32 +00:00
|
|
|
#define L_LOWER 2
|
|
|
|
#define L_RAISE 4
|
|
|
|
#define L_ADJUST 8
|
|
|
|
#define L_ADJUST_TRI 14
|
2018-06-08 22:28:28 +00:00
|
|
|
|
2018-08-22 16:51:37 +00:00
|
|
|
char layer_state_str[24];
|
2018-06-08 22:28:28 +00:00
|
|
|
|
2018-08-22 16:51:37 +00:00
|
|
|
const char *read_layer_state(void) {
|
2018-06-08 22:28:28 +00:00
|
|
|
switch (layer_state)
|
|
|
|
{
|
2018-08-22 16:51:37 +00:00
|
|
|
case L_BASE:
|
|
|
|
snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Default");
|
|
|
|
break;
|
|
|
|
case L_RAISE:
|
|
|
|
snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Raise");
|
|
|
|
break;
|
|
|
|
case L_LOWER:
|
|
|
|
snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Lower");
|
|
|
|
break;
|
|
|
|
case L_ADJUST:
|
|
|
|
case L_ADJUST_TRI:
|
|
|
|
snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Adjust");
|
|
|
|
break;
|
|
|
|
default:
|
2022-07-31 19:36:30 +00:00
|
|
|
#if defined (LAYER_STATE_32BIT)
|
2018-08-22 16:51:37 +00:00
|
|
|
snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Undef-%ld", layer_state);
|
2022-07-31 19:36:30 +00:00
|
|
|
#else
|
|
|
|
snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Undef-%d", layer_state);
|
|
|
|
#endif
|
2018-06-08 22:28:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return layer_state_str;
|
|
|
|
}
|