From b441efbdf64d30031854c68a9c76376b38339b1e Mon Sep 17 00:00:00 2001
From: moyi4681 <moyi4681@users.noreply.github.com>
Date: Tue, 5 Oct 2021 09:16:47 +0800
Subject: [Keyboard] add dztech duo_s keyboard (#14625)

Co-authored-by: Drashna Jaelre <drashna@live.com>
---
 keyboards/dztech/duo_s/config.h                 | 64 +++++++++++++++++++++++++
 keyboards/dztech/duo_s/duo_s.c                  | 16 +++++++
 keyboards/dztech/duo_s/duo_s.h                  | 33 +++++++++++++
 keyboards/dztech/duo_s/info.json                | 10 ++++
 keyboards/dztech/duo_s/keymaps/default/keymap.c | 50 +++++++++++++++++++
 keyboards/dztech/duo_s/keymaps/via/keymap.c     | 50 +++++++++++++++++++
 keyboards/dztech/duo_s/keymaps/via/rules.mk     |  2 +
 keyboards/dztech/duo_s/readme.md                | 21 ++++++++
 keyboards/dztech/duo_s/rules.mk                 | 23 +++++++++
 9 files changed, 269 insertions(+)
 create mode 100644 keyboards/dztech/duo_s/config.h
 create mode 100644 keyboards/dztech/duo_s/duo_s.c
 create mode 100644 keyboards/dztech/duo_s/duo_s.h
 create mode 100644 keyboards/dztech/duo_s/info.json
 create mode 100644 keyboards/dztech/duo_s/keymaps/default/keymap.c
 create mode 100644 keyboards/dztech/duo_s/keymaps/via/keymap.c
 create mode 100644 keyboards/dztech/duo_s/keymaps/via/rules.mk
 create mode 100644 keyboards/dztech/duo_s/readme.md
 create mode 100644 keyboards/dztech/duo_s/rules.mk

(limited to 'keyboards')

diff --git a/keyboards/dztech/duo_s/config.h b/keyboards/dztech/duo_s/config.h
new file mode 100644
index 0000000000..a108fa665e
--- /dev/null
+++ b/keyboards/dztech/duo_s/config.h
@@ -0,0 +1,64 @@
+/* Copyright 2021 DZTECH <moyi4681@live.cn>
+ *
+ * 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       0x445A 
+#define PRODUCT_ID      0X1012
+#define DEVICE_VER      0x0001
+#define MANUFACTURER    DZTECH
+#define PRODUCT         DUO-S
+
+/* key matrix size */
+#define MATRIX_ROWS 5
+#define MATRIX_COLS 15
+#define MATRIX_ROW_PINS { A15, B3, B4, B5, B11 }
+#define MATRIX_COL_PINS { B12, B13, B14, A8, B9, C13, C14, C15, A1, A2, A3, A4, A5, A6, A7 }
+#define UNUSED_PINS
+/* COL2ROW, ROW2COL*/
+#define DIODE_DIRECTION COL2ROW
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCE 5
+
+#define RGB_DI_PIN B15
+#ifdef RGB_DI_PIN
+#define RGBLIGHT_EFFECT_BREATHING
+#define RGBLIGHT_EFFECT_RAINBOW_MOOD
+#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
+#define RGBLIGHT_EFFECT_SNAKE
+#define RGBLIGHT_EFFECT_KNIGHT
+#define RGBLIGHT_EFFECT_CHRISTMAS
+#define RGBLIGHT_EFFECT_STATIC_GRADIENT
+#define RGBLIGHT_EFFECT_RGB_TEST
+#define RGBLIGHT_EFFECT_ALTERNATING
+#define RGBLIGHT_EFFECT_TWINKLE
+#define RGBLIGHT_DEFAULT_MODE (RGBLIGHT_EFFECT_RAINBOW_MOOD + 6) 
+#define RGBLIGHT_DEFAULT_SPD 15
+#define RGBLED_NUM 16
+#define RGBLIGHT_HUE_STEP 10
+#define RGBLIGHT_SAT_STEP 10
+#define RGBLIGHT_VAL_STEP 10
+#define RGBLIGHT_SLEEP
+#endif
+/* 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
+
+#define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 2
diff --git a/keyboards/dztech/duo_s/duo_s.c b/keyboards/dztech/duo_s/duo_s.c
new file mode 100644
index 0000000000..ca64b1ff56
--- /dev/null
+++ b/keyboards/dztech/duo_s/duo_s.c
@@ -0,0 +1,16 @@
+/* Copyright 2021 DZTECH <moyi4681@live.cn>
+ *
+ * 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 "duo_s.h"
diff --git a/keyboards/dztech/duo_s/duo_s.h b/keyboards/dztech/duo_s/duo_s.h
new file mode 100644
index 0000000000..772a5a25ca
--- /dev/null
+++ b/keyboards/dztech/duo_s/duo_s.h
@@ -0,0 +1,33 @@
+/* Copyright 2021 DZTECH <moyi4681@live.cn>
+ *
+ * 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_65_ansi_blocker( \
+    K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \
+    K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \
+    K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211,       K213, K214, \
+    K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311,       K313, K314, \
+    K400, K401, K402,             K405,             K408,       K410, K411,       K413, K414  \
+) \
+{ \
+    { K000,  K001,  K002,  K003,  K004,  K005,  K006,  K007,  K008,  K009,  K010,  K011,  K012,  K013,  K014 }, \
+    { K100,  K101,  K102,  K103,  K104,  K105,  K106,  K107,  K108,  K109,  K110,  K111,  K112,  K113,  K114 }, \
+    { K200,  K201,  K202,  K203,  K204,  K205,  K206,  K207,  K208,  K209,  K210,  K211,  KC_NO, K213,  K214 }, \
+    { K300,  K301,  K302,  K303,  K304,  K305,  K306,  K307,  K308,  K309,  K310,  K311,  KC_NO, K313,  K314 }, \
+    { K400,  K401,  K402,  KC_NO, KC_NO, K405,  KC_NO, KC_NO, K408,  KC_NO, K410,  K411,  KC_NO, K413,  K414 }  \
+}
diff --git a/keyboards/dztech/duo_s/info.json b/keyboards/dztech/duo_s/info.json
new file mode 100644
index 0000000000..6adac04ae6
--- /dev/null
+++ b/keyboards/dztech/duo_s/info.json
@@ -0,0 +1,10 @@
+{
+  "keyboard_name": "duo_s", 
+  "url": "", 
+  "maintainer": "moyi4681", 
+  "layouts": {
+      "LAYOUT_65_ansi_blocker": {
+          "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0, "w":2}, {"x":15, "y":0}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.5, "y":1, "w":1.5}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2, "w":2.25}, {"x":15, "y":2}, {"x":0, "y":3, "w":2.25}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.25}, {"x":1.25, "y":4, "w":1.25}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"x":10, "y":4, "w":1.25}, {"x":11.25, "y":4, "w":1.25}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
+      }
+  }
+}
diff --git a/keyboards/dztech/duo_s/keymaps/default/keymap.c b/keyboards/dztech/duo_s/keymaps/default/keymap.c
new file mode 100644
index 0000000000..9d7c61d650
--- /dev/null
+++ b/keyboards/dztech/duo_s/keymaps/default/keymap.c
@@ -0,0 +1,50 @@
+/* Copyright 2021 DZTECH <moyi4681@live.cn>
+ *
+ * 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
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+	[0] = LAYOUT_65_ansi_blocker( /* Base */
+		KC_GESC,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSPC,          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_LBRC, KC_RBRC,          KC_BSLS, KC_END,
+		KC_CAPS, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,          KC_ENT,           KC_PGUP,
+		KC_LSFT, KC_BSLS, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT,          KC_UP,   KC_PGDN,
+		KC_LCTL, KC_LGUI, KC_LALT,          KC_SPC,           KC_SPC,           KC_SPC,           MO(1), KC_RCTL,          KC_LEFT, KC_DOWN, KC_RGHT
+  	),
+
+	[1] = LAYOUT_65_ansi_blocker( /* FN */
+		RESET,   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  _______,          BL_INC,
+		KC_CAPS, , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, BL_DEC,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,          _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          RGB_MOD, _______,
+		_______, _______, _______,          _______,          _______,          _______,          _______, _______,          KC_HOME, KC_PGDN, KC_END
+  	),
+
+	[2] = LAYOUT_65_ansi_blocker( 
+		_______, _______, _______,   _______, _______, _______,   _______, _______, _______,   _______, _______, _______,  _______, _______,  _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,          _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______,
+		_______, _______, _______,          _______,          _______,          _______,          _______, _______,          _______, _______, _______
+  	),
+
+	[3] = LAYOUT_65_ansi_blocker( 
+		_______, _______, _______,   _______, _______, _______,   _______, _______, _______,   _______, _______, _______,  _______, _______,  _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,          _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______,
+		_______, _______, _______,          _______,          _______,          _______,          _______, _______,          _______, _______, _______
+  	)
+};
diff --git a/keyboards/dztech/duo_s/keymaps/via/keymap.c b/keyboards/dztech/duo_s/keymaps/via/keymap.c
new file mode 100644
index 0000000000..667112dea7
--- /dev/null
+++ b/keyboards/dztech/duo_s/keymaps/via/keymap.c
@@ -0,0 +1,50 @@
+/* Copyright 2021 DZTECH <moyi4681@live.cn>
+ *
+ * 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
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+	[0] = LAYOUT_65_ansi_blocker( /* Base */
+		KC_ESC,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSPC,          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_LBRC, KC_RBRC,          KC_BSLS, KC_END,
+		KC_CAPS, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,          KC_ENT,           KC_PGUP,
+		KC_LSFT,          KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT,          KC_UP,   KC_PGDN,
+		KC_LCTL, KC_LGUI, KC_LALT,                            KC_SPC,                             KC_RALT, KC_RCTL,          KC_LEFT, KC_DOWN, KC_RGHT
+  	),
+
+	[1] = LAYOUT_65_ansi_blocker( /* FN */
+		RESET,   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  _______,          BL_INC,
+		KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, BL_DEC,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,          _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          KC_PGUP, RGB_MOD,
+		_______, _______, _______,                            _______,                            _______, _______,          KC_HOME, KC_PGDN, KC_END
+  	),
+
+	[2] = LAYOUT_65_ansi_blocker( 
+		_______, _______, _______,   _______, _______, _______,   _______, _______, _______,   _______, _______, _______,  _______, _______,  _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,          _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______,
+		_______, _______, _______,                            _______,                            _______, _______,          _______, _______, _______
+  	),
+
+	[3] = LAYOUT_65_ansi_blocker( 
+		_______, _______, _______,   _______, _______, _______,   _______, _______, _______,   _______, _______, _______,  _______, _______,  _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,          _______,
+		_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______,
+		_______, _______, _______,                             _______,                            _______, _______,          _______, _______, _______
+  	)
+};
diff --git a/keyboards/dztech/duo_s/keymaps/via/rules.mk b/keyboards/dztech/duo_s/keymaps/via/rules.mk
new file mode 100644
index 0000000000..36b7ba9cbc
--- /dev/null
+++ b/keyboards/dztech/duo_s/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
+VIA_ENABLE = yes
+LTO_ENABLE = yes
diff --git a/keyboards/dztech/duo_s/readme.md b/keyboards/dztech/duo_s/readme.md
new file mode 100644
index 0000000000..7346663854
--- /dev/null
+++ b/keyboards/dztech/duo_s/readme.md
@@ -0,0 +1,21 @@
+# DUO-S
+
+A customizable 65% HOTSWAP keyboard.
+
+* Keyboard Maintainer: [moyi4681](https://github.com/moyi4681)
+* Hardware Supported: moyi4681
+* Hardware Availability: [moyi4681](https://github.com/moyi4681)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make dztech/duo_s:default
+
+## Bootloader
+
+Enter the bootloader in 3 ways:
+
+* **Bootmagic reset**: Hold down the key at (0,0) in the matrix
+* **Physical reset button**: hold the button on the back of the PCB during plug in cable.
+* **Keycode in layout**: Press the key mapped to `RESET` if it is available
+
+See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/dztech/duo_s/rules.mk b/keyboards/dztech/duo_s/rules.mk
new file mode 100644
index 0000000000..843d46f37e
--- /dev/null
+++ b/keyboards/dztech/duo_s/rules.mk
@@ -0,0 +1,23 @@
+# MCU name
+MCU = STM32F303
+
+# Bootloader selection
+BOOTLOADER = stm32-dfu
+
+# Build Options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = yes      # Enable Bootmagic Lite
+MOUSEKEY_ENABLE = yes       # Mouse keys
+EXTRAKEY_ENABLE = yes       # Audio control and System control
+CONSOLE_ENABLE = no         # Console for debug
+COMMAND_ENABLE = no         # 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 = yes           # USB Nkey Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = yes       # Enable keyboard RGB underglow
+AUDIO_ENABLE = no           # Audio output
+
+LAYOUTS = 65_ansi_blocker
\ No newline at end of file
-- 
cgit v1.2.3