From df3a81b31ea608836670e4222ae5ba8507cc147c Mon Sep 17 00:00:00 2001
From: Ralph Azucena <ralphie02@users.noreply.github.com>
Date: Sun, 6 Dec 2020 10:11:59 -0800
Subject: [PATCH] [Keyboard] Added a dactyl promicro rah (#10889)

* Added a dactyl promicro with a slightly different 6x6 layout

* updated keyboard layout

* Removed description as per code review

* refactored as per code review

* removed redundant config.h file

* removed and updated a couple of lines in rules.mk

* replaced symlink with copy of file

* removed lines in readme

* Update readme.md

Co-authored-by: ralphie02 <ralph.azucena@carbon60.com>
---
 keyboards/handwired/dactyl_rah/config.h       | 78 +++++++++++++++++
 keyboards/handwired/dactyl_rah/dactyl_rah.c   | 16 ++++
 keyboards/handwired/dactyl_rah/dactyl_rah.h   | 44 ++++++++++
 keyboards/handwired/dactyl_rah/info.json      | 83 +++++++++++++++++++
 .../dactyl_rah/keymaps/default/keymap.c       | 47 +++++++++++
 .../dactyl_rah/keymaps/right/config.h         | 19 +++++
 .../dactyl_rah/keymaps/right/keymap.c         | 47 +++++++++++
 keyboards/handwired/dactyl_rah/readme.md      |  1 +
 keyboards/handwired/dactyl_rah/rules.mk       | 23 +++++
 9 files changed, 358 insertions(+)
 create mode 100644 keyboards/handwired/dactyl_rah/config.h
 create mode 100644 keyboards/handwired/dactyl_rah/dactyl_rah.c
 create mode 100644 keyboards/handwired/dactyl_rah/dactyl_rah.h
 create mode 100644 keyboards/handwired/dactyl_rah/info.json
 create mode 100644 keyboards/handwired/dactyl_rah/keymaps/default/keymap.c
 create mode 100644 keyboards/handwired/dactyl_rah/keymaps/right/config.h
 create mode 100644 keyboards/handwired/dactyl_rah/keymaps/right/keymap.c
 create mode 100644 keyboards/handwired/dactyl_rah/readme.md
 create mode 100644 keyboards/handwired/dactyl_rah/rules.mk

diff --git a/keyboards/handwired/dactyl_rah/config.h b/keyboards/handwired/dactyl_rah/config.h
new file mode 100644
index 0000000000..2ffe4e8a52
--- /dev/null
+++ b/keyboards/handwired/dactyl_rah/config.h
@@ -0,0 +1,78 @@
+/*
+Copyright 2020 Ralph Azucena <ralphie02@live.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#pragma once
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID       0xFEED
+#define PRODUCT_ID      0x3060
+#define DEVICE_VER      0x0001
+#define MANUFACTURER    ralphie02
+#define PRODUCT         DACTYL_RAH
+
+/* key matrix size */
+// Rows are doubled-up
+#define MATRIX_ROWS 12
+#define MATRIX_COLS 6
+
+// wiring of each half
+#define MATRIX_COL_PINS { D4, C6, D7, E6, B4, B5 }
+#define MATRIX_ROW_PINS { F6, F7, B1, B3, B2, B6 }
+
+#define DIODE_DIRECTION COL2ROW
+
+/* mouse config */
+#define MOUSEKEY_DELAY          0
+// Lowering MOUSEKEY_INTERVAL raises the cursor speed significantly, you may want to lower MOUSEKEY_MAX_SPEED (default: 10)
+#define MOUSEKEY_INTERVAL       20
+#define MOUSEKEY_MAX_SPEED       7
+#define MOUSEKEY_WHEEL_DELAY 0
+
+/* layer config */
+#define TAPPING_TOGGLE 1
+
+/* serial.c configuration for split keyboard */
+#define SOFT_SERIAL_PIN D0
+
+/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
+#define LOCKING_SUPPORT_ENABLE
+
+/* Locking resynchronize hack */
+#define LOCKING_RESYNC_ENABLE
+
+/* Enables This makes it easier for fast typists to use dual-function keys */
+#define PERMISSIVE_HOLD
+
+// Feature disable options
+// These options are also useful to firmware size reduction.
+
+/* disable print */
+// #define NO_DEBUG
+// #define NO_PRINT
+
+/* disable action features */
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
+
+
+/* disable these deprecated features by default */
+#define NO_ACTION_MACRO
+#define NO_ACTION_FUNCTION
+
diff --git a/keyboards/handwired/dactyl_rah/dactyl_rah.c b/keyboards/handwired/dactyl_rah/dactyl_rah.c
new file mode 100644
index 0000000000..0058d87992
--- /dev/null
+++ b/keyboards/handwired/dactyl_rah/dactyl_rah.c
@@ -0,0 +1,16 @@
+ /* Copyright 2020 Ralph Azucena <ralphie02@live.com>
+  * This program is free software: you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+  * the Free Software Foundation, either version 2 of the License, or
+  * (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  */
+
+#include "dactyl_rah.h"
diff --git a/keyboards/handwired/dactyl_rah/dactyl_rah.h b/keyboards/handwired/dactyl_rah/dactyl_rah.h
new file mode 100644
index 0000000000..27302d3e23
--- /dev/null
+++ b/keyboards/handwired/dactyl_rah/dactyl_rah.h
@@ -0,0 +1,44 @@
+ /* Copyright 2020 Ralph Azucena <ralphie02@live.com>
+  * This program is free software: you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+  * the Free Software Foundation, either version 2 of the License, or
+  * (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  */
+
+#pragma once
+
+#include "quantum.h"
+
+#define LAYOUT_6x6(\
+    L00, L01, L02, L03, L04, L05,                       R00, R01, R02, R03, R04, R05, \
+    L10, L11, L12, L13, L14, L15,                       R10, R11, R12, R13, R14, R15, \
+    L20, L21, L22, L23, L24, L25,                       R20, R21, R22, R23, R24, R25, \
+    L30, L31, L32, L33, L34, L35,                       R30, R31, R32, R33, R34, R35, \
+    L40, L41, L42, L43, L44,                                 R41, R42, R43, R44, R45, \
+                                  L55, L54,  R51, R50,                                \
+                                       L53,  R52,                                     \
+                             L50, L51, L52,  R53, R54, R55                            \
+    )\
+    {\
+        { L00, L01, L02, L03, L04, L05 },   \
+        { L10, L11, L12, L13, L14, L15 },   \
+        { L20, L21, L22, L23, L24, L25 },   \
+        { L30, L31, L32, L33, L34, L35 },   \
+        { L40, L41, L42, L43, L44, KC_NO }, \
+        { L50, L51, L52, L53, L54, L55 },   \
+                                            \
+        { R00, R01, R02, R03, R04, R05 },   \
+        { R10, R11, R12, R13, R14, R15 },   \
+        { R20, R21, R22, R23, R24, R25 },   \
+        { R30, R31, R32, R33, R34, R35 },   \
+      { KC_NO, R41, R42, R43, R44, R45 },   \
+        { R50, R51, R52, R53, R54, R55 }    \
+}
diff --git a/keyboards/handwired/dactyl_rah/info.json b/keyboards/handwired/dactyl_rah/info.json
new file mode 100644
index 0000000000..7841988d0c
--- /dev/null
+++ b/keyboards/handwired/dactyl_rah/info.json
@@ -0,0 +1,83 @@
+{
+  "keyboard_name": "Dactyl RAH",
+  "url": "https://qmk.fm/keyboards/",
+  "maintainer": "ralphie02",
+  "width": 17,
+  "height": 8,
+  "layouts": {
+      "LAYOUT_6x6": {
+          "layout": [
+              {"label":"L00", "x":0, "y":0},
+              {"label":"L01", "x":1, "y":0},
+              {"label":"L02", "x":2, "y":0},
+              {"label":"L03", "x":3, "y":0},
+              {"label":"L04", "x":4, "y":0},
+              {"label":"L05", "x":5, "y":0},
+              {"label":"R00", "x":11, "y":0},
+              {"label":"R01", "x":12, "y":0},
+              {"label":"R02", "x":13, "y":0},
+              {"label":"R03", "x":14, "y":0},
+              {"label":"R04", "x":15, "y":0},
+              {"label":"R05", "x":16, "y":0},
+              {"label":"L10", "x":0, "y":1},
+              {"label":"L11", "x":1, "y":1},
+              {"label":"L12", "x":2, "y":1},
+              {"label":"L13", "x":3, "y":1},
+              {"label":"L14", "x":4, "y":1},
+              {"label":"L15", "x":5, "y":1},
+              {"label":"R10", "x":11, "y":1},
+              {"label":"R11", "x":12, "y":1},
+              {"label":"R12", "x":13, "y":1},
+              {"label":"R13", "x":14, "y":1},
+              {"label":"R14", "x":15, "y":1},
+              {"label":"R15", "x":16, "y":1},
+              {"label":"L20", "x":0, "y":2},
+              {"label":"L21", "x":1, "y":2},
+              {"label":"L22", "x":2, "y":2},
+              {"label":"L23", "x":3, "y":2},
+              {"label":"L24", "x":4, "y":2},
+              {"label":"L25", "x":5, "y":2},
+              {"label":"R20", "x":11, "y":2},
+              {"label":"R21", "x":12, "y":2},
+              {"label":"R22", "x":13, "y":2},
+              {"label":"R23", "x":14, "y":2},
+              {"label":"R24", "x":15, "y":2},
+              {"label":"R25", "x":16, "y":2},
+              {"label":"L30", "x":0, "y":3},
+              {"label":"L31", "x":1, "y":3},
+              {"label":"L32", "x":2, "y":3},
+              {"label":"L33", "x":3, "y":3},
+              {"label":"L34", "x":4, "y":3},
+              {"label":"L35", "x":5, "y":3},
+              {"label":"R30", "x":11, "y":3},
+              {"label":"R31", "x":12, "y":3},
+              {"label":"R32", "x":13, "y":3},
+              {"label":"R33", "x":14, "y":3},
+              {"label":"R34", "x":15, "y":3},
+              {"label":"R35", "x":16, "y":3},
+              {"label":"L40", "x":0, "y":4},
+              {"label":"L41", "x":1, "y":4},
+              {"label":"L42", "x":2, "y":4},
+              {"label":"L43", "x":3, "y":4},
+              {"label":"L44", "x":4, "y":4},
+              {"label":"R41", "x":12, "y":4},
+              {"label":"R42", "x":13, "y":4},
+              {"label":"R43", "x":14, "y":4},
+              {"label":"R44", "x":15, "y":4},
+              {"label":"R45", "x":16, "y":4},
+              {"label":"L55", "x":6, "y":5},
+              {"label":"L54", "x":7, "y":5},
+              {"label":"R51", "x":9, "y":5},
+              {"label":"R50", "x":10, "y":5},
+              {"label":"L53", "x":7, "y":6},
+              {"label":"R52", "x":9, "y":6},
+              {"label":"L50", "x":5, "y":7, "h":2},
+              {"label":"L51", "x":6, "y":7, "h":2},
+              {"label":"L52", "x":7, "y":7},
+              {"label":"R53", "x":9, "y":7},
+              {"label":"R54", "x":10, "y":7, "h":2},
+              {"label":"R55", "x":11, "y":7, "h":2}
+          ]
+      }
+  }
+}
diff --git a/keyboards/handwired/dactyl_rah/keymaps/default/keymap.c b/keyboards/handwired/dactyl_rah/keymaps/default/keymap.c
new file mode 100644
index 0000000000..6b07051c4b
--- /dev/null
+++ b/keyboards/handwired/dactyl_rah/keymaps/default/keymap.c
@@ -0,0 +1,47 @@
+ /* Copyright 2020 Ralph Azucena <ralphie02@live.com>
+  * This program is free software: you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+  * the Free Software Foundation, either version 2 of the License, or
+  * (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  */
+
+#include QMK_KEYBOARD_H
+
+#define BASE 0
+#define NAV 1
+
+#define CTL_ESC LCTL_T(KC_ESC)
+#define CTL_CAP LCTL_T(KC_CAPS)
+#define ALT_BSP LALT_T(KC_BSPC)
+#define LT_SCLN LT(NAV, KC_SCLN)
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    [BASE] = LAYOUT_6x6(
+        KC_GRV , KC_1  ,KC_2   , KC_3  , KC_4  , KC_5  ,                                         KC_6  , KC_7  , KC_8  , KC_9  , KC_0  ,KC_HOME,
+        KC_TAB , KC_Q  ,KC_W   , KC_E  , KC_R  , KC_T  ,                                         KC_Y  , KC_U  , KC_I  , KC_O  , KC_P  ,KC_BSLS,
+        CTL_CAP, KC_A  ,KC_S   , KC_D  , KC_F  , KC_G  ,                                         KC_H  , KC_J  , KC_K  , KC_L  ,LT_SCLN,KC_QUOT,
+        KC_LSFT, KC_Z  ,KC_X   , KC_C  , KC_V  , KC_B  ,                                         KC_N  , KC_M  ,KC_COMM, KC_DOT,KC_SLSH,KC_RSFT,
+        CTL_ESC,KC_MINS,KC_EQL ,KC_LBRC,KC_RBRC,                                                        KC_LEFT,KC_DOWN, KC_UP ,KC_RGHT,KC_END ,
+                                                        TT(NAV),KC_DEL ,        KC_PGUP,KC_RCTL,
+                                                                KC_LGUI,        KC_PGDN,
+                                                KC_BSPC,CTL_ESC,KC_LALT,        KC_RALT,KC_ENT ,KC_SPC
+    ),
+    [NAV] = LAYOUT_6x6(
+         RESET , KC_NO ,KC_MPRV,KC_MPLY,KC_MNXT, KC_NO ,                                        KC_BRIU,  KC_7 , KC_8  , KC_9  , KC_NO , RESET ,
+        _______,KC_VOLU,KC_WBAK,KC_MS_U,KC_WFWD,KC_WH_U,                                        KC_BRID,  KC_4 , KC_5  , KC_6  , KC_NO , KC_F9 ,
+        _______,KC_VOLD,KC_MS_L,KC_MS_D,KC_MS_R,KC_WH_D,                                        KC_PPLS,  KC_1 , KC_2  , KC_3  ,KC_PMNS, KC_F10,
+         KC_NO , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_NO ,                                        KC_PAST,  KC_0 , KC_NO ,_______,KC_PSLS, KC_F11,
+        _______, KC_F5 , KC_F6 , KC_F7 , KC_F8 ,                                                        _______,_______,_______,_______, KC_F12,
+                                                        _______,_______,        KC_HOME,_______,
+                                                                _______,        KC_END ,
+                                                KC_BTN1,KC_BTN2,_______,        ALT_BSP,_______,_______
+    )
+};
diff --git a/keyboards/handwired/dactyl_rah/keymaps/right/config.h b/keyboards/handwired/dactyl_rah/keymaps/right/config.h
new file mode 100644
index 0000000000..faac5d1163
--- /dev/null
+++ b/keyboards/handwired/dactyl_rah/keymaps/right/config.h
@@ -0,0 +1,19 @@
+/*
+Copyright 2020 Ralph Azucena <ralphie02@live.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#pragma once
+#define MASTER_RIGHT
diff --git a/keyboards/handwired/dactyl_rah/keymaps/right/keymap.c b/keyboards/handwired/dactyl_rah/keymaps/right/keymap.c
new file mode 100644
index 0000000000..6b07051c4b
--- /dev/null
+++ b/keyboards/handwired/dactyl_rah/keymaps/right/keymap.c
@@ -0,0 +1,47 @@
+ /* Copyright 2020 Ralph Azucena <ralphie02@live.com>
+  * This program is free software: you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+  * the Free Software Foundation, either version 2 of the License, or
+  * (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  */
+
+#include QMK_KEYBOARD_H
+
+#define BASE 0
+#define NAV 1
+
+#define CTL_ESC LCTL_T(KC_ESC)
+#define CTL_CAP LCTL_T(KC_CAPS)
+#define ALT_BSP LALT_T(KC_BSPC)
+#define LT_SCLN LT(NAV, KC_SCLN)
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    [BASE] = LAYOUT_6x6(
+        KC_GRV , KC_1  ,KC_2   , KC_3  , KC_4  , KC_5  ,                                         KC_6  , KC_7  , KC_8  , KC_9  , KC_0  ,KC_HOME,
+        KC_TAB , KC_Q  ,KC_W   , KC_E  , KC_R  , KC_T  ,                                         KC_Y  , KC_U  , KC_I  , KC_O  , KC_P  ,KC_BSLS,
+        CTL_CAP, KC_A  ,KC_S   , KC_D  , KC_F  , KC_G  ,                                         KC_H  , KC_J  , KC_K  , KC_L  ,LT_SCLN,KC_QUOT,
+        KC_LSFT, KC_Z  ,KC_X   , KC_C  , KC_V  , KC_B  ,                                         KC_N  , KC_M  ,KC_COMM, KC_DOT,KC_SLSH,KC_RSFT,
+        CTL_ESC,KC_MINS,KC_EQL ,KC_LBRC,KC_RBRC,                                                        KC_LEFT,KC_DOWN, KC_UP ,KC_RGHT,KC_END ,
+                                                        TT(NAV),KC_DEL ,        KC_PGUP,KC_RCTL,
+                                                                KC_LGUI,        KC_PGDN,
+                                                KC_BSPC,CTL_ESC,KC_LALT,        KC_RALT,KC_ENT ,KC_SPC
+    ),
+    [NAV] = LAYOUT_6x6(
+         RESET , KC_NO ,KC_MPRV,KC_MPLY,KC_MNXT, KC_NO ,                                        KC_BRIU,  KC_7 , KC_8  , KC_9  , KC_NO , RESET ,
+        _______,KC_VOLU,KC_WBAK,KC_MS_U,KC_WFWD,KC_WH_U,                                        KC_BRID,  KC_4 , KC_5  , KC_6  , KC_NO , KC_F9 ,
+        _______,KC_VOLD,KC_MS_L,KC_MS_D,KC_MS_R,KC_WH_D,                                        KC_PPLS,  KC_1 , KC_2  , KC_3  ,KC_PMNS, KC_F10,
+         KC_NO , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_NO ,                                        KC_PAST,  KC_0 , KC_NO ,_______,KC_PSLS, KC_F11,
+        _______, KC_F5 , KC_F6 , KC_F7 , KC_F8 ,                                                        _______,_______,_______,_______, KC_F12,
+                                                        _______,_______,        KC_HOME,_______,
+                                                                _______,        KC_END ,
+                                                KC_BTN1,KC_BTN2,_______,        ALT_BSP,_______,_______
+    )
+};
diff --git a/keyboards/handwired/dactyl_rah/readme.md b/keyboards/handwired/dactyl_rah/readme.md
new file mode 100644
index 0000000000..5c351de972
--- /dev/null
+++ b/keyboards/handwired/dactyl_rah/readme.md
@@ -0,0 +1 @@
+For reference, visite dactyl_micro [readme](https://github.com/qmk/qmk_firmware/blob/master/keyboards/handwired/dactyl_promicro/readme.md)
diff --git a/keyboards/handwired/dactyl_rah/rules.mk b/keyboards/handwired/dactyl_rah/rules.mk
new file mode 100644
index 0000000000..9a9bf7d69f
--- /dev/null
+++ b/keyboards/handwired/dactyl_rah/rules.mk
@@ -0,0 +1,23 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = caterina
+
+# Build Options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = no       # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = yes       # Mouse keys
+EXTRAKEY_ENABLE = yes       # Audio control and System control
+CONSOLE_ENABLE = no         # Console for debug
+COMMAND_ENABLE = yes        # Commands for debug and configuration
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = no            # USB Nkey Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no       # Enable Bluetooth
+AUDIO_ENABLE = no           # Audio output
+SPLIT_KEYBOARD = yes