diff options
Diffstat (limited to 'keyboards/gl516/n51gl')
-rw-r--r-- | keyboards/gl516/n51gl/config.h | 67 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/info.json | 63 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/keymaps/default/keymap.c | 60 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/keymaps/salicylic/config.h | 22 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/keymaps/salicylic/keymap.c | 117 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/keymaps/via/config.h | 22 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/keymaps/via/keymap.c | 102 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/keymaps/via/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/matrix.c | 158 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/n51gl.c | 18 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/n51gl.h | 54 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/readme.md | 27 | ||||
-rw-r--r-- | keyboards/gl516/n51gl/rules.mk | 22 |
13 files changed, 733 insertions, 0 deletions
diff --git a/keyboards/gl516/n51gl/config.h b/keyboards/gl516/n51gl/config.h new file mode 100644 index 0000000000..ea50fcfa1a --- /dev/null +++ b/keyboards/gl516/n51gl/config.h @@ -0,0 +1,67 @@ +/* +Copyright 2021 Salicylic_Acid + +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 <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x04D8 +#define PRODUCT_ID 0xE8CF +#define DEVICE_VER 0x0001 +#define MANUFACTURER Salicylic_Acid +#define PRODUCT n51gl + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 7 + +// wiring of each half +#define MATRIX_ROW_PINS { D1, D0, D4, C6 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 } +#define UNUSED_PINS + +#define ENCODERS_PAD_A { D7 } +#define ENCODERS_PAD_B { E6 } +#define ENCODER_RESOLUTION 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* 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 + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D3 + +#ifndef RGBLED_NUM + #define RGBLED_NUM 15 +#endif + +#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 +#define RGBLIGHT_EFFECT_TWINKLE + diff --git a/keyboards/gl516/n51gl/info.json b/keyboards/gl516/n51gl/info.json new file mode 100644 index 0000000000..eb8d639825 --- /dev/null +++ b/keyboards/gl516/n51gl/info.json @@ -0,0 +1,63 @@ +{ + "keyboard_name": "n51gl", + "url": "https://salicylic-acid3.hatenablog.com/", + "maintainer": "Salicylic_acid3", + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"0,0", "x":0, "y":0}, + {"label":"0,1", "x":1.25, "y":0}, + {"label":"4,0", "x":8.25, "y":0}, + {"label":"4,1", "x":9.25, "y":0}, + {"label":"4,2", "x":10.25, "y":0}, + {"label":"4,3", "x":11.25, "y":0}, + {"label":"4,4", "x":12.25, "y":0}, + {"label":"4,5", "x":13.25, "y":0}, + {"label":"4,6", "x":14.25, "y":0}, + {"label":"1,1", "x":0.25, "y":1, "w":1.75}, + {"label":"1,2", "x":2, "y":1}, + {"label":"5,0", "x":8.5, "y":1}, + {"label":"5,1", "x":9.5, "y":1}, + {"label":"5,2", "x":10.5, "y":1}, + {"label":"5,3", "x":11.5, "y":1}, + {"label":"5,4", "x":12.5, "y":1}, + {"label":"5,5", "x":13.5, "y":1}, + {"label":"5,6", "x":14.5, "y":1}, + {"label":"2,1", "x":0, "y":2, "w":1.75}, + {"label":"2,2", "x":1.75, "y":2}, + {"label":"2,0", "x":7.25, "y":2}, + {"label":"6,0", "x":8.75, "y":2}, + {"label":"6,1", "x":9.75, "y":2}, + {"label":"6,2", "x":10.75, "y":2}, + {"label":"6,3", "x":11.75, "y":2}, + {"label":"6,4", "x":12.75, "y":2}, + {"label":"6,5", "x":13.75, "y":2}, + {"label":"6,6", "x":14.75, "y":2}, + {"label":"3,1", "x":0.25, "y":3, "w":1.25}, + {"label":"3,2", "x":1.5, "y":3, "w":1.25}, + {"label":"7,0", "x":8.5, "y":3}, + {"label":"7,1", "x":9.5, "y":3, "w":1.25}, + {"label":"7,2", "x":10.75, "y":3}, + {"label":"7,4", "x":12.75, "y":3}, + {"label":"7,5", "x":13.75, "y":3}, + {"label":"7,6", "x":14.75, "y":3}, + {"label":"0,2", "x":-0.75, "y":4}, + {"label":"0,3", "x":0.25, "y":4}, + {"label":"0,4", "x":1.25, "y":4}, + {"label":"0,5", "x":2.25, "y":4}, + {"label":"0,6", "x":3.25, "y":4}, + {"label":"1,3", "x":0, "y":5}, + {"label":"1,4", "x":1, "y":5}, + {"label":"1,5", "x":2, "y":5}, + {"label":"1,6", "x":3, "y":5}, + {"label":"2,3", "x":-0.25, "y":6}, + {"label":"2,4", "x":0.75, "y":6}, + {"label":"2,5", "x":1.75, "y":6}, + {"label":"2,6", "x":2.75, "y":6}, + {"label":"3,4", "x":0.75, "y":7}, + {"label":"3,5", "x":1.75, "y":7, "w":1.25}, + {"label":"3,6", "x":3, "y":7} + ] + } + } +} diff --git a/keyboards/gl516/n51gl/keymaps/default/keymap.c b/keyboards/gl516/n51gl/keymaps/default/keymap.c new file mode 100644 index 0000000000..469626d851 --- /dev/null +++ b/keyboards/gl516/n51gl/keymaps/default/keymap.c @@ -0,0 +1,60 @@ +/* +Copyright 2021 Salicylic_Acid + +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 <http://www.gnu.org/licenses/>. +*/ + +#include QMK_KEYBOARD_H +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +enum layer_number { + _QWERTY = 0, + _FN, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + //,--------------------------------------------------------------| |--------------------------------------------------------------. + KC_ESC, 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_BSPC, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + LT(_FN,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_MUTE, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, KC_RSFT, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_LALT, KC_LEFT, KC_DOWN, KC_RGHT + //|--------------------------------------------------------------| |--------------------------------------------------------------' + ), + [_FN] = 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_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + //|--------------------------------------------------------------| |--------------------------------------------------------------' + ) +}; + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { + tap_code16(KC_VOLD); + } else { + tap_code16(KC_VOLU); + } + return true; +} diff --git a/keyboards/gl516/n51gl/keymaps/salicylic/config.h b/keyboards/gl516/n51gl/keymaps/salicylic/config.h new file mode 100644 index 0000000000..fd96baa819 --- /dev/null +++ b/keyboards/gl516/n51gl/keymaps/salicylic/config.h @@ -0,0 +1,22 @@ +/* Copyright 2021 Salicylic_acid3 + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#pragma once + +/* Select hand configuration */ + +#define TAPPING_FORCE_HOLD +#define TAPPING_TERM 180 diff --git a/keyboards/gl516/n51gl/keymaps/salicylic/keymap.c b/keyboards/gl516/n51gl/keymaps/salicylic/keymap.c new file mode 100644 index 0000000000..819ac94e37 --- /dev/null +++ b/keyboards/gl516/n51gl/keymaps/salicylic/keymap.c @@ -0,0 +1,117 @@ +/* +Copyright 2021 Salicylic_Acid + +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 <http://www.gnu.org/licenses/>. +*/ + +#include QMK_KEYBOARD_H +#include "keymap_jp.h" + + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +enum layer_number { + _QWERTY = 0, + _LOWER, + _RAISE, + _ADJUST, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT_rotary_layer( + //,--------------------------------------------------------------| |--------------------------------------------------------------. + KC_ESC, 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_BSPC, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_VOLU, KC_H, KC_J, KC_K, KC_L, JP_MINS, JP_BSLS, KC_ENT, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MUTE, KC_N, KC_M, KC_COMM, KC_DOT, JP_SLSH, KC_UP, KC_RSFT, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + JP_ZKHK, KC_LALT,LGUI_T(JP_MHEN),LT(_LOWER,KC_ENT),KC_BSPC, KC_VOLD, KC_DEL,LT(_RAISE,KC_SPC),ALT_T(JP_HENK),KC_LEFT, KC_DOWN, KC_RGHT + //|--------------------------------------------------------------| |--------------------------------------------------------------' + ), + [_LOWER] = LAYOUT_rotary_layer( + //,--------------------------------------------------------------| |--------------------------------------------------------------. + _______, _______, JP_EXLM, JP_QUES, JP_LBRC, JP_RBRC, JP_TILD, KC_6, KC_7, KC_8, KC_9, JP_ASTR, JP_SLSH, KC_BSPC, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + JP_QUOT, JP_HASH, JP_DQT, JP_LPRN, JP_RPRN, JP_AT, KC_WH_U, XXXXXXX, KC_4, KC_5, KC_6, JP_MINS, JP_EQL, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + JP_CIRC, JP_PERC, JP_AMPR, JP_SCLN, JP_COLN, JP_PIPE, KC_BTN3, KC_0, KC_1, KC_2, KC_3, JP_PLUS, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + _______, _______, JP_MHEN, MO(_LOWER), _______, KC_WH_D, _______, MO(_RAISE), JP_DOT, _______, _______, _______ + //|--------------------------------------------------------------| |--------------------------------------------------------------' + ), + + [_RAISE] = LAYOUT_rotary_layer( + //,--------------------------------------------------------------| |--------------------------------------------------------------. + _______, _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, XXXXXXX, KC_UP, XXXXXXX, KC_PGUP,LALT(KC_PSCR),KC_PSCR, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + LCTL_T(KC_F11), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_WH_L, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LSFT, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PGDN, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, _______, KC_WH_R, _______, _______, JP_HENK, _______, _______, _______ + //|--------------------------------------------------------------| |--------------------------------------------------------------' + ), + + [_ADJUST] = LAYOUT_rotary_layer( + //,--------------------------------------------------------------| |--------------------------------------------------------------. + RESET, KC_TAB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,LALT(KC_PSCR),KC_PSCR, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_MOD, RGB_TOG, RGB_MOD, RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + SFT_T(KC_F12), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_TOG, RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, XXXXXXX, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, _______,RGB_RMOD, _______, _______, _______, _______, _______, _______ + //|--------------------------------------------------------------| |--------------------------------------------------------------' + ) +}; + +//A description for expressing the layer position in LED mode. +layer_state_t layer_state_set_user(layer_state_t state) { + state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); +#ifdef RGBLIGHT_ENABLE + switch (get_highest_layer(state)) { + case _LOWER: + rgblight_sethsv_at(HSV_BLUE, 0); + break; + case _RAISE: + rgblight_sethsv_at(HSV_RED, 0); + break; + case _ADJUST: + rgblight_sethsv_at(HSV_PURPLE, 0); + break; + default: // for any other layers, or the default layer + rgblight_sethsv_at( 0, 0, 0, 0); + break; + } + rgblight_set_effect_range( 1, 14); +#endif +return state; +} + +bool encoder_update_user(uint8_t index, bool clockwise) { + keypos_t key; + if (clockwise) { + key.row = 3; + key.col = 0; + } else { + key.row = 1; + key.col = 0; + } + action_exec((keyevent_t){.key = key, .pressed = true, .time = (timer_read() | 1)}); + action_exec((keyevent_t){.key = key, .pressed = false, .time = (timer_read() | 1)}); + return true; +} diff --git a/keyboards/gl516/n51gl/keymaps/via/config.h b/keyboards/gl516/n51gl/keymaps/via/config.h new file mode 100644 index 0000000000..fd96baa819 --- /dev/null +++ b/keyboards/gl516/n51gl/keymaps/via/config.h @@ -0,0 +1,22 @@ +/* Copyright 2021 Salicylic_acid3 + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#pragma once + +/* Select hand configuration */ + +#define TAPPING_FORCE_HOLD +#define TAPPING_TERM 180 diff --git a/keyboards/gl516/n51gl/keymaps/via/keymap.c b/keyboards/gl516/n51gl/keymaps/via/keymap.c new file mode 100644 index 0000000000..3ad85edcba --- /dev/null +++ b/keyboards/gl516/n51gl/keymaps/via/keymap.c @@ -0,0 +1,102 @@ +/* +Copyright 2021 Salicylic_Acid + +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 <http://www.gnu.org/licenses/>. +*/ + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_rotary_layer( + //,--------------------------------------------------------------| |--------------------------------------------------------------. + KC_ESC, 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_BSPC, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + LT(1,KC_CAPS), KC_A, KC_S, KC_D, KC_F, KC_G, KC_VOLU, 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_MUTE, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, KC_RSFT, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_VOLD, KC_SPC, KC_SPC, KC_LALT, KC_LEFT, KC_DOWN, KC_RGHT + //|--------------------------------------------------------------| |--------------------------------------------------------------' + ), + [1] = LAYOUT_rotary_layer( + //,--------------------------------------------------------------| |--------------------------------------------------------------. + _______, 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_1, KC_2, KC_3, KC_4, KC_5, _______, KC_6, KC_7, KC_8, KC_9, KC_0, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + //|--------------------------------------------------------------| |--------------------------------------------------------------' + ), + [2] = LAYOUT_rotary_layer( + //,--------------------------------------------------------------| |--------------------------------------------------------------. + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + //|--------------------------------------------------------------| |--------------------------------------------------------------' + ), + [3] = LAYOUT_rotary_layer( + //,--------------------------------------------------------------| |--------------------------------------------------------------. + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + //|--------------------------------------------------------------| |--------------------------------------------------------------' + ) +}; + +//A description for expressing the layer position in LED mode. +layer_state_t layer_state_set_user(layer_state_t state) { + state = update_tri_layer_state(state, 2, 1, 3); +#ifdef RGBLIGHT_ENABLE + switch (get_highest_layer(state)) { + case 1: + rgblight_sethsv_at(HSV_BLUE, 0); + break; + case 2: + rgblight_sethsv_at(HSV_RED, 0); + break; + case 3: + rgblight_sethsv_at(HSV_PURPLE, 0); + break; + default: // for any other layers, or the default layer + rgblight_sethsv_at( 0, 0, 0, 0); + break; + } + rgblight_set_effect_range( 1, 14); +#endif +return state; +} + +bool encoder_update_user(uint8_t index, bool clockwise) { + keypos_t key; + if (clockwise) { + key.row = 3; + key.col = 0; + } else { + key.row = 1; + key.col = 0; + } + action_exec((keyevent_t){.key = key, .pressed = true, .time = (timer_read() | 1)}); + action_exec((keyevent_t){.key = key, .pressed = false, .time = (timer_read() | 1)}); + return true; +} diff --git a/keyboards/gl516/n51gl/keymaps/via/rules.mk b/keyboards/gl516/n51gl/keymaps/via/rules.mk new file mode 100644 index 0000000000..036bd6d1c3 --- /dev/null +++ b/keyboards/gl516/n51gl/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes
\ No newline at end of file diff --git a/keyboards/gl516/n51gl/matrix.c b/keyboards/gl516/n51gl/matrix.c new file mode 100644 index 0000000000..1a97fdfd61 --- /dev/null +++ b/keyboards/gl516/n51gl/matrix.c @@ -0,0 +1,158 @@ +/* +Copyright 2012-2018 Jun Wako, Jack Humbert, Yiancar + +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 <http://www.gnu.org/licenses/>. +*/ +#include "matrix.h" +#include "quantum.h" + +static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +static void select_row(uint8_t row) +{ + setPinOutput(row_pins[row]); + writePinLow(row_pins[row]); +} + +static void unselect_row(uint8_t row) +{ + setPinInputHigh(row_pins[row]); +} + +static void unselect_rows(void) +{ + for(uint8_t x = 0; x < MATRIX_ROWS; x++) { + setPinInputHigh(row_pins[x]); + } +} + +static void select_col(uint8_t col) +{ + setPinOutput(col_pins[col]); + writePinLow(col_pins[col]); +} + +static void unselect_col(uint8_t col) +{ + setPinInputHigh(col_pins[col]); +} + +static void unselect_cols(void) +{ + for(uint8_t x = 0; x < MATRIX_COLS; x++) { + setPinInputHigh(col_pins[x]); + } +} + +static void init_pins(void) { + unselect_rows(); + unselect_cols(); + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + setPinInputHigh(col_pins[x]); + } + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + setPinInputHigh(row_pins[x]); + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) +{ + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + // Select row and wait for row selecton to stabilize + select_row(current_row); + matrix_io_delay(); + + // For each col... + for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + + // Select the col pin to read (active low) + uint8_t pin_state = readPin(col_pins[col_index]); + + // Populate the matrix row with the state of the col pin + current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); + } + + // Unselect row + unselect_row(current_row); + + return (last_row_value != current_matrix[current_row]); +} + +static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) +{ + bool matrix_changed = false; + + // Select col and wait for col selecton to stabilize + select_col(current_col); + matrix_io_delay(); + + // For each row... + for(uint8_t row_index = 0; row_index < MATRIX_ROWS/2; row_index++) + { + uint8_t tmp = row_index + MATRIX_ROWS/2; + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[tmp]; + + // Check row pin state + if (readPin(row_pins[row_index]) == 0) + { + // Pin LO, set col bit + current_matrix[tmp] |= (MATRIX_ROW_SHIFTER << current_col); + } + else + { + // Pin HI, clear col bit + current_matrix[tmp] &= ~(MATRIX_ROW_SHIFTER << current_col); + } + + // Determine if the matrix changed state + if ((last_row_value != current_matrix[tmp]) && !(matrix_changed)) + { + matrix_changed = true; + } + } + + // Unselect col + unselect_col(current_col); + + return matrix_changed; +} + +void matrix_init_custom(void) { + // initialize key pins + init_pins(); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) +{ + bool changed = false; + + // Set row, read cols + for (uint8_t current_row = 0; current_row < MATRIX_ROWS / 2; current_row++) { + changed |= read_cols_on_row(current_matrix, current_row); + } + //else + // Set col, read rows + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { + changed |= read_rows_on_col(current_matrix, current_col); + } + + return changed; +} diff --git a/keyboards/gl516/n51gl/n51gl.c b/keyboards/gl516/n51gl/n51gl.c new file mode 100644 index 0000000000..f13d0cd78e --- /dev/null +++ b/keyboards/gl516/n51gl/n51gl.c @@ -0,0 +1,18 @@ +/* +Copyright 2021 Salicylic_Acid + +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 <http://www.gnu.org/licenses/>. +*/ + +#include "n51gl.h" diff --git a/keyboards/gl516/n51gl/n51gl.h b/keyboards/gl516/n51gl/n51gl.h new file mode 100644 index 0000000000..6429b78fd0 --- /dev/null +++ b/keyboards/gl516/n51gl/n51gl.h @@ -0,0 +1,54 @@ +/* +Copyright 2021 Salicylic_Acid + +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 <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#include "quantum.h" + +#define LAYOUT( \ + L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \ + L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \ + L21, L22, L23, L24, L25, L26, L20, R20, R21, R22, R23, R24, R25, R26, \ + L31, L32, L34, L35, L36, R30, R31, R32, R34, R35, R36 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05, L06 }, \ + { KC_NO, L11, L12, L13, L14, L15, L16 }, \ + { L20, L21, L22, L23, L24, L25, L26 }, \ + { KC_NO, L31, L32, KC_NO, L34, L35, L36 }, \ + { R00, R01, R02, R03, R04, R05, R06 }, \ + { R10, R11, R12, R13, R14, R15, R16 }, \ + { R20, R21, R22, R23, R24, R25, R26 }, \ + { R30, R31, R32, KC_NO, R34, R35, R36 } \ + } + +#define LAYOUT_rotary_layer( \ + L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \ + L11, L12, L13, L14, L15, L16, L10, R10, R11, R12, R13, R14, R15, R16, \ + L21, L22, L23, L24, L25, L26, L20, R20, R21, R22, R23, R24, R25, R26, \ + L31, L32, L34, L35, L36, L30, R30, R31, R32, R34, R35, R36 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05, L06 }, \ + { L10, L11, L12, L13, L14, L15, L16 }, \ + { L20, L21, L22, L23, L24, L25, L26 }, \ + { L30, L31, L32, KC_NO, L34, L35, L36 }, \ + { R00, R01, R02, R03, R04, R05, R06 }, \ + { R10, R11, R12, R13, R14, R15, R16 }, \ + { R20, R21, R22, R23, R24, R25, R26 }, \ + { R30, R31, R32, KC_NO, R34, R35, R36 } \ + } diff --git a/keyboards/gl516/n51gl/readme.md b/keyboards/gl516/n51gl/readme.md new file mode 100644 index 0000000000..916b8ff671 --- /dev/null +++ b/keyboards/gl516/n51gl/readme.md @@ -0,0 +1,27 @@ +# n51gl + +![n51gl](https://cdn-ak.f.st-hatena.com/images/fotolife/S/Salicylic_acid3/20210911/20210911015705.png) + +This is 51 keys Custom keyboard. +Use the GL516 case. + +* Keyboard Maintainer: [Salicylic_acid3](https://github.com/Salicylic-acid3) +* Hardware Supported: nknl7 PCB, Pro Micro +* Hardware Availability: [PCB & Case Data](https://github.com/Salicylic-acid3/GL516_Exemple) + +Make example for this keyboard (after setting up your build environment): + + make gl516/n51gl:default + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead +* **Keycode in layout**: Press the key mapped to `RESET` if it is available + +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). + +[Build guide](https://salicylic-acid3.hatenablog.com/entry/a52gl-j73gl-build-guide) + diff --git a/keyboards/gl516/n51gl/rules.mk b/keyboards/gl516/n51gl/rules.mk new file mode 100644 index 0000000000..6279bfb0e0 --- /dev/null +++ b/keyboards/gl516/n51gl/rules.mk @@ -0,0 +1,22 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +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 +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes +CUSTOM_MATRIX = lite + +SRC += matrix.c
\ No newline at end of file |