diff options
author | TW59420 <40019210+TW59420@users.noreply.github.com> | 2022-02-21 14:01:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-20 22:01:31 -0800 |
commit | f7b5d67a7bfc5cbcf7e71ad5a203b34961cfc352 (patch) | |
tree | a48928e8b84c27a7e3713aaebbba6ea6fb39014d | |
parent | 65af7272f34148d8ea8e2b75e4e463fcb607e6f2 (diff) | |
download | qmk_firmware-f7b5d67a7bfc5cbcf7e71ad5a203b34961cfc352.tar.gz qmk_firmware-f7b5d67a7bfc5cbcf7e71ad5a203b34961cfc352.zip |
[Keyboard] Add MW75R2 PCB (#15042)
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
-rw-r--r-- | keyboards/mwstudio/mw75r2/config.h | 80 | ||||
-rw-r--r-- | keyboards/mwstudio/mw75r2/info.json | 97 | ||||
-rw-r--r-- | keyboards/mwstudio/mw75r2/keymaps/default/keymap.c | 39 | ||||
-rw-r--r-- | keyboards/mwstudio/mw75r2/keymaps/via/keymap.c | 171 | ||||
-rw-r--r-- | keyboards/mwstudio/mw75r2/keymaps/via/rules.mk | 2 | ||||
-rw-r--r-- | keyboards/mwstudio/mw75r2/mw75r2.c | 28 | ||||
-rw-r--r-- | keyboards/mwstudio/mw75r2/mw75r2.h | 34 | ||||
-rw-r--r-- | keyboards/mwstudio/mw75r2/readme.md | 22 | ||||
-rw-r--r-- | keyboards/mwstudio/mw75r2/rules.mk | 21 |
9 files changed, 494 insertions, 0 deletions
diff --git a/keyboards/mwstudio/mw75r2/config.h b/keyboards/mwstudio/mw75r2/config.h new file mode 100644 index 000000000..4430d12a9 --- /dev/null +++ b/keyboards/mwstudio/mw75r2/config.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* Copyright 2021 TW59420 <https://github.com/TW59420> | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #pragma once | ||
18 | |||
19 | #include "config_common.h" | ||
20 | |||
21 | |||
22 | /* USB Device descriptor parameter */ | ||
23 | #define VENDOR_ID 0x7BA1 | ||
24 | #define PRODUCT_ID 0x7502 | ||
25 | #define DEVICE_VER 0x0001 | ||
26 | #define MANUFACTURER MWStudio | ||
27 | #define PRODUCT MW75R2 | ||
28 | |||
29 | /* key matrix size */ | ||
30 | #define MATRIX_ROWS 6 | ||
31 | #define MATRIX_COLS 15 | ||
32 | |||
33 | /* key matrix pins */ | ||
34 | #define MATRIX_ROW_PINS { B7, D0, D1, D2, D3, D5} | ||
35 | #define MATRIX_COL_PINS { C7, C6, B6, B5, B4, D7, D4, D6, F7, F6, E6, F0, F1, F4, F5 } | ||
36 | |||
37 | #define BOOTMAGIC_LITE_ROW 0 | ||
38 | #define BOOTMAGIC_LITE_COLUMN 0 | ||
39 | |||
40 | /* COL2ROW or ROW2COL */ | ||
41 | #define DIODE_DIRECTION COL2ROW | ||
42 | |||
43 | /* Set 0 if debouncing isn't needed */ | ||
44 | #define DEBOUNCE 5 | ||
45 | |||
46 | #define RGB_DI_PIN B3 | ||
47 | #define RGBLIGHT_SLEEP | ||
48 | |||
49 | #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255 | ||
50 | #define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS | ||
51 | #define DRIVER_LED_TOTAL 21 | ||
52 | #define RGBLED_NUM 21 | ||
53 | |||
54 | #define ENABLE_RGB_MATRIX_ALPHAS_MODS | ||
55 | #define ENABLE_RGB_MATRIX_BREATHING | ||
56 | #define ENABLE_RGB_MATRIX_CYCLE_ALL | ||
57 | #define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
58 | #define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN | ||
59 | #define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON | ||
60 | #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN | ||
61 | #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL | ||
62 | #define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL | ||
63 | #define ENABLE_RGB_MATRIX_CYCLE_SPIRAL | ||
64 | #define ENABLE_RGB_MATRIX_DUAL_BEACON | ||
65 | #define ENABLE_RGB_MATRIX_RAINBOW_BEACON | ||
66 | #define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS | ||
67 | #define ENABLE_RGB_MATRIX_RAINDROPS | ||
68 | #define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS | ||
69 | #define ENABLE_RGB_MATRIX_HUE_BREATHING | ||
70 | #define ENABLE_RGB_MATRIX_HUE_PENDULUM | ||
71 | #define ENABLE_RGB_MATRIX_HUE_WAVE | ||
72 | #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL | ||
73 | #define ENABLE_RGB_MATRIX_PIXEL_RAIN | ||
74 | |||
75 | #define RGBLIGHT_HUE_STEP 8 | ||
76 | #define RGBLIGHT_SAT_STEP 8 | ||
77 | #define RGBLIGHT_VAL_STEP 8 | ||
78 | |||
79 | #define ENCODERS_PAD_A { B1 } | ||
80 | #define ENCODERS_PAD_B { B2 } | ||
diff --git a/keyboards/mwstudio/mw75r2/info.json b/keyboards/mwstudio/mw75r2/info.json new file mode 100644 index 000000000..ade25ee7b --- /dev/null +++ b/keyboards/mwstudio/mw75r2/info.json | |||
@@ -0,0 +1,97 @@ | |||
1 | { | ||
2 | "keyboard_name": "MW75R2", | ||
3 | "url": "", | ||
4 | "maintainer": "qmk", | ||
5 | "layouts": { | ||
6 | "LAYOUT": { | ||
7 | "layout": [ | ||
8 | {"label":"Esc", "x":0, "y":0}, | ||
9 | {"label":"F1", "x":1.5, "y":0}, | ||
10 | {"label":"F2", "x":2.5, "y":0}, | ||
11 | {"label":"F3", "x":3.5, "y":0}, | ||
12 | {"label":"F4", "x":4.5, "y":0}, | ||
13 | {"label":"F5", "x":6, "y":0}, | ||
14 | {"label":"F6", "x":7, "y":0}, | ||
15 | {"label":"F7", "x":8, "y":0}, | ||
16 | {"label":"F8", "x":9, "y":0}, | ||
17 | {"label":"F9", "x":10.5, "y":0}, | ||
18 | {"label":"F10", "x":11.5, "y":0}, | ||
19 | {"label":"F11", "x":12.5, "y":0}, | ||
20 | {"label":"F12", "x":13.5, "y":0}, | ||
21 | {"label":"DEL", "x":15, "y":0}, | ||
22 | |||
23 | {"label":"`", "x":0, "y":1.5}, | ||
24 | {"label":"1", "x":1, "y":1.5}, | ||
25 | {"label":"2", "x":2, "y":1.5}, | ||
26 | {"label":"3", "x":3, "y":1.5}, | ||
27 | {"label":"4", "x":4, "y":1.5}, | ||
28 | {"label":"5", "x":5, "y":1.5}, | ||
29 | {"label":"6", "x":6, "y":1.5}, | ||
30 | {"label":"7", "x":7, "y":1.5}, | ||
31 | {"label":"8", "x":8, "y":1.5}, | ||
32 | {"label":"9", "x":9, "y":1.5}, | ||
33 | {"label":"0", "x":10, "y":1.5}, | ||
34 | {"label":"-", "x":11, "y":1.5}, | ||
35 | {"label":"=", "x":12, "y":1.5}, | ||
36 | {"label":"Backspace", "x":13, "y":1.5, "w":2}, | ||
37 | {"label":"Delete", "x":15, "y":1.5}, | ||
38 | |||
39 | {"label":"Tab", "x":0, "y":2.5, "w":1.5}, | ||
40 | {"label":"Q", "x":1.5, "y":2.5}, | ||
41 | {"label":"W", "x":2.5, "y":2.5}, | ||
42 | {"label":"E", "x":3.5, "y":2.5}, | ||
43 | {"label":"R", "x":4.5, "y":2.5}, | ||
44 | {"label":"T", "x":5.5, "y":2.5}, | ||
45 | {"label":"Y", "x":6.5, "y":2.5}, | ||
46 | {"label":"U", "x":7.5, "y":2.5}, | ||
47 | {"label":"I", "x":8.5, "y":2.5}, | ||
48 | {"label":"O", "x":9.5, "y":2.5}, | ||
49 | {"label":"P", "x":10.5, "y":2.5}, | ||
50 | {"label":"[", "x":11.5, "y":2.5}, | ||
51 | {"label":"]", "x":12.5, "y":2.5}, | ||
52 | {"label":"\\", "x":13.5, "y":2.5, "w":1.5}, | ||
53 | {"label":"PgUp", "x":15, "y":2.5}, | ||
54 | |||
55 | {"label":"Caps Lock", "x":0, "y":3.5, "w":1.75}, | ||
56 | {"label":"A", "x":1.75, "y":3.5}, | ||
57 | {"label":"S", "x":2.75, "y":3.5}, | ||
58 | {"label":"D", "x":3.75, "y":3.5}, | ||
59 | {"label":"F", "x":4.75, "y":3.5}, | ||
60 | {"label":"G", "x":5.75, "y":3.5}, | ||
61 | {"label":"H", "x":6.75, "y":3.5}, | ||
62 | {"label":"J", "x":7.75, "y":3.5}, | ||
63 | {"label":"K", "x":8.75, "y":3.5}, | ||
64 | {"label":"L", "x":9.75, "y":3.5}, | ||
65 | {"label":";", "x":10.75, "y":3.5}, | ||
66 | {"label":"'", "x":11.75, "y":3.5}, | ||
67 | {"label":"Enter", "x":12.75, "y":3.5, "w":2.25}, | ||
68 | {"label":"PgDn", "x":15, "y":3.5}, | ||
69 | |||
70 | {"label":"Shift", "x":0, "y":4.5, "w":2.25}, | ||
71 | {"label":"Z", "x":2.25, "y":4.5}, | ||
72 | {"label":"X", "x":3.25, "y":4.5}, | ||
73 | {"label":"C", "x":4.25, "y":4.5}, | ||
74 | {"label":"V", "x":5.25, "y":4.5}, | ||
75 | {"label":"B", "x":6.25, "y":4.5}, | ||
76 | {"label":"N", "x":7.25, "y":4.5}, | ||
77 | {"label":"M", "x":8.25, "y":4.5}, | ||
78 | {"label":",", "x":9.25, "y":4.5}, | ||
79 | {"label":".", "x":10.25, "y":4.5}, | ||
80 | {"label":"/", "x":11.25, "y":4.5}, | ||
81 | {"label":"Shift", "x":12.25, "y":4.5, "w":1.75}, | ||
82 | {"label":"\u2191", "x":14, "y":4.5}, | ||
83 | {"label":"End", "x":15, "y":4.5}, | ||
84 | |||
85 | {"label":"Ctrl", "x":0, "y":5.5, "w":1.25}, | ||
86 | {"label":"Win", "x":1.25, "y":5.5, "w":1.25}, | ||
87 | {"label":"Alt", "x":2.5, "y":5.5, "w":1.25}, | ||
88 | {"x":3.75, "y":5.5, "w":6.25}, | ||
89 | {"label":"Alt", "x":10, "y":5.5, "w":1.25}, | ||
90 | {"label":"Fn", "x":11.25, "y":5.5, "w":1.25}, | ||
91 | {"label":"\u2190", "x":13, "y":5.5}, | ||
92 | {"label":"\u2193", "x":14, "y":5.5}, | ||
93 | {"label":"\u2192", "x":15, "y":5.5} | ||
94 | ] | ||
95 | } | ||
96 | } | ||
97 | } | ||
diff --git a/keyboards/mwstudio/mw75r2/keymaps/default/keymap.c b/keyboards/mwstudio/mw75r2/keymaps/default/keymap.c new file mode 100644 index 000000000..73fd38011 --- /dev/null +++ b/keyboards/mwstudio/mw75r2/keymaps/default/keymap.c | |||
@@ -0,0 +1,39 @@ | |||
1 | /* Copyright 2021 TW59420 <https://github.com/TW59420> | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | |||
20 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
21 | |||
22 | [0] = LAYOUT( | ||
23 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, RGB_TOG, | ||
24 | 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, KC_DEL, | ||
25 | 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_PGUP, | ||
26 | 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_PGDN, | ||
27 | 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, KC_END, | ||
28 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT | ||
29 | ), | ||
30 | |||
31 | [1] = LAYOUT( | ||
32 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
33 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI, | ||
34 | RGB_TOG, _______, _______, _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, | ||
35 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI, | ||
36 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, RGB_SAD, | ||
37 | _______, _______, _______, _______, RGB_MOD, _______, RGB_SPD, RGB_VAD, RGB_SPI | ||
38 | ), | ||
39 | }; | ||
diff --git a/keyboards/mwstudio/mw75r2/keymaps/via/keymap.c b/keyboards/mwstudio/mw75r2/keymaps/via/keymap.c new file mode 100644 index 000000000..0648ac7bf --- /dev/null +++ b/keyboards/mwstudio/mw75r2/keymaps/via/keymap.c | |||
@@ -0,0 +1,171 @@ | |||
1 | /* Copyright 2021 TW59420 <https://github.com/TW59420> | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | |||
20 | typedef union { | ||
21 | uint32_t raw; | ||
22 | struct { | ||
23 | bool top_rgb_change :1; | ||
24 | bool bottom_rgb_change :1; | ||
25 | }; | ||
26 | } user_config_t; | ||
27 | |||
28 | user_config_t user_config; | ||
29 | |||
30 | #include QMK_KEYBOARD_H | ||
31 | |||
32 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
33 | |||
34 | [0] = LAYOUT( | ||
35 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, RGB_TOG, | ||
36 | 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, KC_DEL, | ||
37 | 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_PGUP, | ||
38 | 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_PGDN, | ||
39 | 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, KC_END, | ||
40 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT | ||
41 | ), | ||
42 | |||
43 | [1] = LAYOUT( | ||
44 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, USER00, USER01, _______, | ||
45 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI, | ||
46 | RGB_TOG, _______, _______, _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, | ||
47 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI, | ||
48 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, RGB_SAD, | ||
49 | _______, _______, _______, _______, RGB_MOD, _______, RGB_SPD, RGB_VAD, RGB_SPI | ||
50 | ), | ||
51 | |||
52 | [2] = LAYOUT( | ||
53 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
54 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
55 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
56 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
57 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
58 | _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
59 | ), | ||
60 | |||
61 | [3] = LAYOUT( | ||
62 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
63 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
64 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
65 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
66 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
67 | _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
68 | ), | ||
69 | }; | ||
70 | |||
71 | |||
72 | void keyboard_post_init_user(void) { | ||
73 | // Read the user config from EEPROM | ||
74 | user_config.raw = eeconfig_read_user(); | ||
75 | } | ||
76 | |||
77 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
78 | switch (keycode) { | ||
79 | case USER00: | ||
80 | if (record->event.pressed) { | ||
81 | // Do something when pressed | ||
82 | user_config.top_rgb_change ^= 1; // Toggles the status | ||
83 | eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM | ||
84 | } else { | ||
85 | // Do something else when release | ||
86 | } | ||
87 | return false; // Skip all further processing of this key | ||
88 | case USER01: | ||
89 | if (record->event.pressed) { | ||
90 | // Do something when pressed | ||
91 | user_config.bottom_rgb_change ^= 1; // Toggles the status | ||
92 | eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM | ||
93 | } else { | ||
94 | // Do something else when release | ||
95 | } | ||
96 | return false; // Skip all further processing of this key | ||
97 | default: | ||
98 | return true; // Process all other keycodes normally | ||
99 | } | ||
100 | } | ||
101 | |||
102 | #ifdef ENCODER_ENABLE | ||
103 | #define ENCODERS 1 | ||
104 | static uint8_t encoder_state[ENCODERS] = {0}; | ||
105 | static keypos_t encoder_cw[ENCODERS] = {{3, 5}}; | ||
106 | static keypos_t encoder_ccw[ENCODERS] = {{4, 5}}; | ||
107 | |||
108 | |||
109 | void encoder_action_unregister(void) { | ||
110 | #ifdef ENCODERS | ||
111 | for (uint8_t index = 0; index < ENCODERS; ++index) { | ||
112 | if (encoder_state[index]) { | ||
113 | keyevent_t encoder_event = (keyevent_t) { | ||
114 | .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], | ||
115 | .pressed = false, | ||
116 | .time = (timer_read() | 1) | ||
117 | }; | ||
118 | encoder_state[index] = 0; | ||
119 | action_exec(encoder_event); | ||
120 | } | ||
121 | } | ||
122 | #endif | ||
123 | } | ||
124 | |||
125 | void encoder_action_register(uint8_t index, bool clockwise) { | ||
126 | keyevent_t encoder_event = (keyevent_t) { | ||
127 | .key = clockwise ? encoder_cw[index] : encoder_ccw[index], | ||
128 | .pressed = true, | ||
129 | .time = (timer_read() | 1) | ||
130 | }; | ||
131 | encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); | ||
132 | action_exec(encoder_event); | ||
133 | } | ||
134 | |||
135 | void matrix_scan_user(void) { | ||
136 | encoder_action_unregister(); | ||
137 | } | ||
138 | |||
139 | bool encoder_update_user(uint8_t index, bool clockwise) { | ||
140 | encoder_action_register(index, clockwise); | ||
141 | return true; | ||
142 | }; | ||
143 | #endif | ||
144 | |||
145 | |||
146 | void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { | ||
147 | |||
148 | if (user_config.top_rgb_change) | ||
149 | { | ||
150 | for (size_t i = 14; i < 18; i++) | ||
151 | { | ||
152 | RGB_MATRIX_INDICATOR_SET_COLOR(i, 0, 0, 0); | ||
153 | } | ||
154 | } | ||
155 | if (host_keyboard_led_state().caps_lock) { | ||
156 | for (size_t i = 14; i < 18; i++) | ||
157 | { | ||
158 | RGB_MATRIX_INDICATOR_SET_COLOR(i, 0, 255, 255); // assuming caps lock is at led #5 | ||
159 | } | ||
160 | } | ||
161 | if (user_config.bottom_rgb_change) | ||
162 | { | ||
163 | for (size_t i = 0; i < 21; i++) | ||
164 | { | ||
165 | if (i >= 14 && i <18) | ||
166 | continue; | ||
167 | |||
168 | RGB_MATRIX_INDICATOR_SET_COLOR(i, 0, 0, 0); | ||
169 | } | ||
170 | } | ||
171 | } | ||
diff --git a/keyboards/mwstudio/mw75r2/keymaps/via/rules.mk b/keyboards/mwstudio/mw75r2/keymaps/via/rules.mk new file mode 100644 index 000000000..36b7ba9cb --- /dev/null +++ b/keyboards/mwstudio/mw75r2/keymaps/via/rules.mk | |||
@@ -0,0 +1,2 @@ | |||
1 | VIA_ENABLE = yes | ||
2 | LTO_ENABLE = yes | ||
diff --git a/keyboards/mwstudio/mw75r2/mw75r2.c b/keyboards/mwstudio/mw75r2/mw75r2.c new file mode 100644 index 000000000..0aa387467 --- /dev/null +++ b/keyboards/mwstudio/mw75r2/mw75r2.c | |||
@@ -0,0 +1,28 @@ | |||
1 | /* Copyright 2021 TW59420 <https://github.com/TW59420> | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include "mw75r2.h" | ||
17 | |||
18 | #ifdef RGB_MATRIX_ENABLE | ||
19 | led_config_t g_led_config = { { | ||
20 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | ||
21 | { 8, 9, 10, 11, 12, 13, 14, 15 }, | ||
22 | { 16, 17, 18, 19, 20 } | ||
23 | }, { | ||
24 | { 105, 60 }, { 70, 60 }, { 35, 60 }, { 0, 60 }, { 0, 40 }, { 0, 20 }, { 0, 0 }, { 42, 0 }, { 84, 0 }, { 126, 0 }, { 168, 0 }, { 210, 0 }, { 210, 20 }, { 210, 40 }, { 40, 20 }, { 120, 20 }, { 40, 40 }, { 120, 40 }, { 210, 60 }, { 175, 60 },{ 140, 60 } | ||
25 | }, { | ||
26 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 | ||
27 | } }; | ||
28 | #endif | ||
diff --git a/keyboards/mwstudio/mw75r2/mw75r2.h b/keyboards/mwstudio/mw75r2/mw75r2.h new file mode 100644 index 000000000..593b2ebb1 --- /dev/null +++ b/keyboards/mwstudio/mw75r2/mw75r2.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* Copyright 2021 TW59420 <https://github.com/TW59420> | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #include "quantum.h" | ||
19 | |||
20 | #define LAYOUT( \ | ||
21 | K000, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014,\ | ||
22 | K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114,\ | ||
23 | K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214,\ | ||
24 | K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K314,\ | ||
25 | K400, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414,\ | ||
26 | K500, K501, K502, K506, K510, K511, K512, K513, K514\ | ||
27 | ) { \ | ||
28 | { K000, KC_NO, 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, K214 },\ | ||
31 | { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, KC_NO, K314 },\ | ||
32 | { K400, KC_NO, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414 },\ | ||
33 | { K500, K501, K502, KC_NO, KC_NO, KC_NO, K506, KC_NO, KC_NO, KC_NO, K510, K511, K512, K513, K514 }\ | ||
34 | } | ||
diff --git a/keyboards/mwstudio/mw75r2/readme.md b/keyboards/mwstudio/mw75r2/readme.md new file mode 100644 index 000000000..ef2efb373 --- /dev/null +++ b/keyboards/mwstudio/mw75r2/readme.md | |||
@@ -0,0 +1,22 @@ | |||
1 | # MW75R2 | ||
2 | |||
3 |  | ||
4 | |||
5 | Support Atmega32u4 keyboard. | ||
6 | |||
7 | * Keyboard Maintainer: [TW59420](https://github.com/TW59420) | ||
8 | * Hardware Supported: Atmega32u4 | ||
9 | |||
10 | Make example for this keyboard (after setting up your build environment): | ||
11 | |||
12 | make mwstudio/mw75r2:default | ||
13 | |||
14 | Flashing example for this keyboard: | ||
15 | |||
16 | make mwstudio/mw75r2:default:flash | ||
17 | |||
18 | 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). | ||
19 | |||
20 | ## Bootloader | ||
21 | * **Physical reset button**: Short press the button on the back of the PCB to enter the Bootloader and flash the firmware | ||
22 | * **Keycode in layout**: Press the key mapped to RESET if it is available | ||
diff --git a/keyboards/mwstudio/mw75r2/rules.mk b/keyboards/mwstudio/mw75r2/rules.mk new file mode 100644 index 000000000..9407031ed --- /dev/null +++ b/keyboards/mwstudio/mw75r2/rules.mk | |||
@@ -0,0 +1,21 @@ | |||
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 = no # Enable keyboard RGB underglow | ||
18 | AUDIO_ENABLE = no # Audio output | ||
19 | RGB_MATRIX_ENABLE = yes | ||
20 | RGB_MATRIX_DRIVER = WS2812 | ||
21 | ENCODER_ENABLE = yes | ||