From 1f38221ec5ea95429fe3dbc739065b5598fedfc9 Mon Sep 17 00:00:00 2001
From: duoshock <33636898+duoshock@users.noreply.github.com>
Date: Thu, 14 Jan 2021 06:57:55 +0000
Subject: [PATCH] [Keyboard] Add ISO Macro keyboard (#11517)
* -
* -
* -
* -
* -
Co-authored-by: online <33636898+online@users.noreply.github.com>
---
keyboards/merge/iso_macro/config.h | 42 ++++++++++++
keyboards/merge/iso_macro/iso_macro.c | 17 +++++
keyboards/merge/iso_macro/iso_macro.h | 29 +++++++++
.../merge/iso_macro/keymaps/default/keymap.c | 49 ++++++++++++++
.../merge/iso_macro/keymaps/default/readme.md | 5 ++
.../merge/iso_macro/keymaps/via/keymap.c | 64 +++++++++++++++++++
.../merge/iso_macro/keymaps/via/rules.mk | 2 +
keyboards/merge/iso_macro/readme.md | 14 ++++
keyboards/merge/iso_macro/rules.mk | 23 +++++++
9 files changed, 245 insertions(+)
create mode 100644 keyboards/merge/iso_macro/config.h
create mode 100644 keyboards/merge/iso_macro/iso_macro.c
create mode 100644 keyboards/merge/iso_macro/iso_macro.h
create mode 100644 keyboards/merge/iso_macro/keymaps/default/keymap.c
create mode 100644 keyboards/merge/iso_macro/keymaps/default/readme.md
create mode 100644 keyboards/merge/iso_macro/keymaps/via/keymap.c
create mode 100644 keyboards/merge/iso_macro/keymaps/via/rules.mk
create mode 100644 keyboards/merge/iso_macro/readme.md
create mode 100644 keyboards/merge/iso_macro/rules.mk
diff --git a/keyboards/merge/iso_macro/config.h b/keyboards/merge/iso_macro/config.h
new file mode 100644
index 0000000000..5ad63c134d
--- /dev/null
+++ b/keyboards/merge/iso_macro/config.h
@@ -0,0 +1,42 @@
+ /* Copyright 2021 duoshock
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include "config_common.h"
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x1200
+#define DEVICE_VER 0x0001
+#define MANUFACTURER Merge
+#define PRODUCT ISO Macro
+
+/* key matrix size */
+#define MATRIX_ROWS 3
+#define MATRIX_COLS 3
+
+#define MATRIX_ROW_PINS { F4, F5, F6}
+#define MATRIX_COL_PINS { B4, B5, B6}
+#define UNUSED_PINS
+#define BACKLIGHT_PIN B7
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+
+#define ENCODERS_PAD_A { F0, D0 }
+#define ENCODERS_PAD_B { F1, D1 }
+#define ENCODER_RESOLUTION 4
diff --git a/keyboards/merge/iso_macro/iso_macro.c b/keyboards/merge/iso_macro/iso_macro.c
new file mode 100644
index 0000000000..6052f9cce9
--- /dev/null
+++ b/keyboards/merge/iso_macro/iso_macro.c
@@ -0,0 +1,17 @@
+ /* Copyright 2021 duoshock
+ *
+ * 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 .
+ */
+
+#include "iso_macro.h"
diff --git a/keyboards/merge/iso_macro/iso_macro.h b/keyboards/merge/iso_macro/iso_macro.h
new file mode 100644
index 0000000000..dfa9386449
--- /dev/null
+++ b/keyboards/merge/iso_macro/iso_macro.h
@@ -0,0 +1,29 @@
+ /* Copyright 2021 duoshock
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include "quantum.h"
+
+#define LAYOUT( \
+ k21, k00, k01, k02, k20, \
+ k22, k10, k11, k12 \
+) \
+{ \
+ { k00, k01, k02 }, \
+ { k10, k11, k12 }, \
+ { k20, k21, k22 } \
+}
diff --git a/keyboards/merge/iso_macro/keymaps/default/keymap.c b/keyboards/merge/iso_macro/keymaps/default/keymap.c
new file mode 100644
index 0000000000..a86d35502c
--- /dev/null
+++ b/keyboards/merge/iso_macro/keymaps/default/keymap.c
@@ -0,0 +1,49 @@
+/* Copyright 2021 duoshock
+ *
+ * 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 .
+ */
+
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+/* LAYER 0
+ * ,---------------------------------------------.
+ * | Encoder A | 4 | 5 | 6 | Enter |
+ * |------------|-------+-------+-------| |
+ * | Encoder B | 1 | 2 | 3 | |
+ * `---------------------------------------------'
+ */
+[0] = LAYOUT(
+ KC_HOME, KC_4, KC_5, KC_6, KC_ENT,
+ KC_MUTE, KC_1, KC_2, KC_3
+),
+};
+
+
+void encoder_update_user(uint8_t index, bool clockwise) {
+ if (index == 0) { // Encdoer A
+ if (clockwise) {
+ tap_code(KC_UP);
+ } else {
+ tap_code(KC_DOWN);
+ }
+ } else if (index == 1) { // Encoder B
+ if (clockwise) {
+ tap_code(KC_VOLU);
+ } else {
+ tap_code(KC_VOLD);
+ }
+ }
+}
\ No newline at end of file
diff --git a/keyboards/merge/iso_macro/keymaps/default/readme.md b/keyboards/merge/iso_macro/keymaps/default/readme.md
new file mode 100644
index 0000000000..008d125d4d
--- /dev/null
+++ b/keyboards/merge/iso_macro/keymaps/default/readme.md
@@ -0,0 +1,5 @@
+# Default ISO Macro Layout
+
+![ISO Macro Layout Image](https://i.imgur.com/5NEfKVz.jpg)
+
+This is the default layout that comes flashed on every ISO Macro.
diff --git a/keyboards/merge/iso_macro/keymaps/via/keymap.c b/keyboards/merge/iso_macro/keymaps/via/keymap.c
new file mode 100644
index 0000000000..b97e79acf1
--- /dev/null
+++ b/keyboards/merge/iso_macro/keymaps/via/keymap.c
@@ -0,0 +1,64 @@
+ /* Copyright 2021 duoshock
+ *
+ * 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 .
+ */
+
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+/* LAYER 0
+ * ,---------------------------------------------.
+ * | Encoder A | 4 | 5 | 6 | Enter |
+ * |------------|-------+-------+-------| |
+ * | Encoder B | 1 | 2 | 3 | |
+ * `---------------------------------------------'
+ */
+[0] = LAYOUT(
+ BL_TOGG, KC_4, KC_5, KC_6, KC_ENT,
+ KC_MUTE, KC_1, KC_2, KC_3
+),
+
+[1] = LAYOUT(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+),
+
+[2] = LAYOUT(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+),
+
+[3] = LAYOUT(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+),
+};
+
+
+void encoder_update_user(uint8_t index, bool clockwise) {
+ if (index == 0) { // Encoder A
+ if (clockwise) {
+ backlight_increase();
+ } else {
+ backlight_decrease();
+ }
+ } else if (index == 1) { // Encoder B
+ if (clockwise) {
+ tap_code(KC_VOLU);
+ } else {
+ tap_code(KC_VOLD);
+ }
+ }
+}
\ No newline at end of file
diff --git a/keyboards/merge/iso_macro/keymaps/via/rules.mk b/keyboards/merge/iso_macro/keymaps/via/rules.mk
new file mode 100644
index 0000000000..43061db1dd
--- /dev/null
+++ b/keyboards/merge/iso_macro/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
+VIA_ENABLE = yes
+LTO_ENABLE = yes
\ No newline at end of file
diff --git a/keyboards/merge/iso_macro/readme.md b/keyboards/merge/iso_macro/readme.md
new file mode 100644
index 0000000000..654ede4fd5
--- /dev/null
+++ b/keyboards/merge/iso_macro/readme.md
@@ -0,0 +1,14 @@
+# ISO Macro
+
+![ISO Macro](https://i.imgur.com/wJoaZ8xl.jpg)
+
+A 7 keys macro pad with 2 encoders made and sold by Merge. [Product page](https://mergedesign.store/products/iso-macro)
+
+* Keyboard Maintainer: [duoshock](https://github.com/duoshock)
+* Hardware Availability: [Merge Store](https://mergedesign.store/products/iso-macro)
+
+Make example for this keyboard (after setting up your build environment):
+
+ make merge/isomacro:default
+
+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).
\ No newline at end of file
diff --git a/keyboards/merge/iso_macro/rules.mk b/keyboards/merge/iso_macro/rules.mk
new file mode 100644
index 0000000000..43659757fa
--- /dev/null
+++ b/keyboards/merge/iso_macro/rules.mk
@@ -0,0 +1,23 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = atmel-dfu
+
+# 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 = 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 = no # USB Nkey Rollover
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no # Enable Bluetooth
+AUDIO_ENABLE = no # Audio output
+ENCODER_ENABLE = yes
\ No newline at end of file