From 83c12a516b3d0c1b603bce28a55bdeba476311df Mon Sep 17 00:00:00 2001 From: NightlyBoards <65656486+NightlyBoards@users.noreply.github.com> Date: Fri, 31 Jul 2020 00:44:29 +0800 Subject: [PATCH] [keyboard] Add [n]2 support (#9862) * Create Alter folder * Revert "Create Alter folder" This reverts commit 361103b821dbb22957b66cdedb0d11f996def71c. * Add n2 keyboard * Apply suggestions from code review Edited config.h, keymap.c, readme.md, and rules.mk Co-authored-by: Ryan * Update readme.md Co-authored-by: Ryan --- keyboards/nightly_boards/n2/config.h | 93 +++++++++++++++++++ keyboards/nightly_boards/n2/info.json | 12 +++ .../n2/keymaps/default/keymap.c | 23 +++++ keyboards/nightly_boards/n2/n2.c | 18 ++++ keyboards/nightly_boards/n2/n2.h | 27 ++++++ keyboards/nightly_boards/n2/readme.md | 18 ++++ keyboards/nightly_boards/n2/rules.mk | 22 +++++ 7 files changed, 213 insertions(+) create mode 100644 keyboards/nightly_boards/n2/config.h create mode 100644 keyboards/nightly_boards/n2/info.json create mode 100644 keyboards/nightly_boards/n2/keymaps/default/keymap.c create mode 100644 keyboards/nightly_boards/n2/n2.c create mode 100644 keyboards/nightly_boards/n2/n2.h create mode 100644 keyboards/nightly_boards/n2/readme.md create mode 100644 keyboards/nightly_boards/n2/rules.mk diff --git a/keyboards/nightly_boards/n2/config.h b/keyboards/nightly_boards/n2/config.h new file mode 100644 index 0000000000..5ffa15f084 --- /dev/null +++ b/keyboards/nightly_boards/n2/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 0x0717 +#define PRODUCT_ID 0x0003 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Neil Brian Ramirez +#define PRODUCT [n]2 + +/* key matrix size */ +#define MATRIX_ROWS 2 +#define MATRIX_COLS 2 + +/* + * 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 { F1, C7 } +#define MATRIX_COL_PINS { F0, C6 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +// #define BACKLIGHT_PIN F1 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + +#define RGB_DI_PIN D4 +#ifdef RGB_DI_PIN +#define RGBLED_NUM 2 +#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/n2/info.json b/keyboards/nightly_boards/n2/info.json new file mode 100644 index 0000000000..fe2faa8c7e --- /dev/null +++ b/keyboards/nightly_boards/n2/info.json @@ -0,0 +1,12 @@ +{ + "keyboard_name": "[n]2", + "url": "", + "maintainer": "Neil Brian Ramirez", + "width": 1, + "height": 2, + "layouts": { + "LAYOUT": { + "layout": [{"x":0, "y":0}, {"x":0, "y":1}] + } + } +} diff --git a/keyboards/nightly_boards/n2/keymaps/default/keymap.c b/keyboards/nightly_boards/n2/keymaps/default/keymap.c new file mode 100644 index 0000000000..ec60b19a69 --- /dev/null +++ b/keyboards/nightly_boards/n2/keymaps/default/keymap.c @@ -0,0 +1,23 @@ +/* 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_L, + KC_O + ) +}; diff --git a/keyboards/nightly_boards/n2/n2.c b/keyboards/nightly_boards/n2/n2.c new file mode 100644 index 0000000000..d5daa06a64 --- /dev/null +++ b/keyboards/nightly_boards/n2/n2.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 "n2.h" + diff --git a/keyboards/nightly_boards/n2/n2.h b/keyboards/nightly_boards/n2/n2.h new file mode 100644 index 0000000000..10242e41d7 --- /dev/null +++ b/keyboards/nightly_boards/n2/n2.h @@ -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 . + */ + +#pragma once + +#include "quantum.h" + +#define LAYOUT( \ + K00, \ + K11 \ +) { \ + { K00, KC_NO }, \ + { KC_NO, K11 }, \ +} diff --git a/keyboards/nightly_boards/n2/readme.md b/keyboards/nightly_boards/n2/readme.md new file mode 100644 index 0000000000..fc1ae5a93a --- /dev/null +++ b/keyboards/nightly_boards/n2/readme.md @@ -0,0 +1,18 @@ +# [n]2 + +![n2](https://i.imgur.com/iHOxmHil.png) + +A 2 key pcb + +* 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/n2:default + +Flashing example for this keyboard: + + make nightly_boards/n2: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/n2/rules.mk b/keyboards/nightly_boards/n2/rules.mk new file mode 100644 index 0000000000..62427c9174 --- /dev/null +++ b/keyboards/nightly_boards/n2/rules.mk @@ -0,0 +1,22 @@ +# 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 = 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 +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output