From 3bb1897bdc5593b99bb2865fcbc61bf45bef4b25 Mon Sep 17 00:00:00 2001
From: datafx <2432997+datafx@users.noreply.github.com>
Date: Mon, 18 Jan 2021 13:58:09 -0500
Subject: [PATCH] [Keyboard] Monstargear XO87 RGB Hot-Swap PCB (#11555)

* Support for Monstargear XO87 Hot-Swap PCB

* Remove manufacturer from product line

* Removed alternate bootloaders

* Updated info.json

* Missed RGB_DISABLE_WHEN_USB_SUSPENDED in config.h

* Delete kb.h

* Update rgb.h

* Update rules.mk

* Add files via upload

* Delete kb.h

* Update keymap.c

* Update config.h

* Update rgb.c

* Add via RGB support

* Update info.json

* Update readme.md

* Update readme.md

* Update config.h

* Update rgb.h

* Update config.h

* Mirror factory layout

* Mirror factory layout

* Update rgb.h

* Update keyboards/xo87/rgb/rgb.c

* Update rgb.c

* Update keyboards/xo87/rgb/config.h

* Update keyboards/xo87/rgb/rules.mk

* Update keyboards/xo87/rgb/rules.mk

* Update keyboards/xo87/rgb/keymaps/via/keymap.c

* Update keyboards/xo87/rgb/rules.mk

* Update keyboards/xo87/rgb/rules.mk

* Update keyboards/xo87/rgb/keymaps/via/keymap.c

* Update config.h

* Update keyboards/xo87/rgb/readme.md

* Update keyboards/xo87/rgb/readme.md

* Update keyboards/xo87/rgb/readme.md

* Update keyboards/xo87/rgb/rules.mk

* Update keyboards/xo87/rgb/rules.mk

* Update keyboards/xo87/rgb/rules.mk

* Update keyboards/xo87/rgb/rules.mk

* Update keyboards/xo87/rgb/rules.mk

* remove deprecated action_get_macro()

* rearrange layout per request

* rearrange layout per request

* Update keyboards/xo87/rgb/rgb.h

* Update keyboards/xo87/rgb/keymaps/default/readme.md

* Update keyboards/xo87/rgb/readme.md

* Bugfix for RGB Matrix

* Bugfix for RGB Matrix

* Moved to new subdirectory and updated build commands to reflect changes

* Remove old files
---
 keyboards/monstargear/xo87/rgb/config.h       | 49 ++++++++++
 keyboards/monstargear/xo87/rgb/info.json      | 12 +++
 .../xo87/rgb/keymaps/default/config.h         | 16 ++++
 .../xo87/rgb/keymaps/default/keymap.c         | 56 +++++++++++
 .../xo87/rgb/keymaps/default/readme.md        |  1 +
 .../monstargear/xo87/rgb/keymaps/via/config.h | 17 ++++
 .../monstargear/xo87/rgb/keymaps/via/keymap.c | 56 +++++++++++
 .../monstargear/xo87/rgb/keymaps/via/rules.mk |  1 +
 keyboards/monstargear/xo87/rgb/readme.md      | 21 +++++
 keyboards/monstargear/xo87/rgb/rgb.c          | 93 +++++++++++++++++++
 keyboards/monstargear/xo87/rgb/rgb.h          | 34 +++++++
 keyboards/monstargear/xo87/rgb/rules.mk       | 27 ++++++
 12 files changed, 383 insertions(+)
 create mode 100644 keyboards/monstargear/xo87/rgb/config.h
 create mode 100644 keyboards/monstargear/xo87/rgb/info.json
 create mode 100644 keyboards/monstargear/xo87/rgb/keymaps/default/config.h
 create mode 100644 keyboards/monstargear/xo87/rgb/keymaps/default/keymap.c
 create mode 100644 keyboards/monstargear/xo87/rgb/keymaps/default/readme.md
 create mode 100644 keyboards/monstargear/xo87/rgb/keymaps/via/config.h
 create mode 100644 keyboards/monstargear/xo87/rgb/keymaps/via/keymap.c
 create mode 100644 keyboards/monstargear/xo87/rgb/keymaps/via/rules.mk
 create mode 100644 keyboards/monstargear/xo87/rgb/readme.md
 create mode 100644 keyboards/monstargear/xo87/rgb/rgb.c
 create mode 100644 keyboards/monstargear/xo87/rgb/rgb.h
 create mode 100644 keyboards/monstargear/xo87/rgb/rules.mk

diff --git a/keyboards/monstargear/xo87/rgb/config.h b/keyboards/monstargear/xo87/rgb/config.h
new file mode 100644
index 0000000000..939ab574ee
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/config.h
@@ -0,0 +1,49 @@
+/* Copyright 2021 datafx
+ *
+ * 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       0x4D47 // MG for Monstargear
+#define PRODUCT_ID      0x584F // XO for XO87
+#define DEVICE_VER      0x0001
+#define MANUFACTURER    Monstargear
+#define PRODUCT         XO87
+
+/* key matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 16
+
+#define BACKLIGHT_PIN F5
+#define MATRIX_ROW_PINS { E6,E7, E3, B0, B1 ,A2}//
+#define MATRIX_COL_PINS { C5,C3,C1,E1,D6,D2,B7,B3,F6,F7,F3,A5,A1,E2,C7,A6 }
+#define UNUSED_PINS
+#define DIODE_DIRECTION ROW2COL
+#define RGB_DI_PIN D7
+#define DRIVER_LED_TOTAL 110
+#define RGB_DISABLE_WHEN_USB_SUSPENDED true
+
+#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 100 // limits maximum brightness of LEDs to 100 out of 255.
+#define RGBLIGHT_LIMIT_VAL 100 // limits maximum brightness of LEDs to 100 out of 255. 
+#define RGB_MATRIX_KEYPRESSES
+#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
+#define RGBLED_NUM 110
+
+#define DEBOUNCE 5
+#define LOCKING_SUPPORT_ENABLE
+#define LOCKING_RESYNC_ENABLE
diff --git a/keyboards/monstargear/xo87/rgb/info.json b/keyboards/monstargear/xo87/rgb/info.json
new file mode 100644
index 0000000000..251553d9b7
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/info.json
@@ -0,0 +1,12 @@
+{
+  "keyboard_name": "XO87 RGB", 
+  "url": "https://www.monstargears.com/", 
+  "maintainer": "qmk", 
+  "width": 18.25, 
+  "height": 6.5, 
+  "layouts": {
+    "LAYOUT_tkl_ansi": {
+      "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":2, "y":0}, {"label":"F2", "x":3, "y":0}, {"label":"F3", "x":4, "y":0}, {"label":"F4", "x":5, "y":0}, {"label":"F5", "x":6.5, "y":0}, {"label":"F6", "x":7.5, "y":0}, {"label":"F7", "x":8.5, "y":0}, {"label":"F8", "x":9.5, "y":0}, {"label":"F9", "x":11, "y":0}, {"label":"F10", "x":12, "y":0}, {"label":"F11", "x":13, "y":0}, {"label":"F12", "x":14, "y":0}, {"label":"PrtSc", "x":15.25, "y":0}, {"label":"Scroll Lock", "x":16.25, "y":0}, {"label":"Pause", "x":17.25, "y":0}, {"label":"~", "x":0, "y":1.5}, {"label":"!", "x":1, "y":1.5}, {"label":"@", "x":2, "y":1.5}, {"label":"#", "x":3, "y":1.5}, {"label":"$", "x":4, "y":1.5}, {"label":"%", "x":5, "y":1.5}, {"label":"^", "x":6, "y":1.5}, {"label":"&", "x":7, "y":1.5}, {"label":"*", "x":8, "y":1.5}, {"label":"(", "x":9, "y":1.5}, {"label":")", "x":10, "y":1.5}, {"label":"_", "x":11, "y":1.5}, {"label":"+", "x":12, "y":1.5}, {"label":"Backspace", "x":13, "y":1.5, "w":2}, {"label":"Insert", "x":15.25, "y":1.5}, {"label":"Home", "x":16.25, "y":1.5}, {"label":"PgUp", "x":17.25, "y":1.5}, {"label":"Tab", "x":0, "y":2.5, "w":1.5}, {"label":"Q", "x":1.5, "y":2.5}, {"label":"W", "x":2.5, "y":2.5}, {"label":"E", "x":3.5, "y":2.5}, {"label":"R", "x":4.5, "y":2.5}, {"label":"T", "x":5.5, "y":2.5}, {"label":"Y", "x":6.5, "y":2.5}, {"label":"U", "x":7.5, "y":2.5}, {"label":"I", "x":8.5, "y":2.5}, {"label":"O", "x":9.5, "y":2.5}, {"label":"P", "x":10.5, "y":2.5}, {"label":"{", "x":11.5, "y":2.5}, {"label":"}", "x":12.5, "y":2.5}, {"label":"|", "x":13.5, "y":2.5, "w":1.5}, {"label":"Delete", "x":15.25, "y":2.5}, {"label":"End", "x":16.25, "y":2.5}, {"label":"PgDn", "x":17.25, "y":2.5}, {"label":"Caps Lock", "x":0, "y":3.5, "w":1.75}, {"label":"A", "x":1.75, "y":3.5}, {"label":"S", "x":2.75, "y":3.5}, {"label":"D", "x":3.75, "y":3.5}, {"label":"F", "x":4.75, "y":3.5}, {"label":"G", "x":5.75, "y":3.5}, {"label":"H", "x":6.75, "y":3.5}, {"label":"J", "x":7.75, "y":3.5}, {"label":"K", "x":8.75, "y":3.5}, {"label":"L", "x":9.75, "y":3.5}, {"label":":", "x":10.75, "y":3.5}, {"label":"\"", "x":11.75, "y":3.5}, {"label":"Enter", "x":12.75, "y":3.5, "w":2.25}, {"label":"Shift", "x":0, "y":4.5, "w":2.25}, {"label":"Z", "x":2.25, "y":4.5}, {"label":"X", "x":3.25, "y":4.5}, {"label":"C", "x":4.25, "y":4.5}, {"label":"V", "x":5.25, "y":4.5}, {"label":"B", "x":6.25, "y":4.5}, {"label":"N", "x":7.25, "y":4.5}, {"label":"M", "x":8.25, "y":4.5}, {"label":"<", "x":9.25, "y":4.5}, {"label":">", "x":10.25, "y":4.5}, {"label":"?", "x":11.25, "y":4.5}, {"label":"Shift", "x":12.25, "y":4.5, "w":2.75}, {"label":"\u2191", "x":16.25, "y":4.5}, {"label":"Ctrl", "x":0, "y":5.5, "w":1.25}, {"label":"Win", "x":1.25, "y":5.5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5.5, "w":1.25}, {"x":3.75, "y":5.5, "w":6.25}, {"label":"Alt", "x":10, "y":5.5, "w":1.25}, {"label":"Win", "x":11.25, "y":5.5, "w":1.25}, {"label":"Menu", "x":12.5, "y":5.5, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":5.5, "w":1.25}, {"label":"\u2190", "x":15.25, "y":5.5}, {"label":"\u2193", "x":16.25, "y":5.5}, {"label":"\u2192", "x":17.25, "y":5.5}]
+      }
+   }
+}
diff --git a/keyboards/monstargear/xo87/rgb/keymaps/default/config.h b/keyboards/monstargear/xo87/rgb/keymaps/default/config.h
new file mode 100644
index 0000000000..910a014d79
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/keymaps/default/config.h
@@ -0,0 +1,16 @@
+/* Copyright 2021 datafx
+ *
+ * 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
\ No newline at end of file
diff --git a/keyboards/monstargear/xo87/rgb/keymaps/default/keymap.c b/keyboards/monstargear/xo87/rgb/keymaps/default/keymap.c
new file mode 100644
index 0000000000..fdee305775
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/keymaps/default/keymap.c
@@ -0,0 +1,56 @@
+/* Copyright 2021 datafx
+ *
+ * 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_tkl_ansi(
+        KC_ESC,           KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,     KC_PSCR, KC_SLCK, KC_PAUS,
+        KC_GRV,  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_INS,  KC_HOME, KC_PGUP,
+        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_DEL,  KC_END,  KC_PGDN,
+        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_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_LCTL, KC_LGUI, KC_LALT,                            KC_SPC,                             KC_RALT, KC_RGUI, MO(1),   KC_RCTL,    KC_LEFT, KC_DOWN, KC_RGHT
+    ),
+
+    [1] = LAYOUT_tkl_ansi(
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,             _______,
+        _______, _______, _______,                            _______,                            _______, _______, _______, _______,    _______, _______, _______
+    ),
+
+    [2] = LAYOUT_tkl_ansi(
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,             _______,
+        _______, _______, _______,                            _______,                            _______, _______, _______, _______,    _______, _______, _______
+    ),
+
+    [3] = LAYOUT_tkl_ansi(
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,             _______,
+        _______, _______, _______,                            _______,                            _______, _______, _______, _______,    _______, _______, _______
+    ),
+
+};
diff --git a/keyboards/monstargear/xo87/rgb/keymaps/default/readme.md b/keyboards/monstargear/xo87/rgb/keymaps/default/readme.md
new file mode 100644
index 0000000000..1ee46d99bc
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/keymaps/default/readme.md
@@ -0,0 +1 @@
+# The default keymap for the XO87 RGB
diff --git a/keyboards/monstargear/xo87/rgb/keymaps/via/config.h b/keyboards/monstargear/xo87/rgb/keymaps/via/config.h
new file mode 100644
index 0000000000..45b4ab9d22
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/keymaps/via/config.h
@@ -0,0 +1,17 @@
+/* Copyright 2021 datafx
+ *
+ * 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 VIA_QMK_RGBLIGHT_ENABLE
diff --git a/keyboards/monstargear/xo87/rgb/keymaps/via/keymap.c b/keyboards/monstargear/xo87/rgb/keymaps/via/keymap.c
new file mode 100644
index 0000000000..fdee305775
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/keymaps/via/keymap.c
@@ -0,0 +1,56 @@
+/* Copyright 2021 datafx
+ *
+ * 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_tkl_ansi(
+        KC_ESC,           KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,     KC_PSCR, KC_SLCK, KC_PAUS,
+        KC_GRV,  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_INS,  KC_HOME, KC_PGUP,
+        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_DEL,  KC_END,  KC_PGDN,
+        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_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_LCTL, KC_LGUI, KC_LALT,                            KC_SPC,                             KC_RALT, KC_RGUI, MO(1),   KC_RCTL,    KC_LEFT, KC_DOWN, KC_RGHT
+    ),
+
+    [1] = LAYOUT_tkl_ansi(
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,             _______,
+        _______, _______, _______,                            _______,                            _______, _______, _______, _______,    _______, _______, _______
+    ),
+
+    [2] = LAYOUT_tkl_ansi(
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,             _______,
+        _______, _______, _______,                            _______,                            _______, _______, _______, _______,    _______, _______, _______
+    ),
+
+    [3] = LAYOUT_tkl_ansi(
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
+        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,             _______,
+        _______, _______, _______,                            _______,                            _______, _______, _______, _______,    _______, _______, _______
+    ),
+
+};
diff --git a/keyboards/monstargear/xo87/rgb/keymaps/via/rules.mk b/keyboards/monstargear/xo87/rgb/keymaps/via/rules.mk
new file mode 100644
index 0000000000..1e5b99807c
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes
diff --git a/keyboards/monstargear/xo87/rgb/readme.md b/keyboards/monstargear/xo87/rgb/readme.md
new file mode 100644
index 0000000000..2948b67363
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/readme.md
@@ -0,0 +1,21 @@
+# XO87 RGB PCB
+
+![XO87](https://cdn.imweb.me/thumbnail/20201120/c90a5bdb75264.png) 
+
+A TKL custom keyboard made by Monstar Gear.
+
+* Keyboard Maintainer: The QMK Community
+* Hardware Supported: XO87 RGB Hot-Swap version
+* Hardware Availability: [Monstargear](https://monstargears.com)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make monstargear/xo87/rgb:default
+
+Flashing example for this keyboard:
+
+    make monstargear/xo87/rgb:default:flash
+
+Please be aware that Monstar Gear has not yet switched to this firmware and any PCB that is running the pre-installed firmware will need to use ISP to flash their board for the first time.
+
+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/monstargear/xo87/rgb/rgb.c b/keyboards/monstargear/xo87/rgb/rgb.c
new file mode 100644
index 0000000000..de8793d4ba
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/rgb.c
@@ -0,0 +1,93 @@
+/* Copyright 2021 datafx
+ *
+ * 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 "quantum.h"
+
+led_config_t g_led_config = { {
+  // esc  f1   f2   f3   f4   f5   f6   f7     f8    f9    f10   f11   f12   prtscr scrl  brk
+  {  91,  95,  96,  97,  98,  99,  100,  101,  102,  103,  104,  105,  106,  107,  108,  109 },
+  //tilde 1    2   3    4    5    6    7    8    9    0    -    =    ins  home  pgup
+  {  90,  89,  88, 87,  86,  85,  84,  83,  82,  81,  80,  79,  78,  76,  75,  74 },
+  //tab   q    w    e    r    t    y    u    i    o    p    [    ]    del   end  pgdn
+  {  57,  58,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  71,  72,  73 },
+  //caps  a    s    d    f    g    h    j    k   l     ;    '  return bspc
+  {  56,  55,  54,  53,  52,  51,  50,  49,  48,  47,  46,  45,  44,  77,  NO_LED,  NO_LED },
+  //lshift         z   x    c    v    b    n    m    ,    .    /   rshift  bsls  up  rctl
+  {  31,  NO_LED,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  70,  43,  23 },
+  //ctrl win  alt                             space                           alt  win  mod  left down right
+  {  30,  29,  28,  NO_LED,  NO_LED,  NO_LED,  27,  NO_LED,  NO_LED,  NO_LED,  26,  25,  24,  22,  21,  20 },
+  //underglow
+  {  10,  11,  12,  13,  14,  15,  16,  17,  18,  19 },
+  {   0,   1,   2,   3,   4,   5,   6,   7,   8,   9 }
+}, {
+    //Esc, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCN, SLCK, BRK
+    {   0,   0 }, {  15,   0 }, {  30,   0 }, {  45,   0 }, {  60,   0 }, {  75,   0 }, {  90,   0 }, { 105,   0 }, { 120,   0 }, { 135,   0 }, { 150,   0 }, { 165,   0 }, { 180,   0 }, { 202,   0 }, { 225,   0 },
+    //Tilde, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, =, backspace, ins, home, pgup
+    {   0,  12 }, {  22,  12}, {  37,  12 }, {  52,  12 }, {  67,  12 }, {  82,  12 }, {  97,  12 }, { 112,  12 }, { 127,  12 }, { 142,  12 }, { 157,  12 }, { 172,  12 }, { 187,  12 }, { 202,  12}, { 206,  12 }, {215,  12}, { 225,  12 },
+    //Tab, q, w, e, r, t, y, u, i, o, p, [, ], \, del, end, pgdown
+    {   0,  24 }, {  22,  24}, {  37,  24 }, {  52,  24 }, {  67,  24 }, {  82,  24 }, {  97,  24 }, { 112,  24 }, { 127,  24 }, { 142,  24 }, { 157,  24 }, { 172,  24 }, { 187,  24 }, { 202,  24}, { 206,  24 }, {215,  24}, { 225,  24 },
+    //Capslock, A, S, D, F, G, H, J, K, L, ;, ', Enter
+    {  0,  36 }, {  26,  36 }, {  41,  36 }, {  56,  36 }, {  71,  36 }, {  86,  36 }, { 101,  36 }, { 116,  36 }, { 131,  36 }, { 146,  36 }, { 161,  36 }, { 176,  36 }, { 180,  36 }, { 198,  36 },
+    //LShift, Z, X, C, V, B, N, M, ,, ., slash, RShift, Up
+    {  0,  48 }, {  30,  48 }, {  45,  48 }, {  60,  48 }, {  75,  48 }, {  90,  48 }, { 105,  48 }, { 120,  48 }, { 135,  48 }, { 150,  48 }, { 165,  48 }, { 198,  48 }, { 215,  48},
+    //Ctrl, GUI, Alt, Space, RAlt, GUI, FN, CTL, Left, Down, Right
+    {  0,  63 }, {  22,  63 }, {  33,  63 }, { 101,  63 }, { 135,  63 }, { 153,  63 }, { 168,  63}, { 180,  63 }, { 195,  63 }, { 210,  63 }, { 225,  63 },
+    //Underglow
+    {  0,  64 }, {  10,  64 }, {  20,  64 }, { 30,  64 }, { 40,  64 }, { 50,  64 }, { 60,  64}, { 70,  64 }, { 80,  64 }, { 90,  64 }, { 100,  64 }, {  110,  64 }, {  120,  64 }, {  130,  64 }, { 140,  64 }, { 150,  64 }, { 160,  64 }, { 170,  64}, { 180,  64 }, { 190,  64 }
+}, {
+    // top row 
+    4, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+    // 5th row up
+    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+    // 4th row up 
+    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+    // 3rd row up
+    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+    // 2nd row up
+    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+    // bottom row
+    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+    // underglow
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
+} };
+
+void suspend_power_down_kb(void) {
+    rgb_matrix_set_suspend_state(true);
+    suspend_power_down_user();
+}
+
+void suspend_wakeup_init_kb(void) {
+    rgb_matrix_set_suspend_state(false);
+    suspend_wakeup_init_user();
+}
+
+void rgb_matrix_indicators_user(void) {
+    led_t host_leds = host_keyboard_led_state();
+    if (host_leds.scroll_lock) {
+        rgb_matrix_set_color(92, 0xFF, 0x0, 0x0);
+    } else {
+        rgb_matrix_set_color(92, 0x0, 0x0, 0x0);
+    }
+    if (host_leds.num_lock) {
+        rgb_matrix_set_color(93, 0xFF, 0x0, 0x0);
+    } else {
+        rgb_matrix_set_color(93, 0x0, 0x0, 0x0);
+    }
+    if (host_leds.caps_lock) {
+        rgb_matrix_set_color(94, 0xFF, 0x0, 0x0);
+    } else {
+        rgb_matrix_set_color(94, 0x0, 0x0, 0x0);
+    }
+}
diff --git a/keyboards/monstargear/xo87/rgb/rgb.h b/keyboards/monstargear/xo87/rgb/rgb.h
new file mode 100644
index 0000000000..5ecb038b7d
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/rgb.h
@@ -0,0 +1,34 @@
+/* Copyright 2021 datafx
+ *
+ * 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_tkl_ansi( \
+    K000,       K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012,    K013, K014, K015, \
+    K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K313,    K113, K114, K115, \
+    K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K413,    K213, K214, K215, \
+    K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311,       K312,                      \
+    K400,       K402, K403, K404, K405, K406, K407, K408, K409, K410, K411,       K412,          K414,       \
+    K500, K501, K503,                   K506,                   K510, K511, K512, K415,    K513, K514, K515  \
+) { \
+	{ K000,  K001,  K002,  K003,  K004,  K005,  K006,  K007,  K008,  K009,  K010,  K011,  K012,  K013,  K014,  K015 }, \
+	{ K100,  K101,  K102,  K103,  K104,  K105,  K106,  K107,  K108,  K109,  K110,  K111,  K112,  K113,  K114,  K115 }, \
+	{ K200,  K201,  K202,  K203,  K204,  K205,  K206,  K207,  K208,  K209,  K210,  K211,  K212,  K213,  K214,  K215 }, \
+	{ K300,  K301,  K302,  K303,  K304,  K305,  K306,  K307,  K308,  K309,  K310,  K311,  K312,  K313,  KC_NO, KC_NO }, \
+	{ K400,  KC_NO, K402,  K403,  K404,  K405,  K406,  K407,  K408,  K409,  K410,  K411,  K412,  K413,  K414,  K415 }, \
+	{ K500,  K501,  KC_NO, K503,  KC_NO, KC_NO, K506,  KC_NO, KC_NO, KC_NO, K510,  K511,  K512,  K513,  K514,  K515 }  \
+}
diff --git a/keyboards/monstargear/xo87/rgb/rules.mk b/keyboards/monstargear/xo87/rgb/rules.mk
new file mode 100644
index 0000000000..ec3bdd2299
--- /dev/null
+++ b/keyboards/monstargear/xo87/rgb/rules.mk
@@ -0,0 +1,27 @@
+# MCU name
+MCU = at90usb646
+
+# Bootloader selection
+BOOTLOADER = lufa-dfu
+
+# Build Options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = lite     # 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
+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 = no        # Enable keyboard RGB underglow
+UNICODE_ENABLE = no         # Unicode
+BLUETOOTH_ENABLE = no       # Enable Bluetooth
+AUDIO_ENABLE = no           # Audio output
+RGB_MATRIX_ENABLE = yes
+RGB_MATRIX_DRIVER = WS2812
+RAW_ENABLE = no
+
+LAYOUTS = tkl_ansi