From 504d443ee3feb69e7d3a2d65d4b60d21f86dea61 Mon Sep 17 00:00:00 2001
From: NightlyBoards <65656486+NightlyBoards@users.noreply.github.com>
Date: Sat, 14 Aug 2021 03:32:33 +0800
Subject: [PATCH] [Keyboard] Add n9 macropad (#13168)
---
keyboards/nightly_boards/n9/config.h | 93 +++++++++++++++++++
keyboards/nightly_boards/n9/info.json | 23 +++++
.../n9/keymaps/default/keymap.c | 24 +++++
.../nightly_boards/n9/keymaps/via/keymap.c | 39 ++++++++
.../nightly_boards/n9/keymaps/via/rules.mk | 2 +
keyboards/nightly_boards/n9/n9.c | 18 ++++
keyboards/nightly_boards/n9/n9.h | 29 ++++++
keyboards/nightly_boards/n9/readme.md | 18 ++++
keyboards/nightly_boards/n9/rules.mk | 21 +++++
9 files changed, 267 insertions(+)
create mode 100644 keyboards/nightly_boards/n9/config.h
create mode 100644 keyboards/nightly_boards/n9/info.json
create mode 100644 keyboards/nightly_boards/n9/keymaps/default/keymap.c
create mode 100644 keyboards/nightly_boards/n9/keymaps/via/keymap.c
create mode 100644 keyboards/nightly_boards/n9/keymaps/via/rules.mk
create mode 100644 keyboards/nightly_boards/n9/n9.c
create mode 100644 keyboards/nightly_boards/n9/n9.h
create mode 100644 keyboards/nightly_boards/n9/readme.md
create mode 100644 keyboards/nightly_boards/n9/rules.mk
diff --git a/keyboards/nightly_boards/n9/config.h b/keyboards/nightly_boards/n9/config.h
new file mode 100644
index 0000000000..b8b29099ca
--- /dev/null
+++ b/keyboards/nightly_boards/n9/config.h
@@ -0,0 +1,93 @@
+/*
+Copyright 2020 Neil Brian Ramirez
+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 0xD812
+#define PRODUCT_ID 0x0012
+#define DEVICE_VER 0x0001
+#define MANUFACTURER Neil Brian Ramirez
+#define PRODUCT [n]9
+
+/* key matrix size */
+#define MATRIX_ROWS 3
+#define MATRIX_COLS 3
+
+/*
+ * Keyboard Matrix Assignments
+ *
+ * Change this to how you wired your keyboard
+ * COLS: AVR pins used for columns, left to right
+ * ROWS: AVR pins used for rows, top to bottom
+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
+ * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
+ *
+ */
+#define MATRIX_ROW_PINS { F4, B1, B3 }
+#define MATRIX_COL_PINS { F6, F7, D4 }
+#define UNUSED_PINS
+
+/* COL2ROW, ROW2COL*/
+#define DIODE_DIRECTION COL2ROW
+
+// #define BACKLIGHT_PIN F1
+// #define BACKLIGHT_BREATHING
+// #define BACKLIGHT_LEVELS 3
+
+#define RGB_DI_PIN F5
+#ifdef RGB_DI_PIN
+#define RGBLED_NUM 8
+#define RGBLIGHT_HUE_STEP 8
+#define RGBLIGHT_SAT_STEP 8
+#define RGBLIGHT_VAL_STEP 8
+#define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
+#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
+// /*== all animations enable ==*/
+#define RGBLIGHT_ANIMATIONS
+// /*== or choose animations ==*/
+// #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
+// /*== customize breathing effect ==*/
+// /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
+// #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
+// /*==== use exp() and sin() ====*/
+// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
+// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
+#endif
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCE 5
+
+/* define if matrix has ghost (lacks anti-ghosting diodes) */
+//#define MATRIX_HAS_GHOST
+
+/* 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
+
+
+/* disable these deprecated features by default */
+#define NO_ACTION_MACRO
+#define NO_ACTION_FUNCTION
diff --git a/keyboards/nightly_boards/n9/info.json b/keyboards/nightly_boards/n9/info.json
new file mode 100644
index 0000000000..aeba1a2b1d
--- /dev/null
+++ b/keyboards/nightly_boards/n9/info.json
@@ -0,0 +1,23 @@
+{
+ "keyboard_name": "[n]9",
+ "url": "",
+ "maintainer": "Neil Brian Ramirez",
+ "width": 3,
+ "height": 3,
+ "layouts": {
+ "LAYOUT": {
+ "layout": [
+ {"x":0, "y":0},
+ {"x":1, "y":0},
+ {"x":2, "y":0},
+
+ {"x":0, "y":1},
+ {"x":1, "y":1},
+ {"x":2, "y":1},
+
+ {"x":0, "y":2},
+ {"x":1, "y":2},
+ {"x":2, "y":2}]
+ }
+ }
+}
diff --git a/keyboards/nightly_boards/n9/keymaps/default/keymap.c b/keyboards/nightly_boards/n9/keymaps/default/keymap.c
new file mode 100644
index 0000000000..8687c0be98
--- /dev/null
+++ b/keyboards/nightly_boards/n9/keymaps/default/keymap.c
@@ -0,0 +1,24 @@
+/* Copyright 2020 Neil Brian Ramirez
+ *
+ * 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(
+ KC_1, KC_2, KC_3,
+ KC_4, KC_5, KC_6,
+ KC_7, KC_8, KC_9
+ ),
+};
diff --git a/keyboards/nightly_boards/n9/keymaps/via/keymap.c b/keyboards/nightly_boards/n9/keymaps/via/keymap.c
new file mode 100644
index 0000000000..34c4cc26ce
--- /dev/null
+++ b/keyboards/nightly_boards/n9/keymaps/via/keymap.c
@@ -0,0 +1,39 @@
+/* Copyright 2020 Neil Brian Ramirez
+ *
+ * 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(
+ KC_1, KC_2, KC_3,
+ KC_4, KC_5, KC_6,
+ KC_7, KC_8, KC_9
+ ),
+ [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
+ ),
+};
diff --git a/keyboards/nightly_boards/n9/keymaps/via/rules.mk b/keyboards/nightly_boards/n9/keymaps/via/rules.mk
new file mode 100644
index 0000000000..43061db1dd
--- /dev/null
+++ b/keyboards/nightly_boards/n9/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
+VIA_ENABLE = yes
+LTO_ENABLE = yes
\ No newline at end of file
diff --git a/keyboards/nightly_boards/n9/n9.c b/keyboards/nightly_boards/n9/n9.c
new file mode 100644
index 0000000000..e6b736aa8b
--- /dev/null
+++ b/keyboards/nightly_boards/n9/n9.c
@@ -0,0 +1,18 @@
+/* Copyright 2020 Neil Brian Ramirez
+ *
+ * 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 "n9.h"
+
diff --git a/keyboards/nightly_boards/n9/n9.h b/keyboards/nightly_boards/n9/n9.h
new file mode 100644
index 0000000000..6b0dbdc2e6
--- /dev/null
+++ b/keyboards/nightly_boards/n9/n9.h
@@ -0,0 +1,29 @@
+/* Copyright 2020 Neil Brian Ramirez
+ *
+ * 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( \
+ K00, K01, K02, \
+ K10, K11, K12, \
+ K20, K21, K22 \
+) { \
+ { K00, K01, K02 }, \
+ { K10, K11, K12 }, \
+ { K20, K21, K22 }, \
+}
diff --git a/keyboards/nightly_boards/n9/readme.md b/keyboards/nightly_boards/n9/readme.md
new file mode 100644
index 0000000000..3bf2024398
--- /dev/null
+++ b/keyboards/nightly_boards/n9/readme.md
@@ -0,0 +1,18 @@
+# [n]9
+
+![n9](https://i.imgur.com/dDGm2g7.png)
+
+A 9-key pcb powered by a pro-micro
+
+* Keyboard Maintainer: [Neil Brian Ramirez](https://github.com/NightlyBoards)
+* Hardware Supported: atmega32u4
+
+Make example for this keyboard (after setting up your build environment):
+
+ make nightly_boards/n9:default
+
+Flashing example for this keyboard:
+
+ make nightly_boards/n9:default:flash
+
+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/nightly_boards/n9/rules.mk b/keyboards/nightly_boards/n9/rules.mk
new file mode 100644
index 0000000000..39b3797a02
--- /dev/null
+++ b/keyboards/nightly_boards/n9/rules.mk
@@ -0,0 +1,21 @@
+# 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 = no # USB Nkey Rollover
+BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no # Enable Bluetooth