From b1419742a51cd597548dff0059a4ba3781e9b984 Mon Sep 17 00:00:00 2001
From: NightlyBoards <65656486+NightlyBoards@users.noreply.github.com>
Date: Mon, 11 Jan 2021 14:18:28 +0800
Subject: [Keyboard] Add the [n]40-o (#11286)
* Create Alter folder
* Revert "Create Alter folder"
This reverts commit 361103b821dbb22957b66cdedb0d11f996def71c.
* Added the n40_o folder
* Edited info.json, n40_o.h and rules.mk
* Edited readme as per comment
---
keyboards/nightly_boards/n40_o/config.h | 84 +++++++++
keyboards/nightly_boards/n40_o/encoder_action.c | 51 ++++++
keyboards/nightly_boards/n40_o/encoder_action.h | 21 +++
keyboards/nightly_boards/n40_o/info.json | 191 +++++++++++++++++++++
.../nightly_boards/n40_o/keymaps/default/keymap.c | 26 +++
.../n40_o/keymaps/ortho_4x13_1x2u_c/keymap.c | 26 +++
.../n40_o/keymaps/ortho_4x13_encoders/keymap.c | 26 +++
.../nightly_boards/n40_o/keymaps/via/keymap.c | 48 ++++++
.../nightly_boards/n40_o/keymaps/via/rules.mk | 2 +
keyboards/nightly_boards/n40_o/n40_o.c | 27 +++
keyboards/nightly_boards/n40_o/n40_o.h | 68 ++++++++
keyboards/nightly_boards/n40_o/readme.md | 20 +++
keyboards/nightly_boards/n40_o/rules.mk | 27 +++
13 files changed, 617 insertions(+)
create mode 100644 keyboards/nightly_boards/n40_o/config.h
create mode 100644 keyboards/nightly_boards/n40_o/encoder_action.c
create mode 100644 keyboards/nightly_boards/n40_o/encoder_action.h
create mode 100644 keyboards/nightly_boards/n40_o/info.json
create mode 100644 keyboards/nightly_boards/n40_o/keymaps/default/keymap.c
create mode 100644 keyboards/nightly_boards/n40_o/keymaps/ortho_4x13_1x2u_c/keymap.c
create mode 100644 keyboards/nightly_boards/n40_o/keymaps/ortho_4x13_encoders/keymap.c
create mode 100644 keyboards/nightly_boards/n40_o/keymaps/via/keymap.c
create mode 100644 keyboards/nightly_boards/n40_o/keymaps/via/rules.mk
create mode 100644 keyboards/nightly_boards/n40_o/n40_o.c
create mode 100644 keyboards/nightly_boards/n40_o/n40_o.h
create mode 100644 keyboards/nightly_boards/n40_o/readme.md
create mode 100644 keyboards/nightly_boards/n40_o/rules.mk
(limited to 'keyboards/nightly_boards')
diff --git a/keyboards/nightly_boards/n40_o/config.h b/keyboards/nightly_boards/n40_o/config.h
new file mode 100644
index 0000000000..e0bcdbe011
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/config.h
@@ -0,0 +1,84 @@
+/*
+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 0x0009
+#define DEVICE_VER 0x0001
+#define MANUFACTURER Neil Brian Ramirez
+#define PRODUCT [n]40-o
+
+/* key matrix size */
+#define MATRIX_ROWS 5
+#define MATRIX_COLS 13
+
+/*
+ * 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 { E6, F0, F1, D7, NO_PIN }
+#define MATRIX_COL_PINS { B5, C7, D6, D4, B3, B2, B1, B0, D5, D3, D2, D1, D0 }
+#define UNUSED_PINS
+
+/* COL2ROW, ROW2COL*/
+#define DIODE_DIRECTION COL2ROW
+
+#define RGB_DI_PIN B4
+#ifdef RGB_DI_PIN
+#define RGBLED_NUM 12
+#define RGBLIGHT_ANIMATIONS
+
+#endif
+
+/* Encoders */
+
+#define ENCODERS 3
+
+#define ENCODERS_PAD_A { F6, F4 , B6 }
+#define ENCODERS_PAD_B { F7, F5 , C6 }
+
+#define ENCODERS_CW_KEY { { 2, 4 },{ 4, 4 },{ 6, 4 } }
+#define ENCODERS_CCW_KEY { { 1, 4 },{ 3, 4 },{ 5, 4 } }
+
+/* Audio */
+
+#define B7_AUDIO
+
+#define AUDIO_CLICKY
+
+/* 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
+
+
diff --git a/keyboards/nightly_boards/n40_o/encoder_action.c b/keyboards/nightly_boards/n40_o/encoder_action.c
new file mode 100644
index 0000000000..042a3871c9
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/encoder_action.c
@@ -0,0 +1,51 @@
+/* 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 3 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 "encoder_action.h"
+
+#ifdef ENCODERS
+static uint8_t encoder_state[ENCODERS] = {0};
+static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY;
+static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY;
+#endif
+
+void encoder_action_unregister(void) {
+#ifdef ENCODERS
+ for (int index = 0; index < ENCODERS; ++index) {
+ if (encoder_state[index]) {
+ keyevent_t encoder_event = (keyevent_t) {
+ .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
+ .pressed = false,
+ .time = (timer_read() | 1)
+ };
+ encoder_state[index] = 0;
+ action_exec(encoder_event);
+ }
+ }
+#endif
+}
+
+void encoder_action_register(uint8_t index, bool clockwise) {
+#ifdef ENCODERS
+ keyevent_t encoder_event = (keyevent_t) {
+ .key = clockwise ? encoder_cw[index] : encoder_ccw[index],
+ .pressed = true,
+ .time = (timer_read() | 1)
+ };
+ encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
+ action_exec(encoder_event);
+#endif
+}
diff --git a/keyboards/nightly_boards/n40_o/encoder_action.h b/keyboards/nightly_boards/n40_o/encoder_action.h
new file mode 100644
index 0000000000..098210d40c
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/encoder_action.h
@@ -0,0 +1,21 @@
+/* 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 3 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 "quantum.h"
+
+void encoder_action_unregister(void);
+
+void encoder_action_register(uint8_t index, bool clockwise);
\ No newline at end of file
diff --git a/keyboards/nightly_boards/n40_o/info.json b/keyboards/nightly_boards/n40_o/info.json
new file mode 100644
index 0000000000..4f037ec058
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/info.json
@@ -0,0 +1,191 @@
+{
+ "keyboard_name": "[n]40-o",
+ "url": "",
+ "maintainer": "Neil Brian Ramirez",
+ "width": 15.5,
+ "height": 4,
+ "layouts": {
+ "LAYOUT_ortho_4x13_encoders": {
+ "layout": [
+ {"x":0, "y":0},
+ {"x":1, "y":0},
+ {"x":2.25, "y":0},
+ {"x":3.5, "y":0},
+ {"x":4.5, "y":0},
+ {"x":5.5, "y":0},
+ {"x":6.5, "y":0},
+ {"x":7.5, "y":0},
+ {"x":8.5, "y":0},
+ {"x":9.5, "y":0},
+ {"x":10.5, "y":0},
+ {"x":11.5, "y":0},
+ {"x":12.5, "y":0},
+ {"x":13.5, "y":0},
+ {"x":14.5, "y":0},
+
+ {"x":0, "y":1},
+ {"x":1, "y":1},
+ {"x":2.25, "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},
+ {"x":11.5, "y":1},
+ {"x":12.5, "y":1},
+ {"x":13.5, "y":1},
+ {"x":14.5, "y":1},
+
+ {"x":0, "y":2},
+ {"x":1, "y":2},
+ {"x":2.25, "y":2},
+ {"x":3.5, "y":2},
+ {"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},
+ {"x":14.5, "y":2},
+
+ {"x":2.25, "y":3},
+ {"x":3.5, "y":3},
+ {"x":4.5, "y":3},
+ {"x":5.5, "y":3},
+ {"x":6.5, "y":3},
+ {"x":7.5, "y":3},
+ {"x":8.5, "y":3},
+ {"x":9.5, "y":3},
+ {"x":10.5, "y":3},
+ {"x":11.5, "y":3},
+ {"x":12.5, "y":3},
+ {"x":13.5, "y":3},
+ {"x":14.5, "y":3}
+ ]
+ },
+ "LAYOUT_ortho_4x13": {
+ "layout": [
+ {"x":0, "y":0},
+ {"x":1.25, "y":0},
+ {"x":2.25, "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":0, "y":1},
+ {"x":1.25, "y":1},
+ {"x":2.25, "y":1},
+ {"x":3.25, "y":1},
+ {"x":4.25, "y":1},
+ {"x":5.25, "y":1},
+ {"x":6.25, "y":1},
+ {"x":7.25, "y":1},
+ {"x":8.25, "y":1},
+ {"x":9.25, "y":1},
+ {"x":10.25, "y":1},
+ {"x":11.25, "y":1},
+ {"x":12.25, "y":1},
+
+ {"x":0, "y":2},
+ {"x":1.25, "y":2},
+ {"x":2.25, "y":2},
+ {"x":3.25, "y":2},
+ {"x":4.25, "y":2},
+ {"x":5.25, "y":2},
+ {"x":6.25, "y":2},
+ {"x":7.25, "y":2},
+ {"x":8.25, "y":2},
+ {"x":9.25, "y":2},
+ {"x":10.25, "y":2},
+ {"x":11.25, "y":2},
+ {"x":12.25, "y":2},
+
+ {"x":0, "y":3},
+ {"x":1.25, "y":3},
+ {"x":2.25, "y":3},
+ {"x":3.25, "y":3},
+ {"x":4.25, "y":3},
+ {"x":5.25, "y":3},
+ {"x":6.25, "y":3},
+ {"x":7.25, "y":3},
+ {"x":8.25, "y":3},
+ {"x":9.25, "y":3},
+ {"x":10.25, "y":3},
+ {"x":11.25, "y":3},
+ {"x":12.25, "y":3}
+ ]
+ },
+ "LAYOUT_ortho_4x13_1x2u_c": {
+ "layout": [
+ {"x":0, "y":0},
+ {"x":1.25, "y":0},
+ {"x":2.25, "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":0, "y":1},
+ {"x":1.25, "y":1},
+ {"x":2.25, "y":1},
+ {"x":3.25, "y":1},
+ {"x":4.25, "y":1},
+ {"x":5.25, "y":1},
+ {"x":6.25, "y":1},
+ {"x":7.25, "y":1},
+ {"x":8.25, "y":1},
+ {"x":9.25, "y":1},
+ {"x":10.25, "y":1},
+ {"x":11.25, "y":1},
+ {"x":12.25, "y":1},
+
+ {"x":0, "y":2},
+ {"x":1.25, "y":2},
+ {"x":2.25, "y":2},
+ {"x":3.25, "y":2},
+ {"x":4.25, "y":2},
+ {"x":5.25, "y":2},
+ {"x":6.25, "y":2},
+ {"x":7.25, "y":2},
+ {"x":8.25, "y":2},
+ {"x":9.25, "y":2},
+ {"x":10.25, "y":2},
+ {"x":11.25, "y":2},
+ {"x":12.25, "y":2},
+
+ {"x":0, "y":3},
+ {"x":1.25, "y":3},
+ {"x":2.25, "y":3},
+ {"x":3.25, "y":3},
+ {"x":4.25, "y":3},
+ {"x":5.25, "y":3},
+ {"x":6.25, "y":3, "w":2},
+ {"x":8.25, "y":3},
+ {"x":9.25, "y":3},
+ {"x":10.25, "y":3},
+ {"x":11.25, "y":3},
+ {"x":12.25, "y":3}
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/keyboards/nightly_boards/n40_o/keymaps/default/keymap.c b/keyboards/nightly_boards/n40_o/keymaps/default/keymap.c
new file mode 100644
index 0000000000..658b43689a
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/keymaps/default/keymap.c
@@ -0,0 +1,26 @@
+/* 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_ortho_4x13(
+ KC_SPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
+ KC_SPC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
+ KC_SPC, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
+ KC_SPC, KC_SPC, KC_LCTL, KC_LALT, KC_LGUI, MO(1), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
+ ),
+};
diff --git a/keyboards/nightly_boards/n40_o/keymaps/ortho_4x13_1x2u_c/keymap.c b/keyboards/nightly_boards/n40_o/keymaps/ortho_4x13_1x2u_c/keymap.c
new file mode 100644
index 0000000000..55f22cdc49
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/keymaps/ortho_4x13_1x2u_c/keymap.c
@@ -0,0 +1,26 @@
+/* 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_ortho_4x13_1x2u_c(
+ KC_SPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
+ KC_SPC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
+ KC_SPC, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
+ KC_SPC, KC_SPC, KC_LCTL, KC_LALT, KC_LGUI, MO(1), KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
+ ),
+};
diff --git a/keyboards/nightly_boards/n40_o/keymaps/ortho_4x13_encoders/keymap.c b/keyboards/nightly_boards/n40_o/keymaps/ortho_4x13_encoders/keymap.c
new file mode 100644
index 0000000000..f6e0dc23ee
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/keymaps/ortho_4x13_encoders/keymap.c
@@ -0,0 +1,26 @@
+/* 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_ortho_4x13_encoders(
+ KC_SPC, KC_SPC, KC_SPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
+ KC_SPC, KC_SPC, KC_SPC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
+ KC_SPC, KC_SPC, KC_SPC, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
+ KC_SPC, KC_SPC, KC_LCTL, KC_LALT, KC_LGUI, MO(1), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
+ ),
+};
diff --git a/keyboards/nightly_boards/n40_o/keymaps/via/keymap.c b/keyboards/nightly_boards/n40_o/keymaps/via/keymap.c
new file mode 100644
index 0000000000..830d8d8782
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/keymaps/via/keymap.c
@@ -0,0 +1,48 @@
+/* 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_ortho_4x13_encoders(
+ KC_SPC, KC_SPC, KC_SPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
+ KC_SPC, KC_SPC, KC_SPC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
+ KC_SPC, KC_SPC, KC_SPC, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
+ KC_SPC, KC_SPC, KC_LCTL, KC_LALT, KC_LGUI, MO(1), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
+
+ ),
+ [1] = LAYOUT_ortho_4x13_encoders(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+
+ ),
+ [2] = LAYOUT_ortho_4x13_encoders(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+
+ ),
+ [3] = LAYOUT_ortho_4x13_encoders(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+
+ ),
+};
diff --git a/keyboards/nightly_boards/n40_o/keymaps/via/rules.mk b/keyboards/nightly_boards/n40_o/keymaps/via/rules.mk
new file mode 100644
index 0000000000..43061db1dd
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/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/n40_o/n40_o.c b/keyboards/nightly_boards/n40_o/n40_o.c
new file mode 100644
index 0000000000..a91a0716b3
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/n40_o.c
@@ -0,0 +1,27 @@
+/* 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 "n40_o.h"
+
+void matrix_scan_kb(void) {
+ encoder_action_unregister();
+ matrix_scan_user();
+}
+
+void encoder_update_kb(uint8_t index, bool clockwise) {
+ encoder_action_register(index, clockwise);
+ // encoder_update_user(index, clockwise);
+};
\ No newline at end of file
diff --git a/keyboards/nightly_boards/n40_o/n40_o.h b/keyboards/nightly_boards/n40_o/n40_o.h
new file mode 100644
index 0000000000..d7c44d9d88
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/n40_o.h
@@ -0,0 +1,68 @@
+/* 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"
+#include "encoder_action.h"
+
+/* This is a shortcut to help you visually see your layout.
+ *
+ * The first section contains all of the arguments representing the physical
+ * layout of the board and position of the keys.
+ *
+ * The second converts the arguments into a two-dimensional array which
+ * represents the switch matrix.
+ */
+
+#define LAYOUT_ortho_4x13( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
+ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C \
+) { \
+ { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C }, \
+ { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C }, \
+ { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C }, \
+ { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+}
+
+#define LAYOUT_ortho_4x13_1x2u_c( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
+ K30, K31, K32, K33, K34, K35, K36, K38, K39, K3A, K3B, K3C \
+) { \
+ { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C }, \
+ { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C }, \
+ { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C }, \
+ { K30, K31, K32, K33, K34, K35, K36, KC_NO, K38, K39, K3A, K3B, K3C }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+}
+
+#define LAYOUT_ortho_4x13_encoders( \
+ E00A, E00B, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \
+ E01A, E01B, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, \
+ E02A, E02B, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
+ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C \
+) { \
+ { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C }, \
+ { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C }, \
+ { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C }, \
+ { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C }, \
+ { KC_NO, E00A, E00B, E01A, E01B, E02A, E02B, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+}
diff --git a/keyboards/nightly_boards/n40_o/readme.md b/keyboards/nightly_boards/n40_o/readme.md
new file mode 100644
index 0000000000..620cec8b74
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/readme.md
@@ -0,0 +1,20 @@
+# Nightly Boards [n]40-o
+
+![[n]40-o](https://i.imgur.com/CFIKCXNl.jpg)
+
+A 4x12 Ortholinear keyboard with left-side macro keys that supports three rotary encoders
+
+* 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/n40_o:default
+
+Flashing example for this keyboard:
+
+ make nightly_boards/n40_o:default:flash
+
+You can enter bootloader mode by pressing the physical reset button at the back of the pcb or by holding the upper left key/rotary encoder while plugging the usb cable.
+
+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/n40_o/rules.mk b/keyboards/nightly_boards/n40_o/rules.mk
new file mode 100644
index 0000000000..0eeb14fdc2
--- /dev/null
+++ b/keyboards/nightly_boards/n40_o/rules.mk
@@ -0,0 +1,27 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = atmel-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 = 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
+AUDIO_ENABLE = yes # Audio output
+ENCODER_ENABLE = yes # Enable Rotary Encoders
+LTO_ENABLE = yes
+
+# Added encoder Action
+SRC += encoder_action.c
\ No newline at end of file
--
cgit v1.2.1