diff --git a/keyboards/nightly_boards/adellein/adellein.c b/keyboards/nightly_boards/adellein/adellein.c new file mode 100644 index 00000000000..eb977166270 --- /dev/null +++ b/keyboards/nightly_boards/adellein/adellein.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 "adellein.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/adellein/adellein.h b/keyboards/nightly_boards/adellein/adellein.h new file mode 100644 index 00000000000..c78b76fbada --- /dev/null +++ b/keyboards/nightly_boards/adellein/adellein.h @@ -0,0 +1,55 @@ +/* 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_40ergo_split_ent( \ + 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, K32, K34, K35, K37, K39, 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, KC_NO, K32, KC_NO, K34, K35, KC_NO, K37, KC_NO, K39, KC_NO, KC_NO, K3C }, \ +} + +#define LAYOUT_40ergo_split_ent_encoder( \ + 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, K32, K34, K35, K37, K39, K3C, \ + E00A, E00B \ +) { \ + { 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, E00A, K32, E00B, K34, K35, KC_NO, K37, KC_NO, K39, KC_NO, KC_NO, K3C }, \ +} + diff --git a/keyboards/nightly_boards/adellein/config.h b/keyboards/nightly_boards/adellein/config.h new file mode 100644 index 00000000000..cd24f1a1c87 --- /dev/null +++ b/keyboards/nightly_boards/adellein/config.h @@ -0,0 +1,78 @@ +/* +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 0x0010 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Neil Brian Ramirez +#define PRODUCT Adellein + +/* key matrix size */ +#define MATRIX_ROWS 4 +#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 { B1, B0, B5, B6 } +#define MATRIX_COL_PINS { F7, F6, F5, F4, F1, F0, B7, B3, B2, D0, D1, D2, D3 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +#define RGB_DI_PIN D5 +#ifdef RGB_DI_PIN +#define RGBLED_NUM 14 +#define RGBLIGHT_ANIMATIONS + +#endif + +/* Encoders */ + +#define ENCODERS 1 + +#define ENCODERS_PAD_A { C7 } +#define ENCODERS_PAD_B { C6 } + +#define ENCODERS_CW_KEY { { 3, 3 } } +#define ENCODERS_CCW_KEY { { 1, 3 } } + +/* 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/adellein/encoder_action.c b/keyboards/nightly_boards/adellein/encoder_action.c new file mode 100644 index 00000000000..042a3871c97 --- /dev/null +++ b/keyboards/nightly_boards/adellein/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/adellein/encoder_action.h b/keyboards/nightly_boards/adellein/encoder_action.h new file mode 100644 index 00000000000..098210d40c4 --- /dev/null +++ b/keyboards/nightly_boards/adellein/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/adellein/info.json b/keyboards/nightly_boards/adellein/info.json new file mode 100644 index 00000000000..64a0a0f55f6 --- /dev/null +++ b/keyboards/nightly_boards/adellein/info.json @@ -0,0 +1,118 @@ +{ + "keyboard_name": "Adellein", + "url": "", + "maintainer": "Neil Brian Ramirez", + "width": 16.25, + "height": 5, + "layouts": { + "LAYOUT_40ergo_split_ent": { + "layout": [ + {"x":0.5, "y":0}, + {"x":1.5, "y":0}, + {"x":2.5, "y":0}, + {"x":3.5, "y":0}, + {"x":4.5, "y":0}, + {"x":5.5, "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, "w":1.5}, + + {"x":0.25, "y":1, "w":1.25}, + {"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":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}, + {"x":14.75, "y":1, "w":1.25}, + + {"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":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, "w":1.75}, + + {"x":0.25, "y":3, "w":1.25}, + {"x":2.75, "y":3, "w":1.25}, + {"x":4, "y":3, "w":2.25}, + {"x":6.25, "y":3}, + {"x":8, "y":3, "w":2.75}, + {"x":10.75, "y":3, "w":1.25}, + {"x":14.75, "y":3, "w":1.25} + ] + }, + "LAYOUT_40ergo_split_ent_encoder": { + "layout": [ + {"x":0.5, "y":0}, + {"x":1.5, "y":0}, + {"x":2.5, "y":0}, + {"x":3.5, "y":0}, + {"x":4.5, "y":0}, + {"x":5.5, "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, "w":1.5}, + + {"x":0.25, "y":1, "w":1.25}, + {"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":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}, + {"x":14.75, "y":1, "w":1.25}, + + {"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":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, "w":1.75}, + + {"x":0.25, "y":3, "w":1.25}, + {"x":2.75, "y":3, "w":1.25}, + {"x":4, "y":3, "w":2.25}, + {"x":6.25, "y":3}, + {"x":8, "y":3, "w":2.75}, + {"x":10.75, "y":3, "w":1.25}, + {"x":14.75, "y":3, "w":1.25}, + + {"x":5.75, "y":4}, + {"x":6.75, "y":4} + ] + } + } +} \ No newline at end of file diff --git a/keyboards/nightly_boards/adellein/keymaps/default/keymap.c b/keyboards/nightly_boards/adellein/keymaps/default/keymap.c new file mode 100644 index 00000000000..ccdf46ee4a5 --- /dev/null +++ b/keyboards/nightly_boards/adellein/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_40ergo_split_ent( + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_BSPC, + KC_TAB, 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, + KC_LCTL, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RCTL + ), +}; diff --git a/keyboards/nightly_boards/adellein/keymaps/via/keymap.c b/keyboards/nightly_boards/adellein/keymaps/via/keymap.c new file mode 100644 index 00000000000..c4c0adffe35 --- /dev/null +++ b/keyboards/nightly_boards/adellein/keymaps/via/keymap.c @@ -0,0 +1,49 @@ +/* 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_40ergo_split_ent_encoder( + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_BSPC, + KC_TAB, 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, + KC_LCTL, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RCTL, + KC_VOLD, KC_VOLU + ), + [1] = LAYOUT_40ergo_split_ent_encoder( + 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_40ergo_split_ent_encoder( + 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_40ergo_split_ent_encoder( + 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/adellein/keymaps/via/rules.mk b/keyboards/nightly_boards/adellein/keymaps/via/rules.mk new file mode 100644 index 00000000000..43061db1dd4 --- /dev/null +++ b/keyboards/nightly_boards/adellein/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/adellein/readme.md b/keyboards/nightly_boards/adellein/readme.md new file mode 100644 index 00000000000..1253b2692e6 --- /dev/null +++ b/keyboards/nightly_boards/adellein/readme.md @@ -0,0 +1,20 @@ +# Nightly Boards Adellein + +![Adellein](https://i.imgur.com/WIZvvcDl.png) + +A 40% alice-like keyboard with rotary encoder support + +* 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/adellein:default + +Flashing example for this keyboard: + + make nightly_boards/adellein: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 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/adellein/rules.mk b/keyboards/nightly_boards/adellein/rules.mk new file mode 100644 index 00000000000..f78597b9168 --- /dev/null +++ b/keyboards/nightly_boards/adellein/rules.mk @@ -0,0 +1,26 @@ +# 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 +ENCODER_ENABLE = yes # Enable Rotary Encoders +LTO_ENABLE = yes + +# Added encoder Action +SRC += encoder_action.c \ No newline at end of file