aboutsummaryrefslogtreecommitdiffstats
path: root/keyboards/crkbd/keymaps/lib/layer_state_reader.c
diff options
context:
space:
mode:
authorGravatar Kosuke Adachi <ks@fstn.jp>2018-06-09 07:28:28 +0900
committerGravatar Drashna Jaelre <drashna@live.com>2018-06-08 15:28:28 -0700
commit710937e4ef1e14d82261fc439aa6fcfcdbd64bf5 (patch)
tree6226a1d3027634af4b4508dce101ff938f356782 /keyboards/crkbd/keymaps/lib/layer_state_reader.c
parent300cf977c93b9b37a57643ddbfa8d0bd13b29e18 (diff)
downloadqmk_firmware-710937e4ef1e14d82261fc439aa6fcfcdbd64bf5.tar.gz
Add corne keyboard (#3119)
* Fork from helix * Move rev2 to rev1 * Remove unused settings * Move split_util to outof rev * Setup KEYMAP for crkbd * Remove old image * Move keymaps directory and glcdfont.c * Remove AUDIO in keymap * Show keylog * Show keylogs * Show time log * Remove EISU/KANA * Use KEYMAP_kc * Remove iota_gfx_record_user wrapping * Remove unused settings for layer * Add keylogger.c * Fix uppercase letters to lower * Add timelogger.c * Default RGBLED_NUM = 27 * Remove unused setting * Add mode icon reader * Add matrix_write_ln * Add layer_state_reader * Move to lib directory * Rename functions * Add host_led_state_reader * Add logo_reader * Cleaning of iota_gfx_task * Fix bugs and add key defines * Remove unnecessary comments * Update crkbd readme * Move libs to lib directories * Rename KEYMAP to LAYOUT
Diffstat (limited to 'keyboards/crkbd/keymaps/lib/layer_state_reader.c')
-rw-r--r--keyboards/crkbd/keymaps/lib/layer_state_reader.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/keyboards/crkbd/keymaps/lib/layer_state_reader.c b/keyboards/crkbd/keymaps/lib/layer_state_reader.c
new file mode 100644
index 000000000..f79720d6f
--- /dev/null
+++ b/keyboards/crkbd/keymaps/lib/layer_state_reader.c
@@ -0,0 +1,33 @@
+#include "crkbd.h"
+
+#define L_BASE 0
+#define L_LOWER 8
+#define L_RAISE 16
+#define L_ADJUST 65536
+#define L_ADJUST_TRI 65560
+
+char layer_state_str[40];
+
+char *read_layer_state(void)
+{
+ switch (layer_state)
+ {
+ 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:
+ snprintf(layer_state_str,sizeof(layer_state_str), "Layer: Undef-%ld", layer_state);
+ }
+
+ return layer_state_str;
+}