diff options
| author | yulei <yuleiz@gmail.com> | 2021-08-18 00:06:26 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-17 09:06:26 -0700 |
| commit | a8f893ed2ca4b30945714e58245c4dd1c7c8481f (patch) | |
| tree | 08534a3c5ae39925d327ccf76cbcf3056551b2c7 | |
| parent | 837571ef7f0b7f662aa37391a371a83769f7141e (diff) | |
| download | qmk_firmware-a8f893ed2ca4b30945714e58245c4dd1c7c8481f.tar.gz qmk_firmware-a8f893ed2ca4b30945714e58245c4dd1c7c8481f.zip | |
[Keyboard] add n6 keyboard (#13768)
Co-authored-by: Ryan <fauxpark@gmail.com>
| -rw-r--r-- | keyboards/neson_design/n6/config.h | 67 | ||||
| -rw-r--r-- | keyboards/neson_design/n6/info.json | 84 | ||||
| -rw-r--r-- | keyboards/neson_design/n6/keymaps/default/keymap.c | 34 | ||||
| -rw-r--r-- | keyboards/neson_design/n6/keymaps/via/keymap.c | 48 | ||||
| -rw-r--r-- | keyboards/neson_design/n6/keymaps/via/rules.mk | 2 | ||||
| -rw-r--r-- | keyboards/neson_design/n6/n6.c | 319 | ||||
| -rw-r--r-- | keyboards/neson_design/n6/n6.h | 54 | ||||
| -rw-r--r-- | keyboards/neson_design/n6/readme.md | 21 | ||||
| -rw-r--r-- | keyboards/neson_design/n6/rules.mk | 23 |
9 files changed, 652 insertions, 0 deletions
diff --git a/keyboards/neson_design/n6/config.h b/keyboards/neson_design/n6/config.h new file mode 100644 index 000000000..d3b49becb --- /dev/null +++ b/keyboards/neson_design/n6/config.h | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | /** | ||
| 2 | * config.h | ||
| 3 | * | ||
| 4 | Copyright 2021 astro | ||
| 5 | |||
| 6 | This program is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation, either version 2 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | */ | ||
| 19 | #pragma once | ||
| 20 | |||
| 21 | #include "config_common.h" | ||
| 22 | |||
| 23 | /* USB Device descriptor parameter */ | ||
| 24 | #define VENDOR_ID 0x4E65 //'Ne' | ||
| 25 | #define PRODUCT_ID 0x4E36 //'N6' | ||
| 26 | #define DEVICE_VER 0x0001 | ||
| 27 | #define MANUFACTURER Neson Design | ||
| 28 | #define PRODUCT N6 Keyboard | ||
| 29 | |||
| 30 | /* key matrix size */ | ||
| 31 | #define MATRIX_ROWS 5 | ||
| 32 | #define MATRIX_COLS 15 | ||
| 33 | #define MATRIX_ROW_PINS { F0, B1, F6, F4, F1} | ||
| 34 | #define MATRIX_COL_PINS { F7, B0, E6, C7, C6, B6, B5, B4, D7, D6, D4, D5, B2, D3, D2 } | ||
| 35 | #define UNUSED_PINS | ||
| 36 | #define DIODE_DIRECTION COL2ROW | ||
| 37 | |||
| 38 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
| 39 | #define DEBOUNCE 5 | ||
| 40 | |||
| 41 | /* | ||
| 42 | * Feature disable options | ||
| 43 | * These options are also useful to firmware size reduction. | ||
| 44 | */ | ||
| 45 | |||
| 46 | /* disable debug print */ | ||
| 47 | //#define NO_DEBUG | ||
| 48 | |||
| 49 | /* disable print */ | ||
| 50 | //#define NO_PRINT | ||
| 51 | |||
| 52 | |||
| 53 | //rgb light setting | ||
| 54 | //#define RGBLIGHT_LIMIT_VAL 128 | ||
| 55 | #define RGBLED_NUM 33 | ||
| 56 | #define RGB_DI_PIN B3 | ||
| 57 | #define RGBLIGHT_ANIMATIONS | ||
| 58 | #define RGBLIGHT_HUE_STEP 8 | ||
| 59 | #define RGBLIGHT_SAT_STEP 8 | ||
| 60 | #define RGBLIGHT_VAL_STEP 8 | ||
| 61 | |||
| 62 | #define DRIVER_1_LED_TOTAL 32 | ||
| 63 | #define DRIVER_ADDR_1 0b1110100 | ||
| 64 | #define DRIVER_COUNT 1 | ||
| 65 | #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL) | ||
| 66 | |||
| 67 | #define CAPS_PIN F5 | ||
diff --git a/keyboards/neson_design/n6/info.json b/keyboards/neson_design/n6/info.json new file mode 100644 index 000000000..fc61ac776 --- /dev/null +++ b/keyboards/neson_design/n6/info.json | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | { | ||
| 2 | "keyboard_name": "n6", | ||
| 3 | "url": "", | ||
| 4 | "maintainer": "qmk", | ||
| 5 | "width": 15, | ||
| 6 | "height": 5, | ||
| 7 | "layouts": { | ||
| 8 | "LAYOUT_65_ansi_blocker": { | ||
| 9 | "layout": [ | ||
| 10 | { "x":0, "y":0 }, | ||
| 11 | { "x":1, "y":0 }, | ||
| 12 | { "x":2, "y":0 }, | ||
| 13 | { "x":3, "y":0 }, | ||
| 14 | { "x":4, "y":0 }, | ||
| 15 | { "x":5, "y":0 }, | ||
| 16 | { "x":6, "y":0 }, | ||
| 17 | { "x":7, "y":0 }, | ||
| 18 | { "x":8, "y":0 }, | ||
| 19 | { "x":9, "y":0 }, | ||
| 20 | { "x":10, "y":0 }, | ||
| 21 | { "x":11, "y":0 }, | ||
| 22 | { "x":12, "y":0 }, | ||
| 23 | { "x":13, "y":0, "w": 2 }, | ||
| 24 | { "x":15, "y":0 }, | ||
| 25 | |||
| 26 | { "x":0, "y":1, "w":1.5 }, | ||
| 27 | { "x":1.5, "y":1 }, | ||
| 28 | { "x":2.5, "y":1 }, | ||
| 29 | { "x":3.5, "y":1 }, | ||
| 30 | { "x":4.5, "y":1 }, | ||
| 31 | { "x":5.5, "y":1 }, | ||
| 32 | { "x":6.5, "y":1 }, | ||
| 33 | { "x":7.5, "y":1 }, | ||
| 34 | { "x":8.5, "y":1 }, | ||
| 35 | { "x":9.5, "y":1 }, | ||
| 36 | { "x":10.5, "y":1 }, | ||
| 37 | { "x":11.5, "y":1 }, | ||
| 38 | { "x":12.5, "y":1 }, | ||
| 39 | { "x":13.5, "y":1, "w":1.5 }, | ||
| 40 | { "x":15, "y":1 }, | ||
| 41 | |||
| 42 | { "x":0, "y":2, "w":1.75 }, | ||
| 43 | { "x":1.75, "y":2 }, | ||
| 44 | { "x":2.75, "y":2 }, | ||
| 45 | { "x":3.75, "y":2 }, | ||
| 46 | { "x":4.75, "y":2 }, | ||
| 47 | { "x":5.75, "y":2 }, | ||
| 48 | { "x":6.75, "y":2 }, | ||
| 49 | { "x":7.75, "y":2 }, | ||
| 50 | { "x":8.75, "y":2 }, | ||
| 51 | { "x":9.75, "y":2 }, | ||
| 52 | { "x":10.75, "y":2 }, | ||
| 53 | { "x":11.75, "y":2 }, | ||
| 54 | { "x":12.75, "y":2, "w":2.25 }, | ||
| 55 | { "x":15, "y":2 }, | ||
| 56 | |||
| 57 | { "x":0, "y":3, "w":2.25 }, | ||
| 58 | { "x":2.25, "y":3 }, | ||
| 59 | { "x":3.25, "y":3 }, | ||
| 60 | { "x":4.25, "y":3 }, | ||
| 61 | { "x":5.25, "y":3 }, | ||
| 62 | { "x":6.25, "y":3 }, | ||
| 63 | { "x":7.25, "y":3 }, | ||
| 64 | { "x":8.25, "y":3 }, | ||
| 65 | { "x":9.25, "y":3 }, | ||
| 66 | { "x":10.25, "y":3 }, | ||
| 67 | { "x":11.25, "y":3 }, | ||
| 68 | { "x":12.25, "y":3, "w":1.75 }, | ||
| 69 | { "x":14, "y":3 }, | ||
| 70 | { "x":15, "y":3 }, | ||
| 71 | |||
| 72 | { "x":0, "y":4, "w":1.25 }, | ||
| 73 | { "x":1.25, "y":4, "w":1.25 }, | ||
| 74 | { "x":2.5, "y":4, "w":1.25 }, | ||
| 75 | { "x":3.75, "y":4, "w":6.25 }, | ||
| 76 | { "x":10, "y":4, "w":1.25 }, | ||
| 77 | { "x":11.25, "y":4, "w":1.25 }, | ||
| 78 | { "x":13, "y":4 }, | ||
| 79 | { "x":14, "y":4 }, | ||
| 80 | { "x":15, "y":4 } | ||
| 81 | ] | ||
| 82 | } | ||
| 83 | } | ||
| 84 | } | ||
diff --git a/keyboards/neson_design/n6/keymaps/default/keymap.c b/keyboards/neson_design/n6/keymaps/default/keymap.c new file mode 100644 index 000000000..ecf17f3a6 --- /dev/null +++ b/keyboards/neson_design/n6/keymaps/default/keymap.c | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | /** | ||
| 2 | Copyright 2021 astro | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include QMK_KEYBOARD_H | ||
| 19 | |||
| 20 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 21 | [0] = LAYOUT_65_ansi_blocker_splitbs( | ||
| 22 | KC_ESC, 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_DEL, KC_BSPC, KC_PSCR, | ||
| 23 | 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_HOME, | ||
| 24 | 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_END, | ||
| 25 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, KC_UP, MO(1), | ||
| 26 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT,KC_RGUI, KC_LEFT,KC_DOWN, KC_RIGHT), | ||
| 27 | |||
| 28 | [1] = LAYOUT_65_ansi_blocker_splitbs( | ||
| 29 | _______, 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_PSCR,_______, | ||
| 30 | RESET, RGB_TOG,RGB_MOD,_______, KC_F16, KC_F17,_______,_______,_______,_______,_______,KC_PGUP,KC_PGDN,_______,_______, | ||
| 31 | _______, _______,_______,_______,_______,_______,KC_LEFT,KC_DOWN, KC_UP,KC_RIGHT,KC_HOME, KC_END, _______,_______, | ||
| 32 | _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, | ||
| 33 | _______,_______,_______, _______, _______,_______, _______,_______,_______), | ||
| 34 | }; | ||
diff --git a/keyboards/neson_design/n6/keymaps/via/keymap.c b/keyboards/neson_design/n6/keymaps/via/keymap.c new file mode 100644 index 000000000..cad04a096 --- /dev/null +++ b/keyboards/neson_design/n6/keymaps/via/keymap.c | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | /** | ||
| 2 | Copyright 2021 astro | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include QMK_KEYBOARD_H | ||
| 19 | |||
| 20 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 21 | [0] = LAYOUT_65_ansi_blocker_splitbs( | ||
| 22 | KC_ESC, 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_DEL, KC_BSPC, KC_PSCR, | ||
| 23 | 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_HOME, | ||
| 24 | 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_END, | ||
| 25 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, KC_UP, MO(1), | ||
| 26 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT,KC_RGUI, KC_LEFT,KC_DOWN, KC_RIGHT), | ||
| 27 | |||
| 28 | [1] = LAYOUT_65_ansi_blocker_splitbs( | ||
| 29 | _______, 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_PSCR,_______, | ||
| 30 | RESET, RGB_TOG,RGB_MOD,_______, KC_F16, KC_F17,_______,_______,_______,_______,_______,KC_PGUP,KC_PGDN,_______, _______, | ||
| 31 | _______, _______,_______,_______,_______,_______,KC_LEFT,KC_DOWN, KC_UP,KC_RIGHT,KC_HOME, KC_END,_______, _______, | ||
| 32 | _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______, | ||
| 33 | _______,_______,_______, _______, _______,_______, _______,_______,_______), | ||
| 34 | |||
| 35 | [2] = LAYOUT_65_ansi_blocker_splitbs( | ||
| 36 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, | ||
| 37 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, | ||
| 38 | _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, | ||
| 39 | _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, | ||
| 40 | _______,_______,_______, _______, _______,_______, TG(0),_______,_______), | ||
| 41 | |||
| 42 | [3] = LAYOUT_65_ansi_blocker_splitbs( | ||
| 43 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, | ||
| 44 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, | ||
| 45 | _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, | ||
| 46 | _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, | ||
| 47 | _______,_______,_______, _______, _______,_______, TG(0),_______,_______), | ||
| 48 | }; | ||
diff --git a/keyboards/neson_design/n6/keymaps/via/rules.mk b/keyboards/neson_design/n6/keymaps/via/rules.mk new file mode 100644 index 000000000..43061db1d --- /dev/null +++ b/keyboards/neson_design/n6/keymaps/via/rules.mk | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | VIA_ENABLE = yes | ||
| 2 | LTO_ENABLE = yes \ No newline at end of file | ||
diff --git a/keyboards/neson_design/n6/n6.c b/keyboards/neson_design/n6/n6.c new file mode 100644 index 000000000..800aa0ae9 --- /dev/null +++ b/keyboards/neson_design/n6/n6.c | |||
| @@ -0,0 +1,319 @@ | |||
| 1 | /** | ||
| 2 | * @file n6.c | ||
| 3 | * | ||
| 4 | Copyright 2021 astro | ||
| 5 | |||
| 6 | This program is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation, either version 2 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include "n6.h" | ||
| 21 | #include "i2c_master.h" | ||
| 22 | #include "issi/is31fl3731.h" | ||
| 23 | |||
| 24 | enum { | ||
| 25 | SELF_TESTING, | ||
| 26 | CAPS_ALERT, | ||
| 27 | NORMAL, | ||
| 28 | }; | ||
| 29 | |||
| 30 | enum { | ||
| 31 | ST_STAGE_1, | ||
| 32 | ST_STAGE_2, | ||
| 33 | ST_STAGE_3, | ||
| 34 | }; | ||
| 35 | |||
| 36 | // alert state update interval | ||
| 37 | #define ALERT_INTERVAL 600 | ||
| 38 | // self testing state update interval | ||
| 39 | #define ST_INTERVAL 100 | ||
| 40 | // self testing start index | ||
| 41 | #define ST_DEFAULT_INDEX 15 | ||
| 42 | // self testing stage delay | ||
| 43 | #define ST_STAGE_DELAY 10 | ||
| 44 | // self testing stage cycle count | ||
| 45 | #define ST_STAGE_COUNT 4 | ||
| 46 | // self testing stage end duration | ||
| 47 | #define ST_END_DURATION 10 | ||
| 48 | |||
| 49 | #ifdef RGBLIGHT_ENABLE | ||
| 50 | extern rgblight_config_t rgblight_config; | ||
| 51 | |||
| 52 | typedef struct { | ||
| 53 | uint8_t state; | ||
| 54 | uint8_t testing; | ||
| 55 | bool alert; | ||
| 56 | uint8_t index; | ||
| 57 | uint8_t delay; | ||
| 58 | uint8_t count; | ||
| 59 | bool dir; | ||
| 60 | uint8_t duration; | ||
| 61 | uint16_t ticks; | ||
| 62 | } rgb_state_t; | ||
| 63 | |||
| 64 | static rgb_state_t rgb_state = { | ||
| 65 | .state = //NORMAL, | ||
| 66 | SELF_TESTING, | ||
| 67 | .testing = ST_STAGE_1, | ||
| 68 | .ticks = 0, | ||
| 69 | .alert = false, | ||
| 70 | .index = ST_DEFAULT_INDEX, | ||
| 71 | .delay = ST_STAGE_DELAY, | ||
| 72 | .count = ST_STAGE_COUNT, | ||
| 73 | .dir = true, | ||
| 74 | .duration = ST_END_DURATION, | ||
| 75 | }; | ||
| 76 | |||
| 77 | static void update_ticks(void) | ||
| 78 | { | ||
| 79 | rgb_state.ticks = timer_read(); | ||
| 80 | } | ||
| 81 | |||
| 82 | static void self_testing(void) | ||
| 83 | { | ||
| 84 | if (timer_elapsed(rgb_state.ticks) < ST_INTERVAL) return; | ||
| 85 | HSV hsv; | ||
| 86 | hsv.h = rgblight_config.hue; | ||
| 87 | hsv.s = rgblight_config.sat; | ||
| 88 | hsv.v = rgblight_config.val; | ||
| 89 | |||
| 90 | RGB led = hsv_to_rgb(hsv); | ||
| 91 | switch(rgb_state.testing) { | ||
| 92 | case ST_STAGE_1: | ||
| 93 | if (rgb_state.index !=0 ) { | ||
| 94 | IS31FL3731_set_color_all(0, 0, 0); | ||
| 95 | } | ||
| 96 | |||
| 97 | if (rgb_state.index >= 1) { | ||
| 98 | for (int i = rgb_state.index-1; i < 32-rgb_state.index+1; i++) { | ||
| 99 | IS31FL3731_set_color(i, led.r, led.g, led.b); | ||
| 100 | } | ||
| 101 | if (rgb_state.index==1) { | ||
| 102 | rgb_state.index=0; | ||
| 103 | } else { | ||
| 104 | rgb_state.index -= 2; | ||
| 105 | } | ||
| 106 | } else{ | ||
| 107 | if (rgb_state.delay > 0) { | ||
| 108 | rgb_state.delay--; | ||
| 109 | } else { | ||
| 110 | // move to stage 2 | ||
| 111 | rgb_state.index = 2; | ||
| 112 | rgb_state.testing = ST_STAGE_2; | ||
| 113 | } | ||
| 114 | } | ||
| 115 | break; | ||
| 116 | case ST_STAGE_2: { | ||
| 117 | // clear all | ||
| 118 | IS31FL3731_set_color_all(0, 0, 0); | ||
| 119 | // light left and right | ||
| 120 | IS31FL3731_set_color(0, led.r, led.g, led.b); | ||
| 121 | IS31FL3731_set_color(1, led.r, led.g, led.b); | ||
| 122 | IS31FL3731_set_color(30, led.r, led.g, led.b); | ||
| 123 | IS31FL3731_set_color(31, led.r, led.g, led.b); | ||
| 124 | if (rgb_state.dir) { | ||
| 125 | // left to right | ||
| 126 | for (int i = rgb_state.index; i < rgb_state.index+4; i++) { | ||
| 127 | IS31FL3731_set_color(i, led.r, led.g, led.b); | ||
| 128 | } | ||
| 129 | rgb_state.index += 4; | ||
| 130 | if (rgb_state.index == 30) { | ||
| 131 | rgb_state.dir = !rgb_state.dir; | ||
| 132 | rgb_state.count--; | ||
| 133 | } | ||
| 134 | } else { | ||
| 135 | // right to left | ||
| 136 | for (int i = rgb_state.index-4; i < rgb_state.index; i++) { | ||
| 137 | IS31FL3731_set_color(i, led.r, led.g, led.b); | ||
| 138 | } | ||
| 139 | rgb_state.index -= 4; | ||
| 140 | if (rgb_state.index == 2) { | ||
| 141 | rgb_state.dir = !rgb_state.dir; | ||
| 142 | rgb_state.count--; | ||
| 143 | } | ||
| 144 | } | ||
| 145 | |||
| 146 | if (rgb_state.count == 0) { | ||
| 147 | // move to stage 3 | ||
| 148 | rgb_state.testing = ST_STAGE_3; | ||
| 149 | rgb_state.index = 0; | ||
| 150 | rgb_state.delay = ST_STAGE_DELAY; | ||
| 151 | rgb_state.duration = ST_END_DURATION; | ||
| 152 | } | ||
| 153 | } | ||
| 154 | break; | ||
| 155 | case ST_STAGE_3: | ||
| 156 | if (rgb_state.index != 16) { | ||
| 157 | IS31FL3731_set_color_all(0, 0, 0); | ||
| 158 | } | ||
| 159 | |||
| 160 | // light left and right | ||
| 161 | |||
| 162 | if (rgb_state.index == 16) { | ||
| 163 | if (rgb_state.duration) { | ||
| 164 | rgb_state.duration--; | ||
| 165 | } else { | ||
| 166 | if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { | ||
| 167 | rgb_state.state = CAPS_ALERT; | ||
| 168 | } else { | ||
| 169 | rgb_state.state = NORMAL; | ||
| 170 | rgblight_set(); | ||
| 171 | } | ||
| 172 | } | ||
| 173 | } else { | ||
| 174 | // left | ||
| 175 | for (int i = 0; i < rgb_state.index+1; i++) { | ||
| 176 | IS31FL3731_set_color(i, led.r, led.g, led.b); | ||
| 177 | } | ||
| 178 | // right | ||
| 179 | for (int i = 31; i > 31-rgb_state.index-1; i--) { | ||
| 180 | IS31FL3731_set_color(i, led.r, led.g, led.b); | ||
| 181 | } | ||
| 182 | rgb_state.index ++; | ||
| 183 | } | ||
| 184 | break; | ||
| 185 | } | ||
| 186 | |||
| 187 | update_ticks(); | ||
| 188 | } | ||
| 189 | |||
| 190 | const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | ||
| 191 | /* Refer to IS31 manual for these locations | ||
| 192 | * driver | ||
| 193 | * | R location | ||
| 194 | * | | G location | ||
| 195 | * | | | B location | ||
| 196 | * | | | | */ | ||
| 197 | // left CA | ||
| 198 | {0, C1_1, C3_2, C4_2}, | ||
| 199 | {0, C1_2, C2_2, C4_3}, | ||
| 200 | {0, C1_3, C2_3, C3_3}, | ||
| 201 | {0, C1_4, C2_4, C3_4}, | ||
| 202 | {0, C1_5, C2_5, C3_5}, | ||
| 203 | {0, C1_6, C2_6, C3_6}, | ||
| 204 | {0, C1_7, C2_7, C3_7}, | ||
| 205 | {0, C1_8, C2_8, C3_8}, | ||
| 206 | |||
| 207 | {0, C9_1, C8_1, C7_1}, | ||
| 208 | {0, C9_2, C8_2, C7_2}, | ||
| 209 | {0, C9_3, C8_3, C7_3}, | ||
| 210 | {0, C9_4, C8_4, C7_4}, | ||
| 211 | {0, C9_5, C8_5, C7_5}, | ||
| 212 | {0, C9_6, C8_6, C7_6}, | ||
| 213 | {0, C9_7, C8_7, C6_6}, | ||
| 214 | {0, C9_8, C7_7, C6_7}, | ||
| 215 | // left CB | ||
| 216 | {0, C1_9, C3_10, C4_10}, | ||
| 217 | {0, C1_10, C2_10, C4_11}, | ||
| 218 | {0, C1_11, C2_11, C3_11}, | ||
| 219 | {0, C1_12, C2_12, C3_12}, | ||
| 220 | {0, C1_13, C2_13, C3_13}, | ||
| 221 | {0, C1_14, C2_14, C3_14}, | ||
| 222 | {0, C1_15, C2_15, C3_15}, | ||
| 223 | {0, C1_16, C2_16, C3_16}, | ||
| 224 | |||
| 225 | {0, C9_9, C8_9, C7_9}, | ||
| 226 | {0, C9_10, C8_10, C7_10}, | ||
| 227 | {0, C9_11, C8_11, C7_11}, | ||
| 228 | {0, C9_12, C8_12, C7_12}, | ||
| 229 | {0, C9_13, C8_13, C7_13}, | ||
| 230 | {0, C9_14, C8_14, C7_14}, | ||
| 231 | {0, C9_15, C8_15, C6_14}, | ||
| 232 | {0, C9_16, C7_15, C6_15}, | ||
| 233 | }; | ||
| 234 | #endif | ||
| 235 | __attribute__((weak)) | ||
| 236 | void matrix_init_user(void) {} | ||
| 237 | |||
| 238 | void matrix_init_kb(void) | ||
| 239 | { | ||
| 240 | // clear caps led | ||
| 241 | setPinOutput(CAPS_PIN); | ||
| 242 | writePinLow(CAPS_PIN); | ||
| 243 | #ifdef RGBLIGHT_ENABLE | ||
| 244 | i2c_init(); | ||
| 245 | IS31FL3731_init(DRIVER_ADDR_1); | ||
| 246 | for (int index = 0; index < DRIVER_LED_TOTAL; index++) { | ||
| 247 | IS31FL3731_set_led_control_register(index, true, true, true); | ||
| 248 | } | ||
| 249 | IS31FL3731_update_led_control_registers(DRIVER_ADDR_1, 0); | ||
| 250 | update_ticks(); | ||
| 251 | #endif | ||
| 252 | matrix_init_user(); | ||
| 253 | } | ||
| 254 | |||
| 255 | #ifdef RGBLIGHT_ENABLE | ||
| 256 | void housekeeping_task_kb(void) | ||
| 257 | { | ||
| 258 | if (rgb_state.state == SELF_TESTING) { | ||
| 259 | self_testing(); | ||
| 260 | } else if (rgb_state.state == CAPS_ALERT) { | ||
| 261 | //gold 0xFF, 0xD9, 0x00 | ||
| 262 | LED_TYPE led = { | ||
| 263 | .r = 0xFF, | ||
| 264 | .g = 0xD9, | ||
| 265 | .b = 0x00, | ||
| 266 | }; | ||
| 267 | if (rgb_state.alert) { | ||
| 268 | IS31FL3731_set_color_all(led.r, led.g, led.b); | ||
| 269 | ws2812_setleds(&led, 1); | ||
| 270 | } else { | ||
| 271 | led.r = 0; | ||
| 272 | led.g = 0; | ||
| 273 | led.b = 0; | ||
| 274 | IS31FL3731_set_color_all(0, 0, 0); | ||
| 275 | ws2812_setleds(&led, 1); | ||
| 276 | } | ||
| 277 | |||
| 278 | if (timer_elapsed(rgb_state.ticks) > ALERT_INTERVAL) { | ||
| 279 | rgb_state.alert = !rgb_state.alert; | ||
| 280 | update_ticks(); | ||
| 281 | } | ||
| 282 | } | ||
| 283 | |||
| 284 | IS31FL3731_update_pwm_buffers(DRIVER_ADDR_1,0); | ||
| 285 | |||
| 286 | housekeeping_task_user(); | ||
| 287 | } | ||
| 288 | |||
| 289 | void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) | ||
| 290 | { | ||
| 291 | if (rgb_state.state != NORMAL) return; | ||
| 292 | |||
| 293 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { | ||
| 294 | IS31FL3731_set_color(i, start_led[i].r, start_led[i].g, start_led[i].b); | ||
| 295 | } | ||
| 296 | ws2812_setleds(start_led+DRIVER_LED_TOTAL, 1); | ||
| 297 | } | ||
| 298 | #endif | ||
| 299 | |||
| 300 | bool led_update_kb(led_t led_state) | ||
| 301 | { | ||
| 302 | bool res = led_update_user(led_state); | ||
| 303 | if (res) { | ||
| 304 | writePin(CAPS_PIN, led_state.caps_lock); | ||
| 305 | |||
| 306 | #ifdef RGBLIGHT_ENABLE | ||
| 307 | if (rgb_state.state != SELF_TESTING) { | ||
| 308 | if (led_state.caps_lock) { | ||
| 309 | rgb_state.state = CAPS_ALERT; | ||
| 310 | update_ticks(); | ||
| 311 | } else { | ||
| 312 | rgb_state.state = NORMAL; | ||
| 313 | rgblight_set(); | ||
| 314 | } | ||
| 315 | } | ||
| 316 | #endif | ||
| 317 | } | ||
| 318 | return res; | ||
| 319 | } \ No newline at end of file | ||
diff --git a/keyboards/neson_design/n6/n6.h b/keyboards/neson_design/n6/n6.h new file mode 100644 index 000000000..0015f8570 --- /dev/null +++ b/keyboards/neson_design/n6/n6.h | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | /** | ||
| 2 | * @file n6.h | ||
| 3 | * | ||
| 4 | Copyright 2021 astro | ||
| 5 | |||
| 6 | This program is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation, either version 2 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | */ | ||
| 19 | #pragma once | ||
| 20 | |||
| 21 | #include "quantum.h" | ||
| 22 | |||
| 23 | // This a shortcut to help you visually see your layout. | ||
| 24 | // The first section contains all of the arguements | ||
| 25 | // The second converts the arguments into a two-dimensional array | ||
| 26 | #define LAYOUT_65_ansi_blocker( \ | ||
| 27 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0E, K0F, \ | ||
| 28 | K10, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, \ | ||
| 29 | K20, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2F, \ | ||
| 30 | K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, K3F, \ | ||
| 31 | K40, K41, K43, K46, K4A, K4B, K4D, K4E, K4F \ | ||
| 32 | ) \ | ||
| 33 | { \ | ||
| 34 | { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, KC_NO, K0E }, \ | ||
| 35 | { K10, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, \ | ||
| 36 | { K20, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, KC_NO, K2D, K2F }, \ | ||
| 37 | { K30, KC_NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, K3F }, \ | ||
| 38 | { K40, K41, K43, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K46, K4A, K4B, K4D, K4E, K4F, K0F }, \ | ||
| 39 | } | ||
| 40 | |||
| 41 | #define LAYOUT_65_ansi_blocker_splitbs( \ | ||
| 42 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \ | ||
| 43 | K10, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, \ | ||
| 44 | K20, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2F, \ | ||
| 45 | K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, K3F, \ | ||
| 46 | K40, K41, K43, K46, K4A, K4B, K4D, K4E, K4F \ | ||
| 47 | ) \ | ||
| 48 | { \ | ||
| 49 | { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0E, K0E }, \ | ||
| 50 | { K10, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, \ | ||
| 51 | { K20, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, KC_NO, K2D, K2F }, \ | ||
| 52 | { K30, KC_NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, K3F }, \ | ||
| 53 | { K40, K41, K43, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K46, K4A, K4B, K4D, K4E, K4F, K0F }, \ | ||
| 54 | } | ||
diff --git a/keyboards/neson_design/n6/readme.md b/keyboards/neson_design/n6/readme.md new file mode 100644 index 000000000..81ba05be4 --- /dev/null +++ b/keyboards/neson_design/n6/readme.md | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | # Neson Design (formerly iNETT Studio) N6 | ||
| 2 | |||
| 3 | A 65% keyboard from the Neson Design's N series. | ||
| 4 | |||
| 5 | * Keyboard Maintainer: [astro](https://github.com/yulei) | ||
| 6 | * Hardware Supported: N6 keyboard | ||
| 7 | * Hardware Availability: Limited gb | ||
| 8 | |||
| 9 | Make example for this keyboard (after setting up your build environment): | ||
| 10 | |||
| 11 | make neson_design/n6:default | ||
| 12 | |||
| 13 | 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). | ||
| 14 | |||
| 15 | ## Bootloader | ||
| 16 | |||
| 17 | Enter the bootloader in 3 ways: | ||
| 18 | |||
| 19 | * **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard. | ||
| 20 | * **Physical reset button**: Briefly press the *RST* button on the back of the PCB. | ||
| 21 | * **Keycode in layout**: Press the key mapped to `RESET` if it is available. \ No newline at end of file | ||
diff --git a/keyboards/neson_design/n6/rules.mk b/keyboards/neson_design/n6/rules.mk new file mode 100644 index 000000000..a12a4034b --- /dev/null +++ b/keyboards/neson_design/n6/rules.mk | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | # MCU name | ||
| 2 | MCU = atmega32u4 | ||
| 3 | |||
| 4 | # Bootloader selection | ||
| 5 | BOOTLOADER = atmel-dfu | ||
| 6 | |||
| 7 | # Build Options | ||
| 8 | # change yes to no to disable | ||
| 9 | # | ||
| 10 | BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration | ||
| 11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
| 12 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
| 13 | CONSOLE_ENABLE = no # Console for debug | ||
| 14 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 15 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 16 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 17 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 18 | NKRO_ENABLE = yes # USB Nkey Rollover | ||
| 19 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 20 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | ||
| 21 | |||
| 22 | QUANTUM_LIB_SRC += i2c_master.c issi/is31fl3731.c | ||
| 23 | LAYOUTS = 65_ansi_blocker | ||
