qmk

QMK Firmware
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

layer_state_reader.c (806B)


      1 
      2 #include QMK_KEYBOARD_H
      3 #include <stdio.h>
      4 #include "lily58.h"
      5 
      6 #define L_BASE 0
      7 #define L_LOWER 2
      8 #define L_RAISE 4
      9 #define L_ADJUST 8
     10 #define L_ADJUST_TRI 14
     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 }