]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/cluepad/keymaps/default/keymap.c
Merge commit '73d890a2c9c34b905cd5e74e7146fdd4578dcb96' into add_visualizer
[qmk_firmware.git] / keyboards / cluepad / keymaps / default / keymap.c
1 #include "cluepad.h"
2
3 #include "backlight.h"
4 #include "rgblight.h"
5
6 // Each layer gets a name for readability, which is then used in the keymap matrix below.
7 // The underscores don't mean anything - you can have a layer called STUFF or any other name.
8 // Layer names don't all need to be of the same length, obviously, and you can also skip them
9 // entirely and just use numbers.
10 #define _BL 0
11 #define _FL 1
12 #define _RS 2
13
14 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
15   /* Keymap _BL: (Base Layer) Default Layer
16    * .-------------------.
17    * |NL F|   /|   *|   -|
18    * |-------------------|
19    * |   7|   8|   9|    |
20    * |--------------|    |
21    * |   4|   5|   6|   +|
22    * |-------------------|
23    * |   1|   2|   3|    |
24    * |--------------|    |
25    * |        0|   .| Ent|
26    * '-------------------'
27    */
28 [_BL] = KEYMAP(
29   LT(_FL, KC_NLCK), KC_PSLS, KC_PAST, KC_PMNS, \
30   KC_P7,            KC_P8,   KC_P9,   KC_PPLS, \
31   KC_P4,            KC_P5,   KC_P6, \
32   KC_P1,            KC_P2,   KC_P3,   KC_PENT, \
33   KC_P0,                     KC_PDOT),
34
35   /* Keymap _FL: Function Layer
36    * .-------------------.
37    * |NL F|    |    | Fn0|
38    * |-------------------|
39    * |    | Fn4|    |    |
40    * |--------------|    |
41    * | Fn3|BL_S| Fn2| Fn6|
42    * |-------------------|
43    * |    | Fn5|    |    |
44    * |--------------|    |
45    * |      Fn1|    | Fn7|
46    * '-------------------'
47    */
48 [_FL] = KEYMAP(
49   LT(_FL, KC_NLCK), KC_TRNS, KC_TRNS, F(0), \
50   KC_TRNS,          F(4),    KC_TRNS, F(6), \
51   F(3),             BL_STEP, F(2), \
52   KC_TRNS,          F(5),    KC_TRNS, F(7), \
53   F(1),                      KC_TRNS)
54 };
55
56 enum function_id {
57     RGBLED_TOGGLE,
58     RGBLED_STEP_MODE,
59     RGBLED_INCREASE_HUE,
60     RGBLED_DECREASE_HUE,
61     RGBLED_INCREASE_SAT,
62     RGBLED_DECREASE_SAT,
63     RGBLED_INCREASE_VAL,
64     RGBLED_DECREASE_VAL,
65 };
66
67 const uint16_t PROGMEM fn_actions[] = {
68   [0]  = ACTION_FUNCTION(RGBLED_TOGGLE),
69   [1]  = ACTION_FUNCTION(RGBLED_STEP_MODE),
70   [2]  = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
71   [3]  = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
72   [4]  = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
73   [5]  = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
74   [6]  = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
75   [7]  = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
76 };
77
78 void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
79   switch (id) {
80     case RGBLED_TOGGLE:
81       if (record->event.pressed) {
82         rgblight_toggle();
83       }
84       break;
85     case RGBLED_INCREASE_HUE:
86       if (record->event.pressed) {
87         rgblight_increase_hue();
88       }
89       break;
90     case RGBLED_DECREASE_HUE:
91       if (record->event.pressed) {
92         rgblight_decrease_hue();
93       }
94       break;
95     case RGBLED_INCREASE_SAT:
96       if (record->event.pressed) {
97         rgblight_increase_sat();
98       }
99       break;
100     case RGBLED_DECREASE_SAT:
101       if (record->event.pressed) {
102         rgblight_decrease_sat();
103       }
104       break;
105     case RGBLED_INCREASE_VAL:
106       if (record->event.pressed) {
107         rgblight_increase_val();
108       }
109       break;
110     case RGBLED_DECREASE_VAL:
111       if (record->event.pressed) {
112         rgblight_decrease_val();
113       }
114       break;
115     case RGBLED_STEP_MODE:
116       if (record->event.pressed) {
117         rgblight_step();
118       }
119       break;
120   }
121 }
122