From 081ae84d0ed4e5fd5a90e9a5e279cfcea55e81b4 Mon Sep 17 00:00:00 2001
From: kurtis-lew <kurtis.a.lew@gmail.com>
Date: Tue, 1 Sep 2020 20:22:11 -0700
Subject: [PATCH 1/3] Added Iris Shield

---
 app/boards/shields/iris/Kconfig.defconfig  | 14 ++++++
 app/boards/shields/iris/Kconfig.shield     |  8 ++++
 app/boards/shields/iris/iris.conf          |  0
 app/boards/shields/iris/iris.dtsi          | 51 ++++++++++++++++++++
 app/boards/shields/iris/iris.keymap        | 56 ++++++++++++++++++++++
 app/boards/shields/iris/iris_left.conf     |  2 +
 app/boards/shields/iris/iris_left.overlay  | 22 +++++++++
 app/boards/shields/iris/iris_right.conf    |  2 +
 app/boards/shields/iris/iris_right.overlay | 26 ++++++++++
 9 files changed, 181 insertions(+)
 create mode 100644 app/boards/shields/iris/Kconfig.defconfig
 create mode 100644 app/boards/shields/iris/Kconfig.shield
 create mode 100644 app/boards/shields/iris/iris.conf
 create mode 100644 app/boards/shields/iris/iris.dtsi
 create mode 100644 app/boards/shields/iris/iris.keymap
 create mode 100644 app/boards/shields/iris/iris_left.conf
 create mode 100644 app/boards/shields/iris/iris_left.overlay
 create mode 100644 app/boards/shields/iris/iris_right.conf
 create mode 100644 app/boards/shields/iris/iris_right.overlay

diff --git a/app/boards/shields/iris/Kconfig.defconfig b/app/boards/shields/iris/Kconfig.defconfig
new file mode 100644
index 00000000..bf4919ac
--- /dev/null
+++ b/app/boards/shields/iris/Kconfig.defconfig
@@ -0,0 +1,14 @@
+
+if SHIELD_IRIS_LEFT
+
+config ZMK_KEYBOARD_NAME
+	default "Iris Left"
+
+endif
+
+if SHIELD_IRIS_RIGHT
+
+config ZMK_KEYBOARD_NAME
+	default "Iris Right"
+
+endif
\ No newline at end of file
diff --git a/app/boards/shields/iris/Kconfig.shield b/app/boards/shields/iris/Kconfig.shield
new file mode 100644
index 00000000..370bd222
--- /dev/null
+++ b/app/boards/shields/iris/Kconfig.shield
@@ -0,0 +1,8 @@
+# Copyright (c) 2020 Pete Johanson, Kurtis Lew
+# SPDX-License-Identifier: MIT
+
+config SHIELD_IRIS_LEFT
+	def_bool $(shields_list_contains,iris_left)
+
+config SHIELD_IRIS_RIGHT
+	def_bool $(shields_list_contains,iris_right)
diff --git a/app/boards/shields/iris/iris.conf b/app/boards/shields/iris/iris.conf
new file mode 100644
index 00000000..e69de29b
diff --git a/app/boards/shields/iris/iris.dtsi b/app/boards/shields/iris/iris.dtsi
new file mode 100644
index 00000000..f6e32c40
--- /dev/null
+++ b/app/boards/shields/iris/iris.dtsi
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2020 Pete Johanson, Kurtis Lew
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include <dt-bindings/zmk/matrix-transform.h>
+
+/ {
+	chosen {
+		zmk,kscan = &kscan0;
+		zmk,matrix_transform = &default_transform;
+	};
+
+	default_transform: keymap_transform_0 {
+		compatible = "zmk,matrix-transform";
+		columns = <16>;
+		rows = <4>;
+// | SW6  | SW5  | SW4  | SW3  | SW2  | SW1  |                 | SW1  | SW2  | SW3  | SW4  | SW5  | SW6  |
+// | SW12 | SW11 | SW10 | SW9  | SW8  | SW7  |                 | SW7  | SW8  | SW9  | SW10 | SW11 | SW12 |
+// | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 |                 | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 |
+// | SW24 | SW23 | SW22 | SW21 | SW20 | SW19 | SW25 |   | SW25 | SW19 | SW20 | SW21 | SW22 | SW23 | SW24 |
+//                      | SW29 | SW28 | SW27 | SW26 |   | SW26 | SW27 | SW28 | SW29 |
+		map = <
+RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5)                 RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11)
+RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5)                 RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11)
+RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5)                 RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11)
+RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,2) RC(4,9) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11)
+                        		RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8)
+		>;
+	};
+
+	kscan0: kscan {
+		compatible = "zmk,kscan-gpio-matrix";
+		label = "KSCAN";
+
+		diode-direction = "col2row";
+		row-gpios
+			= <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+			, <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+			, <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+			, <&pro_micro_d 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+			, <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+			;
+		
+	};
+
+	bt_unpair_combo: bt_unpair_combo {
+		compatible = "zmk,bt-unpair-combo";
+	};
+};
\ No newline at end of file
diff --git a/app/boards/shields/iris/iris.keymap b/app/boards/shields/iris/iris.keymap
new file mode 100644
index 00000000..4607adf0
--- /dev/null
+++ b/app/boards/shields/iris/iris.keymap
@@ -0,0 +1,56 @@
+#include <behaviors.dtsi>
+#include <dt-bindings/zmk/keys.h>
+
+/ {
+	keymap {
+		compatible = "zmk,keymap";
+
+		default_layer {
+// ------------------------------------------------------------------------------------------------------------
+// |  ESC  |  1  |  2  |  3   |  4   |  5   |                   |  6   |  7    |  8    |  9   |   0   |   `   |
+// |  TAB  |  Q  |  W  |  E   |  R   |  T   |                   |  Y   |  U    |  I    |  O   |   P   |   -   |
+// |  CTRL |  A  |  S  |  D   |  F   |  G   |                   |  H   |  J    |  K    |  L   |   ;   |   '   |
+// | SHIFT |  Z  |  X  |  C   |  V   |  B   |   "["  |  |  "]"  |  N   |  M    |  ,    |  .   |   /   | SHIFT |
+//                     		  | GUI  | LOWER|  SPACE |  | ENTER | RAISE|  ALT  |
+			bindings = <
+&kp ESC  &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5                   &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &kp GRAV
+&kp TAB  &kp Q     &kp W     &kp E     &kp R     &kp T                       &kp Y     &kp U     &kp I     &kp O     &kp P     &kp MINUS
+&kp LCTL &kp A     &kp S     &kp D     &kp F     &kp G                       &kp H     &kp J     &kp K     &kp L     &kp SCLN  &kp QUOT
+&kp LSFT &kp Z     &kp X     &kp C     &kp V     &kp B   &kp LBKT  &kp RBKT  &kp N     &kp M     &kp CMMA  &kp DOT   &kp FSLH  &kp RSFT
+                   			 		   &kp LGUI  &mo 1   &kp SPC   &kp RET   &mo 2     &kp RALT
+			>;
+		};
+
+		lower_layer {
+// ------------------------------------------------------------------------------------------------------------
+// |       |     |     |      |      |      |                   |      |       |       |      |       |       |
+// |  F1   |  F2 |  F3 |  F4  |  F5  |  F6  |                   |  F7  |  F8   |  F9   |  F10 |  F11  |  F12  |
+// |   `   |  !  |  @  |  #   |  $   |  %   |                   |  ^   |  &    |  *    |  (   |   )   |   ~   |
+// |       |     |     |      |      |      |        |  |       |      |  _    |  +    |  {   |   }   |  "|"  |
+//                            |      |      |        |  |       |      |       |
+			bindings = <
+&trans   &trans    &trans    &trans    &trans    &trans                       &trans    &trans    &trans    &trans    &trans    &trans
+&kp F1   &kp F2    &kp F3    &kp F4    &kp F5    &kp F6                       &kp F7    &kp F8    &kp F9    &kp F10   &kp F11   &kp F12
+&kp GRAV &kp BANG  &kp ATSN  &kp HASH  &kp CURU  &kp PRCT                     &kp CRRT  &kp AMPS  &kp KMLT  &kp LPRN  &kp RPRN  &kp TILD
+&trans   &trans    &trans    &trans    &trans    &trans    &trans   &trans    &trans    &kp MINUS &kp KPLS  &kp LCUR  &kp RCUR  &kp PIPE
+                   					   &trans    &trans    &trans   &trans    &trans    &trans
+			>;
+		};
+
+		raise_layer {
+// ------------------------------------------------------------------------------------------------------------
+// |       |     |     |      |      |      |                   |      |       |       |      |       |       |
+// |   `   |  1  |  2  |  3   |  4   |  5   |                   |  6   |   7   |   8   |  9   |   0   |       |
+// |   F1  |  F2 |  F3 |  F4  |  F5  |  F6  |                   |      |   <-  |   ^   |  v   |  ->   |       |
+// |   F7  |  F8 |  F9 |  F10 |  F11 |  F12 |        |  |       |  +   |   -   |   =   |  [   |   ]   |   \   |
+//                            |      |      |        |  |       |      |       |
+			bindings = <
+&trans   &trans    &trans    &trans    &trans    &trans                       &trans    &trans    &trans    &trans    &trans    &trans
+&kp GRAV &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5                    &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &trans
+&kp F1   &kp F2    &kp F3    &kp F4    &kp F5    &kp F6                       &trans    &kp LARW  &kp DARW  &kp UARW  &kp RARW  &trans
+&kp F7   &kp F8    &kp F9    &kp F10   &kp F11   &kp F12   &trans   &trans    &kp KPLS  &kp MINUS &kp EQL   &kp LBKT  &kp RBKT  &kp BSLH
+                   					   &trans    &trans    &trans   &trans    &trans    &trans
+			>;
+		};
+	};
+};
diff --git a/app/boards/shields/iris/iris_left.conf b/app/boards/shields/iris/iris_left.conf
new file mode 100644
index 00000000..1e028a78
--- /dev/null
+++ b/app/boards/shields/iris/iris_left.conf
@@ -0,0 +1,2 @@
+CONFIG_ZMK_SPLIT=y
+CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
diff --git a/app/boards/shields/iris/iris_left.overlay b/app/boards/shields/iris/iris_left.overlay
new file mode 100644
index 00000000..e04638e3
--- /dev/null
+++ b/app/boards/shields/iris/iris_left.overlay
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2020 Pete Johanson, Kurtis Lew
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "iris.dtsi"
+
+&kscan0 {
+	col-gpios
+		= <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
+		, <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
+		, <&pro_micro_d 15 GPIO_ACTIVE_HIGH>
+		, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
+		, <&pro_micro_d 16 GPIO_ACTIVE_HIGH>
+		, <&pro_micro_d 10 GPIO_ACTIVE_HIGH>
+		;
+};
+
+&bt_unpair_combo {
+	key-positions = <0 42>;
+};
diff --git a/app/boards/shields/iris/iris_right.conf b/app/boards/shields/iris/iris_right.conf
new file mode 100644
index 00000000..990cf7c0
--- /dev/null
+++ b/app/boards/shields/iris/iris_right.conf
@@ -0,0 +1,2 @@
+CONFIG_ZMK_SPLIT=y
+CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
diff --git a/app/boards/shields/iris/iris_right.overlay b/app/boards/shields/iris/iris_right.overlay
new file mode 100644
index 00000000..3f3dcb85
--- /dev/null
+++ b/app/boards/shields/iris/iris_right.overlay
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2020 Pete Johanson, Kurtis Lew
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "iris.dtsi"
+
+&default_transform {
+	col-offset = <6>;
+};
+
+&kscan0 {
+	col-gpios
+		= <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
+		, <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
+		, <&pro_micro_d 15 GPIO_ACTIVE_HIGH>
+		, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
+		, <&pro_micro_d 16 GPIO_ACTIVE_HIGH>
+		, <&pro_micro_d 10 GPIO_ACTIVE_HIGH>
+		;
+};
+
+&bt_unpair_combo {
+	key-positions = <11 43>;
+};

From c2ffeb1cf4a27b79c9fcc7cf0c83deab3cd4b84e Mon Sep 17 00:00:00 2001
From: Kurtis Lew <kurtis.a.lew@gmail.com>
Date: Wed, 2 Sep 2020 07:21:45 -0700
Subject: [PATCH 2/3] Added Copyright Header to Kconfig.defconfig

---
 app/boards/shields/iris/Kconfig.defconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/boards/shields/iris/Kconfig.defconfig b/app/boards/shields/iris/Kconfig.defconfig
index bf4919ac..6439780c 100644
--- a/app/boards/shields/iris/Kconfig.defconfig
+++ b/app/boards/shields/iris/Kconfig.defconfig
@@ -1,3 +1,5 @@
+# Copyright (c) 2020 Pete Johanson, Kurtis Lew
+# SPDX-License-Identifier: MIT
 
 if SHIELD_IRIS_LEFT
 
@@ -11,4 +13,4 @@ if SHIELD_IRIS_RIGHT
 config ZMK_KEYBOARD_NAME
 	default "Iris Right"
 
-endif
\ No newline at end of file
+endif

From 6e8f19028a58d5238aa75b3fef3551e2cedaebdc Mon Sep 17 00:00:00 2001
From: Kurtis Lew <kurtis.a.lew@gmail.com>
Date: Wed, 2 Sep 2020 07:22:39 -0700
Subject: [PATCH 3/3] Added copyright header to iris.keymap

---
 app/boards/shields/iris/iris.keymap | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/boards/shields/iris/iris.keymap b/app/boards/shields/iris/iris.keymap
index 4607adf0..46b0817f 100644
--- a/app/boards/shields/iris/iris.keymap
+++ b/app/boards/shields/iris/iris.keymap
@@ -1,3 +1,6 @@
+# Copyright (c) 2020 Pete Johanson, Kurtis Lew
+# SPDX-License-Identifier: MIT
+
 #include <behaviors.dtsi>
 #include <dt-bindings/zmk/keys.h>