From 412c6bf44785e2312821a484a7cd36ce1ec6361a Mon Sep 17 00:00:00 2001
From: NightlyBoards <65656486+NightlyBoards@users.noreply.github.com>
Date: Fri, 17 Jul 2020 23:46:11 +0800
Subject: [PATCH] Add Alter Keyboard (#9579)
* Create Alter folder
* Revert "Create Alter folder"
This reverts commit 361103b821dbb22957b66cdedb0d11f996def71c.
* Add Alter keyboard
* Fixed keymap.c
* Fixed another issue on the keymap.c
* Updated the files based on the comments
* Edited default keymap and enabled rgbanimations on config.h
* Updated the info.json
---
keyboards/nightly_boards/alter/rev1/config.h | 96 +++++++++++++++++++
keyboards/nightly_boards/alter/rev1/info.json | 82 ++++++++++++++++
.../alter/rev1/keymaps/default/keymap.c | 33 +++++++
keyboards/nightly_boards/alter/rev1/readme.md | 12 +++
keyboards/nightly_boards/alter/rev1/rev1.c | 37 +++++++
keyboards/nightly_boards/alter/rev1/rev1.h | 46 +++++++++
keyboards/nightly_boards/alter/rev1/rules.mk | 31 ++++++
7 files changed, 337 insertions(+)
create mode 100644 keyboards/nightly_boards/alter/rev1/config.h
create mode 100644 keyboards/nightly_boards/alter/rev1/info.json
create mode 100644 keyboards/nightly_boards/alter/rev1/keymaps/default/keymap.c
create mode 100644 keyboards/nightly_boards/alter/rev1/readme.md
create mode 100644 keyboards/nightly_boards/alter/rev1/rev1.c
create mode 100644 keyboards/nightly_boards/alter/rev1/rev1.h
create mode 100644 keyboards/nightly_boards/alter/rev1/rules.mk
diff --git a/keyboards/nightly_boards/alter/rev1/config.h b/keyboards/nightly_boards/alter/rev1/config.h
new file mode 100644
index 000000000..86ebe2ad7
--- /dev/null
+++ b/keyboards/nightly_boards/alter/rev1/config.h
@@ -0,0 +1,96 @@
+/*
+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 0x0717
+#define PRODUCT_ID 0x0002
+#define DEVICE_VER 0x0001
+#define MANUFACTURER Neil Brian Ramirez
+#define PRODUCT Alter
+#define DESCRIPTION An Alice layout keyboard
+
+/* key matrix size */
+#define MATRIX_ROWS 10
+#define MATRIX_COLS 8
+
+/*
+ * 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 { F7, F6, F5, E6, D0, B7, D5, D3, D2, D1 }
+#define MATRIX_COL_PINS { C7, C6, B6, B5, B0, B1, B2, B3 }
+#define UNUSED_PINS
+
+/* COL2ROW, ROW2COL*/
+#define DIODE_DIRECTION COL2ROW
+
+// #define BACKLIGHT_PIN F1
+// #define BACKLIGHT_BREATHING
+// #define BACKLIGHT_LEVELS 3
+
+#define RGB_DI_PIN F1
+#ifdef RGB_DI_PIN
+#define RGBLED_NUM 18
+#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/alter/rev1/info.json b/keyboards/nightly_boards/alter/rev1/info.json
new file mode 100644
index 000000000..abf155f1c
--- /dev/null
+++ b/keyboards/nightly_boards/alter/rev1/info.json
@@ -0,0 +1,82 @@
+{
+ "keyboard_name": "Alter",
+ "url": "",
+ "maintainer": "Neil Brian Ramirez",
+ "width": 20,
+ "height": 5.25,
+ "layouts": {
+ "LAYOUT": {
+ "layout": [
+ {"x":0.5, "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":11.25, "y":0},
+ {"x":12.25, "y":0},
+ {"x":13.25, "y":0},
+ {"x":14.25, "y":0},
+ {"x":15.25, "y":0},
+ {"x":16.25, "y":0},
+ {"x":17.25, "y":0},
+ {"x":18.25, "y":0},
+
+ {"x":0.25, "y":1},
+ {"x":1.75, "y":1, "w":1.5},
+ {"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":11, "y":1},
+ {"x":12, "y":1},
+ {"x":13, "y":1},
+ {"x":14, "y":1},
+ {"x":15, "y":1},
+ {"x":16, "y":1},
+ {"x":17, "y":1},
+ {"x":18, "y":1, "w":1.5},
+
+ {"x":0, "y":2},
+ {"x":1.5, "y":2, "w":1.75},
+ {"x":3.25, "y":2},
+ {"x":4.5, "y":2},
+ {"x":5.5, "y":2},
+ {"x":6.5, "y":2},
+ {"x":7.5, "y":2},
+ {"x":11.25, "y":2},
+ {"x":12.25, "y":2},
+ {"x":13.25, "y":2},
+ {"x":14.25, "y":2},
+ {"x":15.5, "y":2},
+ {"x":16.5, "y":2},
+ {"x":17.5, "y":2, "w":2.25},
+
+ {"x":1.25, "y":3, "w":2.25},
+ {"x":3.5, "y":3},
+ {"x":5, "y":3},
+ {"x":6, "y":3},
+ {"x":7, "y":3},
+ {"x":8, "y":3},
+ {"x":10.75, "y":3},
+ {"x":11.75, "y":3},
+ {"x":12.75, "y":3},
+ {"x":13.75, "y":3},
+ {"x":15.25, "y":3},
+ {"x":16.25, "y":3},
+ {"x":17.25, "y":3, "w":1.75},
+ {"x":19, "y":3},
+
+ {"x":1.25, "y":4, "w":1.5},
+ {"x":5, "y":4, "w":1.5},
+ {"x":6.5, "y":4, "w":2},
+ {"x":8.5, "y":4, "w":1.25},
+ {"x":10.5, "y":4, "w":2.75},
+ {"x":13.25, "y":4, "w":1.5},
+ {"x":18.25, "y":4, "w":1.5}]
+ }
+ }
+}
diff --git a/keyboards/nightly_boards/alter/rev1/keymaps/default/keymap.c b/keyboards/nightly_boards/alter/rev1/keymaps/default/keymap.c
new file mode 100644
index 000000000..cf2e561c7
--- /dev/null
+++ b/keyboards/nightly_boards/alter/rev1/keymaps/default/keymap.c
@@ -0,0 +1,33 @@
+/* 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_ESC, KC_GESC, 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_BSPC,
+ 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_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_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1),
+ KC_LCTL, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RGUI, KC_RCTL
+ ),
+ [1] = LAYOUT(
+ RESET, _______, 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_BRIU, _______, _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______ , _______, KC_DEL,
+ KC_BRID, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ RGB_TOG, RGB_MOD, RGB_RMOD,RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, KC_HOME, KC_END, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______
+ ),
+};
diff --git a/keyboards/nightly_boards/alter/rev1/readme.md b/keyboards/nightly_boards/alter/rev1/readme.md
new file mode 100644
index 000000000..81079f064
--- /dev/null
+++ b/keyboards/nightly_boards/alter/rev1/readme.md
@@ -0,0 +1,12 @@
+# Alter
+
+An Alice layout keyboard
+
+* 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/alter/rev1:default
+
+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).
\ No newline at end of file
diff --git a/keyboards/nightly_boards/alter/rev1/rev1.c b/keyboards/nightly_boards/alter/rev1/rev1.c
new file mode 100644
index 000000000..df3dd6aed
--- /dev/null
+++ b/keyboards/nightly_boards/alter/rev1/rev1.c
@@ -0,0 +1,37 @@
+/* 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 "rev1.h"
+
+void keyboard_pre_init_kb(void) {
+ led_init_ports();
+ keyboard_pre_init_user();
+}
+
+void led_init_ports(void) {
+ setPinOutput(D7);
+ setPinOutput(D6);
+ setPinOutput(B4);
+}
+
+bool led_update_kb(led_t led_state) {
+ if (led_update_user(led_state)) {
+ writePin(D7, led_state.num_lock);
+ writePin(D6, led_state.caps_lock);
+ writePin(B4, led_state.scroll_lock);
+ }
+ return true;
+}
diff --git a/keyboards/nightly_boards/alter/rev1/rev1.h b/keyboards/nightly_boards/alter/rev1/rev1.h
new file mode 100644
index 000000000..ee919c56d
--- /dev/null
+++ b/keyboards/nightly_boards/alter/rev1/rev1.h
@@ -0,0 +1,46 @@
+/* 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"
+
+/* 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( \
+ K00, K10, K01, K11, K02, K12, K03, K13, K04, K14, K05, K15, K06, K16, K17, K07, \
+ K20, K30, K21, K31, K22, K32, K23, K24, K34, K25, K35, K26, K36, K27, K37, \
+ K40, K50, K51, K42, K52, K43, K53, K44, K54, K45, K55, K46, K56, K47, \
+ K70, K71, K62, K72, K63, K73, K64, K74, K65, K75, K66, K76, K67, K77, \
+ K90, K82, K92, K83, K84, K95, K87 \
+) { \
+ { K00, K01, K02, K03, K04, K05, K06, K07 }, \
+ { K10, K11, K12, K13, K14, K15, K16, K17 }, \
+ { K20, K21, K22, K23, K24, K25, K26, K27 }, \
+ { K30, K31, K32, KC_NO, K34, K35, K36, K37 }, \
+ { K40, KC_NO, K42, K43, K44, K45, K46, K47 }, \
+ { K50, K51, K52, K53, K54, K55, K56, KC_NO }, \
+ { KC_NO, KC_NO, K62, K63, K64, K65, K66, K67 }, \
+ { K70, K71, K72, K73, K74, K75, K76, K77 }, \
+ { KC_NO, KC_NO, K82, K83, K84, KC_NO, KC_NO, K87 }, \
+ { K90, KC_NO, K92, KC_NO, KC_NO, K95, KC_NO, KC_NO }, \
+}
diff --git a/keyboards/nightly_boards/alter/rev1/rules.mk b/keyboards/nightly_boards/alter/rev1/rules.mk
new file mode 100644
index 000000000..5dbee69a1
--- /dev/null
+++ b/keyboards/nightly_boards/alter/rev1/rules.mk
@@ -0,0 +1,31 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+# Teensy halfkay
+# Pro Micro caterina
+# Atmel DFU atmel-dfu
+# LUFA DFU lufa-dfu
+# QMK DFU qmk-dfu
+# ATmega32A bootloadHID
+# ATmega328P USBasp
+BOOTLOADER = atmel-dfu
+
+# Build Options
+# change yes to no to disable
+#
+BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = no # 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
+MIDI_ENABLE = no # MIDI support
+BLUETOOTH_ENABLE = no # Enable Bluetooth
+AUDIO_ENABLE = no # Audio output
+FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
\ No newline at end of file