From 018b8e1d62f8c067bd556492b7e8cf8407eb6036 Mon Sep 17 00:00:00 2001
From: labahuy <68632528+labahuy@users.noreply.github.com>
Date: Thu, 4 Mar 2021 03:38:16 +0700
Subject: [PATCH] [Keyboard] Add Keyboard Rartlite (#11866)
---
keyboards/rart/rartlite/config.h | 53 +++++++
keyboards/rart/rartlite/info.json | 133 ++++++++++++++++++
.../rart/rartlite/keymaps/default/keymap.c | 37 +++++
keyboards/rart/rartlite/keymaps/via/keymap.c | 51 +++++++
keyboards/rart/rartlite/keymaps/via/rules.mk | 1 +
keyboards/rart/rartlite/rartlite.c | 26 ++++
keyboards/rart/rartlite/rartlite.h | 50 +++++++
keyboards/rart/rartlite/readme.md | 22 +++
keyboards/rart/rartlite/rules.mk | 22 +++
9 files changed, 395 insertions(+)
create mode 100644 keyboards/rart/rartlite/config.h
create mode 100644 keyboards/rart/rartlite/info.json
create mode 100644 keyboards/rart/rartlite/keymaps/default/keymap.c
create mode 100644 keyboards/rart/rartlite/keymaps/via/keymap.c
create mode 100644 keyboards/rart/rartlite/keymaps/via/rules.mk
create mode 100644 keyboards/rart/rartlite/rartlite.c
create mode 100644 keyboards/rart/rartlite/rartlite.h
create mode 100644 keyboards/rart/rartlite/readme.md
create mode 100644 keyboards/rart/rartlite/rules.mk
diff --git a/keyboards/rart/rartlite/config.h b/keyboards/rart/rartlite/config.h
new file mode 100644
index 0000000000..a11592d392
--- /dev/null
+++ b/keyboards/rart/rartlite/config.h
@@ -0,0 +1,53 @@
+/*
+Copyright 2021 Alabahuy
+
+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"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0x414C
+#define PRODUCT_ID 0x4040
+#define DEVICE_VER 0x0001
+#define MANUFACTURER Alabahuy
+#define PRODUCT RARTLITE
+
+/* key matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 7
+
+/* key matrix pins */
+#define MATRIX_ROW_PINS { F4, D2, B2, B4, B6, B5, D0, D1 }
+#define MATRIX_COL_PINS { D4, C6, D7, E6, B3, F7, D3 }
+#define UNUSED_PINS
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 5
+
+#define LED_CAPS_LOCK_PIN F5
+#define LED_NUM_LOCK_PIN F6
+
+#define LED_PIN_ON_STATE 0
+
+/* 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
diff --git a/keyboards/rart/rartlite/info.json b/keyboards/rart/rartlite/info.json
new file mode 100644
index 0000000000..0659957ded
--- /dev/null
+++ b/keyboards/rart/rartlite/info.json
@@ -0,0 +1,133 @@
+{
+ "keyboard_name": "RART4X4",
+ "url": "",
+ "maintainer": "Alabahuy",
+ "width": 15.25,
+ "height": 4.25,
+ "layouts": {
+ "LAYOUT_right_numpad": {
+ "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.25, "y": 0},
+ {"x": 13.25, "y": 0},
+ {"x": 14.25, "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, "w":1.5},
+ {"x": 12.25, "y": 1},
+ {"x": 13.25, "y": 1},
+ {"x": 14.25, "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": 11, "y": 2.25},
+ {"x": 12.25, "y": 2},
+ {"x": 13.25, "y": 2},
+ {"x": 14.25, "y": 2},
+
+ {"x": 0, "y": 3, "w":1.25},
+ {"x": 1.25, "y": 3},
+ {"x": 2.25, "y": 3, "w":2.75},
+ {"x": 5, "y": 3, "w":1.25},
+ {"x": 6.25, "y": 3, "w":2.25},
+ {"x": 8.5, "y": 3, "w":1.25},
+ {"x": 10, "y": 3.25},
+ {"x": 11, "y": 3.25},
+ {"x": 12, "y": 3.25},
+ {"x": 13.25, "y": 3},
+ {"x": 14.25, "y": 3}
+ ]
+ },
+
+ "LAYOUT_left_numpad": {
+ "layout": [
+ {"x": 0, "y": 0},
+ {"x": 1, "y": 0},
+ {"x": 2, "y": 0},
+ {"x": 3.25, "y": 0},
+ {"x": 4.25, "y": 0},
+ {"x": 5.25, "y": 0},
+ {"x": 6.25, "y": 0},
+ {"x": 7.25, "y": 0},
+ {"x": 8.25, "y": 0},
+ {"x": 9.25, "y": 0},
+ {"x": 10.25, "y": 0},
+ {"x": 11.25, "y": 0},
+ {"x": 12.25, "y": 0},
+ {"x": 13.25, "y": 0},
+ {"x": 14.25, "y": 0},
+
+ {"x": 0, "y": 1},
+ {"x": 1, "y": 1},
+ {"x": 2, "y": 1},
+ {"x": 3.25, "y": 1, "w":1.5},
+ {"x": 4.75, "y": 1},
+ {"x": 5.75, "y": 1},
+ {"x": 6.75, "y": 1},
+ {"x": 7.75, "y": 1},
+ {"x": 8.75, "y": 1},
+ {"x": 9.75, "y": 1},
+ {"x": 10.75, "y": 1},
+ {"x": 11.75, "y": 1},
+ {"x": 12.75, "y": 1},
+ {"x": 13.75, "y": 1, "w":1.5},
+
+ {"x": 0, "y": 2},
+ {"x": 1, "y": 2},
+ {"x": 2, "y": 2},
+ {"x": 3.25, "y": 2.25},
+ {"x": 4.5, "y": 2},
+ {"x": 5.5, "y": 2},
+ {"x": 6.5, "y": 2},
+ {"x": 7.5, "y": 2},
+ {"x": 8.5, "y": 2},
+ {"x": 9.5, "y": 2},
+ {"x": 10.5, "y": 2},
+ {"x": 11.5, "y": 2},
+ {"x": 12.5, "y": 2},
+ {"x": 13.5, "y": 2, "w":1.75},
+
+ {"x": 0, "y": 3},
+ {"x": 1, "y": 3},
+ {"x": 2.25, "y": 3.25},
+ {"x": 3.25, "y": 3.25},
+ {"x": 4.25, "y": 3.25},
+ {"x": 5.5, "y": 3, "w":1.25},
+ {"x": 6.75, "y": 3, "w":2.25},
+ {"x": 9, "y": 3, "w":1.25},
+ {"x": 10.25, "y": 3, "w":2.75},
+ {"x": 13, "y": 3},
+ {"x": 14, "y": 3, "w":1.25}
+ ]
+ }
+
+ }
+}
diff --git a/keyboards/rart/rartlite/keymaps/default/keymap.c b/keyboards/rart/rartlite/keymaps/default/keymap.c
new file mode 100644
index 0000000000..730aad9908
--- /dev/null
+++ b/keyboards/rart/rartlite/keymaps/default/keymap.c
@@ -0,0 +1,37 @@
+/*
+Copyright 2021 Alabahuy
+
+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] = {
+
+ [0] = LAYOUT_right_numpad(
+ KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_P7, KC_P8, KC_P9,
+ KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, KC_P4, KC_P5, KC_P6,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_P1, KC_P2, KC_P3,
+ KC_RCTL, KC_LALT, KC_SPC, KC_SPC, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
+ ),
+
+ [1] = LAYOUT_right_numpad(
+ 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_DEL, KC_INS, RESET,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, KC_PGDN, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_END, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+ ),
+
+};
+
diff --git a/keyboards/rart/rartlite/keymaps/via/keymap.c b/keyboards/rart/rartlite/keymaps/via/keymap.c
new file mode 100644
index 0000000000..9cb23f8a59
--- /dev/null
+++ b/keyboards/rart/rartlite/keymaps/via/keymap.c
@@ -0,0 +1,51 @@
+/*
+Copyright 2021 Alabahuy
+
+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] = {
+
+ [0] = LAYOUT_right_numpad(
+ KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_P7, KC_P8, KC_P9,
+ KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, KC_P4, KC_P5, KC_P6,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_P1, KC_P2, KC_P3,
+ KC_RCTL, KC_LALT, KC_SPC, KC_SPC, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
+ ),
+
+ [1] = LAYOUT_right_numpad(
+ 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_DEL, KC_INS, RESET,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, KC_PGDN, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_END, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+ ),
+
+ [2] = LAYOUT_right_numpad(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+ ),
+
+ [3] = LAYOUT_right_numpad(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+ )
+
+};
+
diff --git a/keyboards/rart/rartlite/keymaps/via/rules.mk b/keyboards/rart/rartlite/keymaps/via/rules.mk
new file mode 100644
index 0000000000..1e5b99807c
--- /dev/null
+++ b/keyboards/rart/rartlite/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes
diff --git a/keyboards/rart/rartlite/rartlite.c b/keyboards/rart/rartlite/rartlite.c
new file mode 100644
index 0000000000..1f431f928f
--- /dev/null
+++ b/keyboards/rart/rartlite/rartlite.c
@@ -0,0 +1,26 @@
+/* Copyright 2021 Alabahuy
+ * 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 "rartlite.h"
+
+void keyboard_pre_init_kb(void) {
+ setPinOutput(B1);
+
+ keyboard_pre_init_user();
+}
+
+layer_state_t layer_state_set_kb(layer_state_t state) {
+ writePin(B1, layer_state_cmp(state, 1));
+ return layer_state_set_user(state);
+}
diff --git a/keyboards/rart/rartlite/rartlite.h b/keyboards/rart/rartlite/rartlite.h
new file mode 100644
index 0000000000..a602de2240
--- /dev/null
+++ b/keyboards/rart/rartlite/rartlite.h
@@ -0,0 +1,50 @@
+/*
+Copyright 2021 Alabahuy
+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_right_numpad( \
+ K00, K10, K01, K11, K02, K12, K03, K13, K04, K14, K34, K05, K15, K06, K16, \
+ K20, K30, K21, K31, K22, K32, K23, K33, K24, K54, K25, K35, K26, K36, \
+ K40, K50, K41, K51, K42, K52, K43, K53, K44, K74, K45, K55, K46, K56, \
+ K60, K70, K61, K62, K63, K73, K64, K65, K75, K66, K76 \
+) \
+{ \
+ { K00, K01, K02, K03, K04, K05, K06 }, \
+ { K10, K11, K12, K13, K14, K15, K16 }, \
+ { K20, K21, K22, K23, K24, K25, K26 }, \
+ { K30, K31, K32, K33, K34, K35, K36 }, \
+ { K40, K41, K42, K43, K44, K45, K46 }, \
+ { K50, K51, K52, K53, K54, K55, K56 }, \
+ { K60, K61, K62, K63, K64, K65, K66 }, \
+ { K70, KC_NO, KC_NO, K73, K74, K75, K76 }, \
+}
+
+#define LAYOUT_left_numpad( \
+ K16, K06, K15, K05, K34, K14, K04, K13, K03, K12, K02, K11, K01, K10, K00, \
+ K36, K26, K35, K25, K54, K24, K33, K23, K32, K22, K31, K21, K30, K20, \
+ K56, K46, K55, K45, K74, K44, K53, K43, K52, K42, K51, K41, K50, K40, \
+ K76, K66, K75, K65, K64, K73, K63, K62, K61, K70, K60 \
+) \
+{ \
+ { K00, K01, K02, K03, K04, K05, K06 }, \
+ { K10, K11, K12, K13, K14, K15, K16 }, \
+ { K20, K21, K22, K23, K24, K25, K26 }, \
+ { K30, K31, K32, K33, K34, K35, K36 }, \
+ { K40, K41, K42, K43, K44, K45, K46 }, \
+ { K50, K51, K52, K53, K54, K55, K56 }, \
+ { K60, K61, K62, K63, K64, K65, K66 }, \
+ { K70, KC_NO, KC_NO, K73, K74, K75, K76 }, \
+}
diff --git a/keyboards/rart/rartlite/readme.md b/keyboards/rart/rartlite/readme.md
new file mode 100644
index 0000000000..b9f107fb0e
--- /dev/null
+++ b/keyboards/rart/rartlite/readme.md
@@ -0,0 +1,22 @@
+# [RARTLITE](https://github.com/alabahuy/RART/tree/master/RARTLITE)
+
+![Top](https://user-images.githubusercontent.com/30220306/107148534-4212e200-6986-11eb-824d-dd7fbe10d333.png)
+40% Layout mechanical keyboard with support left and right numpad. based on IMKG (Indonesia Mechanical Keyboard Group)
+
+* Keyboard Maintainer: [Alabahuy](https://github.com/alabahuy)
+* Hardware Supported: RARTLITE PCB, Promicro, Mini USB
+* Hardware Availability: Private GB
+
+Make example for this keyboard (after setting up your build environment):
+
+ make rart/rartlite:default
+
+Flashing example for this keyboard:
+
+ make rart/rartlite:default:flash
+
+## Bootloader
+
+To Enter the bootloader you can double click reset button on board when you flash the firmware
+
+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/rart/rartlite/rules.mk b/keyboards/rart/rartlite/rules.mk
new file mode 100644
index 0000000000..e6a4d762d3
--- /dev/null
+++ b/keyboards/rart/rartlite/rules.mk
@@ -0,0 +1,22 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = caterina
+
+# 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 = 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 = no # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no # Enable Bluetooth
+AUDIO_ENABLE = no # Audio output