]> git.donarmstrong.com Git - tmk_firmware.git/blobdiff - keyboard/ergodox/keymap_cub.h
Added example how to handle custom keys
[tmk_firmware.git] / keyboard / ergodox / keymap_cub.h
index 896bb9147bff81ee306d968be24268eaad48359c..cfe0b29a7f97b6e2024d8a534bc01225616ed73f 100644 (file)
@@ -145,7 +145,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
         // right hand
              SLCK,NLCK,PSLS,PAST,PAST,PMNS,BSPC,
              TRNS,NO,  P7,  P8,  P9,  PMNS,PGUP,
-                  TRNS,P4,  P5,  P6,  PPLS,PGDN,
+                  NO,  P4,  P5,  P6,  PPLS,PGDN,
              TRNS,NO,  P1,  P2,  P3,  PPLS,PENT,
                        P0,  PDOT,SLSH,PENT,PENT,
         TRNS,TRNS,
@@ -224,7 +224,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
         TRNS,TRNS,TRNS
     ),
 
-    KEYMAP(  // Layer6: F-keys, Teensy, Workman-layer switch, leftled:top/white+onboard
+    KEYMAP(  // Layer6: F-keys + utils(Teensy, Workman-layer switch), leftled:top/white+onboard
         // left hand
         TRNS,F1,  F2,  F3,  F4,  F5,  F6,
         FN0, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
@@ -267,7 +267,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
                        TRNS,TRNS,TRNS,TRNS,TRNS,
         TRNS,TRNS,
         TRNS,
-        TRNS,TRNS,TRNS
+        SLEP,TRNS,TRNS
     ),
 
     KEYMAP(  // Layer8: mouse and navigation, leftled:mid/blue+bot/green
@@ -282,7 +282,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
                                  TRNS,TRNS,TRNS,
 
         // right hand
-             TRNS,NO,  NO,  NO,  NO,  NO,  NO,
+             TRNS,MPLY,MPRV,MNXT,VOLD,VOLU,MUTE,
              TRNS,BTN2,WH_L,WH_U,WH_D,WH_R,PGUP,
                   BTN1,MS_L,MS_U,MS_D,MS_R,PGDN,
              TRNS,BTN3,HOME,END, DEL, INS, NO,
@@ -342,6 +342,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 /* id for user defined functions */
 enum function_id {
     TEENSY_KEY,
+    CUSTOM_KEY,
     L_CTRL_ALT_ENT,
     R_CTRL_ALT_ENT,
 };
@@ -375,21 +376,25 @@ static const uint16_t PROGMEM fn_actions[] = {
     [18] =  ACTION_LAYER_SET(1, ON_BOTH),                   // FN18 - set Layer1, to use Workman layout at firmware level
     [19] =  ACTION_LAYER_SET(2, ON_BOTH),                   // FN19 - set Layer2, to use with Numpad keys
 
-    [20] =  ACTION_LAYER_MOMENTARY(2),                      // FN20 - momentary Layer2, to use with Numpad keys
     [21] =  ACTION_FUNCTION_TAP(L_CTRL_ALT_ENT),            // FN21 - momentary Layer5+CTRL+ALT on Enter, to use with F* keys on top row
-    [22] =  ACTION_FUNCTION_TAP(R_CTRL_ALT_ENT),            // FN22 - momentary Layer6+CTRL+ALT on Enter, to use with F* keys on top row, Teensy, Workman-layer switch
+    [22] =  ACTION_FUNCTION_TAP(R_CTRL_ALT_ENT),            // FN22 - momentary Layer6+CTRL+ALT on Enter, to use with F* keys on top row + utils
+
+    [28] =  ACTION_LAYER_TAP_KEY(4, KC_A),                  // FN28 = momentary Layer4 on A key, to use with unconvenient keys
+    [29] =  ACTION_LAYER_TAP_KEY(3, KC_S),                  // FN29 = momentary Layer3 on S key, to use with F* keys
+    [30] =  ACTION_LAYER_TAP_KEY(8, KC_D),                  // FN30 = momentary Layer8 on D key, to use with mouse and navigation keys
+    [31] =  ACTION_LAYER_TAP_KEY(2, KC_F),                  // FN31 = momentary Layer2 on F key, to use with Numpad keys
+
+    // i'd like to remove this - will try to get used to live without this and convert them to usual keys
+    [20] =  ACTION_LAYER_MOMENTARY(2),                      // FN20 - momentary Layer2, to use with Numpad keys
+// or
+//  [20] =  ACTION_FUNCTION_TAP(CUSTOM_KEY),                // FN20 - use custom key, with tapping support
+
     [23] =  ACTION_LAYER_TAP_KEY(7, KC_BSLS),               // FN23 - momentary Layer7 on ' , to use with F* keys (F1-F24)
 
     [24] =  ACTION_LAYER_TAP_KEY(4, KC_Z),                  // FN24 = momentary Layer4 on Z key, to use with unconvenient keys
     [25] =  ACTION_LAYER_TAP_KEY(3, KC_X),                  // FN25 = momentary Layer3 on X key, to use with F* keys
     [26] =  ACTION_LAYER_TAP_KEY(8, KC_C),                  // FN26 = momentary Layer8 on C key, to use with mouse and navigation keys
     [27] =  ACTION_LAYER_TAP_KEY(2, KC_V),                  // FN27 = momentary Layer2 on V key, to use with Numpad keys
-
-    // i'd like to remove this - will try to get used to live without this and convert them to usual keys
-    [28] =  ACTION_LAYER_TAP_KEY(4, KC_A),                  // FN28 = momentary Layer4 on A key, to use with unconvenient keys
-    [29] =  ACTION_LAYER_TAP_KEY(3, KC_S),                  // FN29 = momentary Layer3 on S key, to use with F* keys
-    [30] =  ACTION_LAYER_TAP_KEY(8, KC_D),                  // FN30 = momentary Layer8 on D key, to use with mouse and navigation keys
-    [31] =  ACTION_LAYER_TAP_KEY(2, KC_F),                  // FN31 = momentary Layer2 on F key, to use with Numpad keys
 };
 
 void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
@@ -436,5 +441,44 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
             }
         }
     }
+
+
+/*
+ * just an example of custom key implementation
+ * not really needed with custom keymap_fn_to_action(),
+ * because it will allow you to have 32 FN** keys on EACH layer
+ */
+
+/*
+    keyevent_t event = record->event;
+
+    if (id == CUSTOM_KEY) {
+        uint8_t layer = biton32(layer_state);
+        uint8_t col = event.key.col;
+        uint8_t row = event.key.row;
+        uint8_t handled = 0;
+
+        if (event.pressed) {
+            if (layer == XXX && col == XXX && row == XXX) {
+                    action_macro_play(
+                        MACRO(
+                            ...........
+                        END)
+                    );
+                    handled++;
+                }
+            }
+        }
+
+        if (!handled) {
+            print("custom key not handled");
+            print(": layer "); pdec(layer);
+            print(", col "); pdec(col);
+            print(", row "); pdec(row);
+            print("\n");
+        }
+    }
+*/
+
 }