summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Johnson <josh@joshajohnson.com>2020-02-25 01:14:09 +1100
committerGitHub <noreply@github.com>2020-02-24 14:14:09 +0000
commita2c0c1479cbe527cfa223b4957d230bf1e8a431f (patch)
treecf7cbbe4794a9045136aab24e321b48211dac8a5
parent20e1c8c571ba1d197421ff14555bf2ab873a080f (diff)
Hub16 - Bug removal + clean up code (#8227)
* bugfixes + cleaned up code

* typo

* Update keyboards/hub16/keymaps/no_mod/keymap.c

Co-Authored-By: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
-rwxr-xr-xkeyboards/hub16/keymaps/default/keymap.c19
-rwxr-xr-xkeyboards/hub16/keymaps/no_mod/keymap.c37
2 files changed, 38 insertions, 18 deletions
diff --git a/keyboards/hub16/keymaps/default/keymap.c b/keyboards/hub16/keymaps/default/keymap.c
index a77c8bc782..2d12dba0d4 100755
--- a/keyboards/hub16/keymaps/default/keymap.c
+++ b/keyboards/hub16/keymaps/default/keymap.c
@@ -18,16 +18,22 @@
 // Function key we are 'wrapping' usual key presses in
 #define KC_WRAP KC_F24
 
+// Keyboard Layers
+enum keyboard_layers{
+    _BASE = 0,
+    _CONTROL
+};
+
 // Tap Dance Declarations
-enum { TD_TO_LED = 0, TD_TO_DEFAULT = 1 };
+enum tap_dance { TD_TO_LED = 0, TD_TO_DEFAULT = 1 };
 
 qk_tap_dance_action_t tap_dance_actions[] = {
-    // Tap once for HID, twice to toggle layer 1
-    [TD_TO_LED]     = ACTION_TAP_DANCE_DUAL_ROLE(_______, 1),
-    [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(_______, 0)};
+    // Tap once for standard key, twice to toggle to control layer
+    [TD_TO_LED]     = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _CONTROL),
+    [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _BASE)};
 
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-  [0] = LAYOUT( /* Base */
+  [_BASE] = LAYOUT( /* Base */
         KC_S,      KC_V,    
     KC_A, KC_B, KC_C, KC_D, 
     KC_E, KC_F, KC_G, KC_H, 
@@ -35,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     KC_M, KC_N, KC_O, TD(TD_TO_LED) 
   ),
 
-  [1] = LAYOUT( /* LED Control */
+  [_CONTROL] = LAYOUT( /* LED Control */
           KC_NO,            KC_NO,        
     _______, RGB_MOD, RGB_RMOD, RGB_TOG,
     RGB_VAD, RGB_VAI, RGB_HUD,  RGB_HUI, 
@@ -72,7 +78,6 @@ void encoder_update_user(uint8_t index, bool clockwise) {
 
 // Below stolen from TaranVH (https://github.com/TaranVH/2nd-keyboard/blob/master/HASU_USB/F24/keymap.c)
 // Shoutout to drashna on the QMK discord for basically writing this for me.... :P
-
 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
     static uint8_t f24_tracker;
     switch (keycode) {
diff --git a/keyboards/hub16/keymaps/no_mod/keymap.c b/keyboards/hub16/keymaps/no_mod/keymap.c
index c86ffcc16d..7c57ffbfe2 100755
--- a/keyboards/hub16/keymaps/no_mod/keymap.c
+++ b/keyboards/hub16/keymaps/no_mod/keymap.c
@@ -15,19 +15,22 @@
  */
 #include QMK_KEYBOARD_H
 
-// Function key we are 'wrapping' usual key presses in
-#define KC_WRAP KC_F24
+// Keyboard Layers
+enum keyboard_layers{
+    _BASE = 0,
+    _CONTROL
+};
 
 // Tap Dance Declarations
-enum { TD_TO_LED = 0, TD_TO_DEFAULT = 1 };
+enum tap_dance { TD_TO_LED = 0, TD_TO_DEFAULT = 1 };
 
 qk_tap_dance_action_t tap_dance_actions[] = {
-    // Tap once for HID, twice to toggle layer 1
-    [TD_TO_LED]     = ACTION_TAP_DANCE_DUAL_ROLE(_______, 1),
-    [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(_______, 0)};
+    // Tap once for standard key, twice to toggle to control layer
+    [TD_TO_LED]     = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _CONTROL),
+    [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _BASE)};
 
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-  [0] = LAYOUT( /* Base */
+  [_BASE] = LAYOUT( /* Base */
         KC_S,      KC_V,    
     KC_A, KC_B, KC_C, KC_D, 
     KC_E, KC_F, KC_G, KC_H, 
@@ -35,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     KC_M, KC_N, KC_O, TD(TD_TO_LED) 
   ),
 
-  [1] = LAYOUT( /* LED Control */
+  [_CONTROL] = LAYOUT( /* LED Control */
           KC_NO,            KC_NO,        
     _______, RGB_MOD, RGB_RMOD, RGB_TOG,
     RGB_VAD, RGB_VAI, RGB_HUD,  RGB_HUI, 
@@ -44,8 +47,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
   ),
 };
 
-// Keyboard is setup to 'warp' the pressed key with F24,
-// allowing for easy differentiation from a real keyboard.
 void encoder_update_user(uint8_t index, bool clockwise) {
     if (index == 0) { /* Left Encoder */
         if (clockwise) {
@@ -60,4 +61,18 @@ void encoder_update_user(uint8_t index, bool clockwise) {
             tap_code(KC_T);
         }
     }
-}
\ No newline at end of file
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+  switch (keycode) {
+    // Example of "pressing" CONTROL+SHIFT+V instead of "A" on keyboard
+    // More info: https://docs.qmk.fm/#/feature_macros
+    // case KC_A:
+    //   if (record->event.pressed) {
+    //     SEND_STRING(SS_LCTL(SS_LSFT("v")));
+    //   } else {
+    //   }
+    //   break; 
+  }
+  return true;
+};