diff options
author | owlab-git <88034417+owlab-git@users.noreply.github.com> | 2022-01-13 06:10:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-12 14:10:16 -0800 |
commit | 59ea42099288dce99ec52f4517512124ae71caa0 (patch) | |
tree | 2cc799ac29c713831e996569163dc133aa1c576a | |
parent | 2c18dcc619017d2c8abe0cecbb168b84d48124e8 (diff) | |
download | qmk_firmware-59ea42099288dce99ec52f4517512124ae71caa0.tar.gz qmk_firmware-59ea42099288dce99ec52f4517512124ae71caa0.zip |
[Keyboard] Add OwLab Spring (#15614)
-rw-r--r-- | keyboards/owlab/spring/config.h | 68 | ||||
-rw-r--r-- | keyboards/owlab/spring/info.json | 78 | ||||
-rw-r--r-- | keyboards/owlab/spring/keymaps/default/keymap.c | 38 | ||||
-rw-r--r-- | keyboards/owlab/spring/keymaps/via/keymap.c | 54 | ||||
-rw-r--r-- | keyboards/owlab/spring/keymaps/via/rules.mk | 2 | ||||
-rw-r--r-- | keyboards/owlab/spring/readme.md | 21 | ||||
-rw-r--r-- | keyboards/owlab/spring/rules.mk | 18 | ||||
-rw-r--r-- | keyboards/owlab/spring/spring.c | 125 | ||||
-rw-r--r-- | keyboards/owlab/spring/spring.h | 33 |
9 files changed, 437 insertions, 0 deletions
diff --git a/keyboards/owlab/spring/config.h b/keyboards/owlab/spring/config.h new file mode 100644 index 000000000..d4eef1e02 --- /dev/null +++ b/keyboards/owlab/spring/config.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | Copyright 2021 OwLab | ||
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 | #pragma once | ||
19 | |||
20 | #include "config_common.h" | ||
21 | |||
22 | /* USB Device descriptor parameter */ | ||
23 | #define VENDOR_ID 0x4F53 //0x4F53 for OwLab | ||
24 | #define PRODUCT_ID 0x5350 //0x514B SP for Spring | ||
25 | #define DEVICE_VER 0x0001 | ||
26 | #define MANUFACTURER OwLab | ||
27 | #define PRODUCT Spring | ||
28 | |||
29 | |||
30 | /* key matrix size */ | ||
31 | #define MATRIX_ROWS 5 | ||
32 | #define MATRIX_COLS 15 | ||
33 | |||
34 | /* Keyboard Matrix Assignments */ | ||
35 | #define MATRIX_ROW_PINS { B0, B7, D0, D1, D2 } | ||
36 | #define MATRIX_COL_PINS { D5, D4, D6, D7, B4, B5, B6, C6, C7, F4, F7, F6, F5, F1, F0 } | ||
37 | /* COL2ROW, ROW2COL */ | ||
38 | #define DIODE_DIRECTION COL2ROW | ||
39 | |||
40 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
41 | #define DEBOUNCE 5 | ||
42 | |||
43 | /* NKRO */ | ||
44 | #define FORCE_NKRO | ||
45 | |||
46 | /* RGB Strip*/ | ||
47 | #define RGB_DI_PIN D3 | ||
48 | #ifdef RGB_DI_PIN | ||
49 | # define RGBLIGHT_EFFECT_BREATHING | ||
50 | # define RGBLIGHT_EFFECT_RAINBOW_MOOD | ||
51 | # define RGBLIGHT_EFFECT_RAINBOW_SWIRL | ||
52 | # define RGBLIGHT_EFFECT_SNAKE | ||
53 | # define RGBLIGHT_EFFECT_KNIGHT | ||
54 | # define RGBLIGHT_EFFECT_CHRISTMAS | ||
55 | # define RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
56 | # define RGBLIGHT_EFFECT_RGB_TEST | ||
57 | # define RGBLIGHT_EFFECT_ALTERNATING | ||
58 | # define RGBLIGHT_EFFECT_TWINKLE | ||
59 | # define RGBLED_NUM 8 | ||
60 | # define RGBLIGHT_HUE_STEP 8 | ||
61 | # define RGBLIGHT_SAT_STEP 8 | ||
62 | # define RGBLIGHT_VAL_STEP 10 | ||
63 | # define RGBLIGHT_LIMIT_VAL 255 | ||
64 | # define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_RAINBOW_SWIRL | ||
65 | # define RGBLIGHT_DEFAULT_VAL RGBLIGHT_LIMIT_VAL/2 | ||
66 | #endif | ||
67 | |||
68 | |||
diff --git a/keyboards/owlab/spring/info.json b/keyboards/owlab/spring/info.json new file mode 100644 index 000000000..bbeee6628 --- /dev/null +++ b/keyboards/owlab/spring/info.json | |||
@@ -0,0 +1,78 @@ | |||
1 | { | ||
2 | "keyboard_name": "Spring", | ||
3 | "url": "", | ||
4 | "maintainer": "OwLab", | ||
5 | "layouts": { | ||
6 | "LAYOUT_spring": { | ||
7 | "layout": [ | ||
8 | {"x":0.5, "y":0}, | ||
9 | {"x":1.75, "y":0}, | ||
10 | {"x":2.75, "y":0}, | ||
11 | {"x":3.75, "y":0}, | ||
12 | {"x":4.75, "y":0}, | ||
13 | {"x":5.75, "y":0}, | ||
14 | {"x":6.75, "y":0}, | ||
15 | {"x":7.75, "y":0}, | ||
16 | {"x":8.75, "y":0}, | ||
17 | {"x":9.75, "y":0}, | ||
18 | {"x":10.75, "y":0}, | ||
19 | {"x":11.75, "y":0}, | ||
20 | {"x":12.75, "y":0}, | ||
21 | {"x":13.75, "y":0}, | ||
22 | {"x":14.75, "y":0, "w":2}, | ||
23 | {"x":0.25, "y":1}, | ||
24 | {"x":1.5, "y":1, "w":1.5}, | ||
25 | {"x":3, "y":1}, | ||
26 | {"x":4, "y":1}, | ||
27 | {"x":5, "y":1}, | ||
28 | {"x":6, "y":1}, | ||
29 | {"x":7, "y":1}, | ||
30 | {"x":8, "y":1}, | ||
31 | {"x":9, "y":1}, | ||
32 | {"x":10, "y":1}, | ||
33 | {"x":11, "y":1}, | ||
34 | {"x":12, "y":1}, | ||
35 | {"x":13, "y":1}, | ||
36 | {"x":14, "y":1}, | ||
37 | {"x":15, "y":1, "w":1.5}, | ||
38 | {"x":0, "y":2}, | ||
39 | {"x":1.25, "y":2, "w":1.75}, | ||
40 | {"x":3, "y":2}, | ||
41 | {"x":4, "y":2}, | ||
42 | {"x":5, "y":2}, | ||
43 | {"x":6, "y":2}, | ||
44 | {"x":7, "y":2}, | ||
45 | {"x":8, "y":2}, | ||
46 | {"x":9, "y":2}, | ||
47 | {"x":10, "y":2}, | ||
48 | {"x":11, "y":2}, | ||
49 | {"x":12, "y":2}, | ||
50 | {"x":13, "y":2}, | ||
51 | {"x":14, "y":2, "w":2.25}, | ||
52 | {"x":1, "y":3, "w":2.25}, | ||
53 | {"x":3.25, "y":3}, | ||
54 | {"x":4.25, "y":3}, | ||
55 | {"x":5.25, "y":3}, | ||
56 | {"x":6.25, "y":3}, | ||
57 | {"x":7.25, "y":3}, | ||
58 | {"x":8.25, "y":3}, | ||
59 | {"x":9.25, "y":3}, | ||
60 | {"x":10.25, "y":3}, | ||
61 | {"x":11.25, "y":3}, | ||
62 | {"x":12.25, "y":3}, | ||
63 | {"x":13.25, "y":3}, | ||
64 | {"x":14.25, "y":3}, | ||
65 | {"x":15.25, "y":3, "w":1.75}, | ||
66 | {"x":1, "y":4, "w":1.25}, | ||
67 | {"x":2.25, "y":4, "w":1.25}, | ||
68 | {"x":4.75, "y":4, "w":1.25}, | ||
69 | {"x":6, "y":4, "w":2.25}, | ||
70 | {"x":8.25, "y":4, "w":2.75}, | ||
71 | {"x":11, "y":4, "w":1.25}, | ||
72 | {"x":13.25, "y":4}, | ||
73 | {"x":14.25, "y":4}, | ||
74 | {"x":15.25, "y":4} | ||
75 | ] | ||
76 | } | ||
77 | } | ||
78 | } \ No newline at end of file | ||
diff --git a/keyboards/owlab/spring/keymaps/default/keymap.c b/keyboards/owlab/spring/keymaps/default/keymap.c new file mode 100644 index 000000000..e48ae3241 --- /dev/null +++ b/keyboards/owlab/spring/keymaps/default/keymap.c | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | Copyright 2021 qwertykeys | ||
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 | #include QMK_KEYBOARD_H | ||
18 | |||
19 | |||
20 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
21 | |||
22 | [0] = LAYOUT_spring( | ||
23 | KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, | ||
24 | KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, | ||
25 | KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, | ||
26 | 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_UP, KC_RSFT, | ||
27 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_RGHT | ||
28 | ), | ||
29 | |||
30 | [1] = LAYOUT_spring( | ||
31 | KC_TRNS, KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, RESET, | ||
32 | KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, | ||
33 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_HOME, KC_TRNS, | ||
34 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_END, KC_TRNS, KC_TRNS, | ||
35 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS | ||
36 | ) | ||
37 | |||
38 | }; \ No newline at end of file | ||
diff --git a/keyboards/owlab/spring/keymaps/via/keymap.c b/keyboards/owlab/spring/keymaps/via/keymap.c new file mode 100644 index 000000000..06779ed4e --- /dev/null +++ b/keyboards/owlab/spring/keymaps/via/keymap.c | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | Copyright 2021 qwertykeys | ||
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 | #include QMK_KEYBOARD_H | ||
18 | |||
19 | |||
20 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
21 | |||
22 | [0] = LAYOUT_spring( | ||
23 | KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, | ||
24 | KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, | ||
25 | KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, | ||
26 | 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_UP, KC_RSFT, | ||
27 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_RGHT | ||
28 | ), | ||
29 | |||
30 | [1] = LAYOUT_spring( | ||
31 | KC_TRNS, KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, RESET, | ||
32 | KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, | ||
33 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_HOME, KC_TRNS, | ||
34 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_END, KC_TRNS, KC_TRNS, | ||
35 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS | ||
36 | ), | ||
37 | |||
38 | [2] = LAYOUT_spring( | ||
39 | 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, | ||
40 | 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, | ||
41 | 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, | ||
42 | 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, | ||
43 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS | ||
44 | ), | ||
45 | |||
46 | [3] = LAYOUT_spring( | ||
47 | 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, | ||
48 | 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, | ||
49 | 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, | ||
50 | 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, | ||
51 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS | ||
52 | ) | ||
53 | |||
54 | }; \ No newline at end of file | ||
diff --git a/keyboards/owlab/spring/keymaps/via/rules.mk b/keyboards/owlab/spring/keymaps/via/rules.mk new file mode 100644 index 000000000..43061db1d --- /dev/null +++ b/keyboards/owlab/spring/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/owlab/spring/readme.md b/keyboards/owlab/spring/readme.md new file mode 100644 index 000000000..d4ec27b91 --- /dev/null +++ b/keyboards/owlab/spring/readme.md | |||
@@ -0,0 +1,21 @@ | |||
1 | # Spring - PCB | ||
2 | |||
3 |  | ||
4 | |||
5 | An Alice style board with arrowkeys made by OwLab, based on the Fate Arisu layout. | ||
6 | |||
7 | * Keyboard Maintainer: [OwLab](https://github.com/owlab-git) | ||
8 | * Hardware Supported: Spring PCB | ||
9 | * Hardware Availability: | ||
10 | |||
11 | Make example for this keyboard (after setting up your build environment): | ||
12 | |||
13 | make owlab/spring:default | ||
14 | |||
15 | Flashing example for this keyboard: | ||
16 | |||
17 | make owlab/spring:default:flash | ||
18 | |||
19 | **Bootloader:** Press the physical reset button on the bottom side of the PCB (labeled SW1) or hold down ESC while plugging in the board. | ||
20 | |||
21 | 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/owlab/spring/rules.mk b/keyboards/owlab/spring/rules.mk new file mode 100644 index 000000000..5f9bfe1f0 --- /dev/null +++ b/keyboards/owlab/spring/rules.mk | |||
@@ -0,0 +1,18 @@ | |||
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 = yes # Enable Bootmagic Lite | ||
11 | MOUSEKEY_ENABLE = yes # 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 | NKRO_ENABLE = yes # Enable N-Key Rollover | ||
16 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
17 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | ||
18 | AUDIO_ENABLE = no # Audio output \ No newline at end of file | ||
diff --git a/keyboards/owlab/spring/spring.c b/keyboards/owlab/spring/spring.c new file mode 100644 index 000000000..60982c151 --- /dev/null +++ b/keyboards/owlab/spring/spring.c | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | Copyright 2021 OwLab | ||
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 | #include "spring.h" | ||
18 | |||
19 | enum caps_modes{ | ||
20 | CAPS_MODE_UPPER = 0, //UPPER CASE | ||
21 | CAPS_MODE_LOWER //LOWER CASE | ||
22 | }; | ||
23 | |||
24 | uint8_t caps_mode_index; | ||
25 | rgblight_config_t pre_rgb; | ||
26 | uint8_t dir_hue, dir_sat; | ||
27 | |||
28 | bool caps_in = false; | ||
29 | uint32_t caps_timer; | ||
30 | |||
31 | |||
32 | |||
33 | |||
34 | void switch_caps_mode(uint8_t mode){ | ||
35 | switch(mode){ | ||
36 | case CAPS_MODE_UPPER: | ||
37 | dir_hue = 0; | ||
38 | dir_sat = 240; | ||
39 | break; | ||
40 | |||
41 | case CAPS_MODE_LOWER: | ||
42 | dir_hue = 88; | ||
43 | dir_sat = 255; | ||
44 | break; | ||
45 | |||
46 | default: | ||
47 | break; | ||
48 | } | ||
49 | rgblight_sethsv_noeeprom(dir_hue,dir_sat,pre_rgb.val); | ||
50 | |||
51 | } | ||
52 | |||
53 | |||
54 | void init_caps_mode(uint8_t mode){ | ||
55 | pre_rgb.mode = rgblight_get_mode(); | ||
56 | pre_rgb.hue = rgblight_get_hue(); | ||
57 | pre_rgb.sat = rgblight_get_sat(); | ||
58 | pre_rgb.val = rgblight_get_val(); | ||
59 | caps_in = true; | ||
60 | |||
61 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | ||
62 | switch_caps_mode(mode); | ||
63 | |||
64 | } | ||
65 | |||
66 | |||
67 | void set_caps_mode(uint8_t mode){ | ||
68 | if(caps_in == false){ | ||
69 | init_caps_mode(mode); | ||
70 | }else{ | ||
71 | switch_caps_mode(mode); | ||
72 | } | ||
73 | caps_timer = timer_read32(); | ||
74 | |||
75 | |||
76 | } | ||
77 | |||
78 | |||
79 | void matrix_scan_kb(void) { | ||
80 | if(caps_in){ | ||
81 | if(timer_elapsed32(caps_timer) > 3000){ | ||
82 | rgblight_sethsv(pre_rgb.hue, pre_rgb.sat, pre_rgb.val); | ||
83 | rgblight_mode(pre_rgb.mode); | ||
84 | caps_in = false; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | matrix_scan_user(); | ||
89 | } | ||
90 | |||
91 | |||
92 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
93 | if (record->event.pressed) { | ||
94 | switch(keycode) { | ||
95 | case RGB_TOG: | ||
96 | case RGB_MOD: | ||
97 | case RGB_RMOD: | ||
98 | case RGB_HUI: | ||
99 | case RGB_HUD: | ||
100 | case RGB_SAI: | ||
101 | case RGB_SAD: | ||
102 | case RGB_VAI: | ||
103 | case RGB_VAD: | ||
104 | if(caps_in){ | ||
105 | return false; | ||
106 | } | ||
107 | break; | ||
108 | |||
109 | |||
110 | case KC_CAPS: | ||
111 | if(IS_LED_ON(host_keyboard_leds(), USB_LED_CAPS_LOCK)){ | ||
112 | caps_mode_index = CAPS_MODE_LOWER; | ||
113 | } else{ | ||
114 | caps_mode_index = CAPS_MODE_UPPER; | ||
115 | } | ||
116 | set_caps_mode(caps_mode_index); | ||
117 | break; | ||
118 | |||
119 | |||
120 | default: | ||
121 | break; | ||
122 | } | ||
123 | } | ||
124 | return process_record_user(keycode, record); | ||
125 | } | ||
diff --git a/keyboards/owlab/spring/spring.h b/keyboards/owlab/spring/spring.h new file mode 100644 index 000000000..195d8cd4c --- /dev/null +++ b/keyboards/owlab/spring/spring.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | Copyright 2021 OwLab | ||
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 | #pragma once | ||
19 | #include "quantum.h" | ||
20 | |||
21 | #define LAYOUT_spring( \ | ||
22 | K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \ | ||
23 | K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \ | ||
24 | K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \ | ||
25 | K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, \ | ||
26 | K400, K401, K402, K404, K405, K409, K411, K412, K413 \ | ||
27 | ) { \ | ||
28 | { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \ | ||
29 | { K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \ | ||
30 | { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO }, \ | ||
31 | { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, KC_NO }, \ | ||
32 | { K400, K401, K402, KC_NO, K404, K405, KC_NO, KC_NO, KC_NO, K409, KC_NO, K411, K412, K413, KC_NO } \ | ||
33 | } | ||