diff options
author | GG <72414103+spbgzh@users.noreply.github.com> | 2021-08-19 21:17:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-19 11:17:54 -0700 |
commit | f4f679779e1404d9dc34c64823b9eb993bfa7ab3 (patch) | |
tree | 7e3569f078b555d1d264147741ad52f3a501a2da | |
parent | c59212821918736504074da24f33108551e8bdde (diff) | |
download | qmk_firmware-f4f679779e1404d9dc34c64823b9eb993bfa7ab3.tar.gz qmk_firmware-f4f679779e1404d9dc34c64823b9eb993bfa7ab3.zip |
[Keyboard] Add Mammoth20x (#14014)
-rw-r--r-- | keyboards/wuque/mammoth20x/config.h | 54 | ||||
-rw-r--r-- | keyboards/wuque/mammoth20x/info.json | 41 | ||||
-rw-r--r-- | keyboards/wuque/mammoth20x/keymaps/default/keymap.c | 36 | ||||
-rw-r--r-- | keyboards/wuque/mammoth20x/keymaps/default/readme.md | 1 | ||||
-rw-r--r-- | keyboards/wuque/mammoth20x/keymaps/via/keymap.c | 52 | ||||
-rw-r--r-- | keyboards/wuque/mammoth20x/keymaps/via/readme.md | 1 | ||||
-rw-r--r-- | keyboards/wuque/mammoth20x/keymaps/via/rules.mk | 2 | ||||
-rw-r--r-- | keyboards/wuque/mammoth20x/mammoth20x.c | 59 | ||||
-rw-r--r-- | keyboards/wuque/mammoth20x/mammoth20x.h | 36 | ||||
-rw-r--r-- | keyboards/wuque/mammoth20x/readme.md | 22 | ||||
-rw-r--r-- | keyboards/wuque/mammoth20x/rules.mk | 24 |
11 files changed, 328 insertions, 0 deletions
diff --git a/keyboards/wuque/mammoth20x/config.h b/keyboards/wuque/mammoth20x/config.h new file mode 100644 index 000000000..a29ab2cb2 --- /dev/null +++ b/keyboards/wuque/mammoth20x/config.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | Copyright 2021 wuquestudio | ||
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 0xB06B | ||
24 | #define PRODUCT_ID 0x0005 | ||
25 | #define DEVICE_VER 0x0001 | ||
26 | #define MANUFACTURER wuque studio | ||
27 | #define PRODUCT mammoth20x | ||
28 | |||
29 | /* key matrix size */ | ||
30 | #define MATRIX_ROWS 6 | ||
31 | #define MATRIX_COLS 4 | ||
32 | |||
33 | #define MATRIX_ROW_PINS { D5, F0, F1, F4, F5, F6 } | ||
34 | #define MATRIX_COL_PINS { B0, B1, E6, F7 } | ||
35 | |||
36 | #define DIODE_DIRECTION COL2ROW | ||
37 | |||
38 | /* Set 0 if debouncing isn't needed */ | ||
39 | #define DEBOUNCE 5 | ||
40 | |||
41 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
42 | #define LOCKING_SUPPORT_ENABLE | ||
43 | |||
44 | /* Locking resynchronize hack */ | ||
45 | #define LOCKING_RESYNC_ENABLE | ||
46 | |||
47 | /* Enable encoder */ | ||
48 | #define ENCODERS_PAD_A { D3 } | ||
49 | #define ENCODERS_PAD_B { D2 } | ||
50 | |||
51 | #define ENCODERS 1 | ||
52 | // Note: array is { col, row ) | ||
53 | #define ENCODERS_CW_KEY { { 3, 2 } } | ||
54 | #define ENCODERS_CCW_KEY { { 3, 4 } } | ||
diff --git a/keyboards/wuque/mammoth20x/info.json b/keyboards/wuque/mammoth20x/info.json new file mode 100644 index 000000000..c889aa36b --- /dev/null +++ b/keyboards/wuque/mammoth20x/info.json | |||
@@ -0,0 +1,41 @@ | |||
1 | { | ||
2 | "keyboard_name": "mammoth20x", | ||
3 | "url": "https://shop.wuquestudio.com/", | ||
4 | "maintainer": "spbgzh", | ||
5 | "width": 4, | ||
6 | "height": 6, | ||
7 | "layouts": { | ||
8 | "LAYOUT_default": { | ||
9 | "layout": [ | ||
10 | { "label": "Esc", "x": 0, "y": 0 }, | ||
11 | { "label": "Pause", "x": 1, "y": 0 }, | ||
12 | { "label": "Delete", "x": 2, "y": 0 }, | ||
13 | { "label": "E", "x": 3.5, "y": 0 }, | ||
14 | |||
15 | { "label": "Num", "x": 0, "y": 1 }, | ||
16 | { "label": "/", "x": 1, "y": 1 }, | ||
17 | { "label": "*", "x": 2, "y": 1 }, | ||
18 | { "label": "-", "x": 3, "y": 1 }, | ||
19 | |||
20 | { "label": "7", "x": 0, "y": 2 }, | ||
21 | { "label": "8", "x": 1, "y": 2 }, | ||
22 | { "label": "9", "x": 2, "y": 2 }, | ||
23 | { "label": "LeftEncode", "x": 3, "y": 0, "w": 0.5 }, | ||
24 | |||
25 | { "label": "4", "x": 0, "y": 3 }, | ||
26 | { "label": "5", "x": 1, "y": 3 }, | ||
27 | { "label": "6", "x": 2, "y": 3 }, | ||
28 | { "label": "+", "x": 3, "y": 2, "h": 2 }, | ||
29 | |||
30 | { "label": "1", "x": 0, "y": 4 }, | ||
31 | { "label": "2", "x": 1, "y": 4 }, | ||
32 | { "label": "3", "x": 2, "y": 4 }, | ||
33 | { "label": "RightEncode", "x": 4.5, "y": 0, "w" : 0.25 }, | ||
34 | |||
35 | { "label": "0", "x": 0, "y": 5, "w": 2 }, | ||
36 | { "label": ".", "x": 2, "y": 5 }, | ||
37 | { "label": "Enter", "x": 3, "y": 4,"h":2 } | ||
38 | ] | ||
39 | } | ||
40 | } | ||
41 | } | ||
diff --git a/keyboards/wuque/mammoth20x/keymaps/default/keymap.c b/keyboards/wuque/mammoth20x/keymaps/default/keymap.c new file mode 100644 index 000000000..77946f373 --- /dev/null +++ b/keyboards/wuque/mammoth20x/keymaps/default/keymap.c | |||
@@ -0,0 +1,36 @@ | |||
1 | /* Copyright 2021 wuquestudio | ||
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 | #include QMK_KEYBOARD_H | ||
18 | |||
19 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
20 | [0] = LAYOUT_default( | ||
21 | KC_ESC, KC_PAUS, KC_DEL, KC_MUTE, | ||
22 | KC_LNUM, KC_PSLS, KC_PAST, KC_PMNS, | ||
23 | KC_P7, KC_P8, KC_P9, KC_VOLU, | ||
24 | KC_P4, KC_P5, KC_P6, KC_PPLS, | ||
25 | KC_P1, KC_P2, KC_P3, KC_VOLD, | ||
26 | KC_P0, KC_PDOT, KC_PENT | ||
27 | ), | ||
28 | [1] = LAYOUT_default( | ||
29 | _______, _______, _______, _______, | ||
30 | _______, _______, _______, _______, | ||
31 | _______, _______, _______, _______, | ||
32 | _______, _______, _______, _______, | ||
33 | _______, _______, _______, _______, | ||
34 | _______, _______, _______ | ||
35 | ), | ||
36 | }; | ||
diff --git a/keyboards/wuque/mammoth20x/keymaps/default/readme.md b/keyboards/wuque/mammoth20x/keymaps/default/readme.md new file mode 100644 index 000000000..5bad9b455 --- /dev/null +++ b/keyboards/wuque/mammoth20x/keymaps/default/readme.md | |||
@@ -0,0 +1 @@ | |||
# The default keymap for mammoth20x | |||
diff --git a/keyboards/wuque/mammoth20x/keymaps/via/keymap.c b/keyboards/wuque/mammoth20x/keymaps/via/keymap.c new file mode 100644 index 000000000..c8c434a60 --- /dev/null +++ b/keyboards/wuque/mammoth20x/keymaps/via/keymap.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* Copyright 2021 wuquestudio | ||
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 | #include QMK_KEYBOARD_H | ||
18 | |||
19 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
20 | [0] = LAYOUT_default( | ||
21 | KC_ESC, KC_PAUS, KC_DEL, KC_MUTE, | ||
22 | KC_LNUM, KC_PSLS, KC_PAST, KC_PMNS, | ||
23 | KC_P7, KC_P8, KC_P9, KC_VOLU, | ||
24 | KC_P4, KC_P5, KC_P6, KC_PPLS, | ||
25 | KC_P1, KC_P2, KC_P3, KC_VOLD, | ||
26 | KC_P0, KC_PDOT, KC_PENT | ||
27 | ), | ||
28 | [1] = LAYOUT_default( | ||
29 | _______, _______, _______, _______, | ||
30 | _______, _______, _______, _______, | ||
31 | _______, _______, _______, _______, | ||
32 | _______, _______, _______, _______, | ||
33 | _______, _______, _______, _______, | ||
34 | _______, _______, _______ | ||
35 | ), | ||
36 | [2] = LAYOUT_default( | ||
37 | _______, _______, _______, _______, | ||
38 | _______, _______, _______, _______, | ||
39 | _______, _______, _______, _______, | ||
40 | _______, _______, _______, _______, | ||
41 | _______, _______, _______, _______, | ||
42 | _______, _______, _______ | ||
43 | ), | ||
44 | [3] = LAYOUT_default( | ||
45 | _______, _______, _______, _______, | ||
46 | _______, _______, _______, _______, | ||
47 | _______, _______, _______, _______, | ||
48 | _______, _______, _______, _______, | ||
49 | _______, _______, _______, _______, | ||
50 | _______, _______, _______ | ||
51 | ), | ||
52 | }; | ||
diff --git a/keyboards/wuque/mammoth20x/keymaps/via/readme.md b/keyboards/wuque/mammoth20x/keymaps/via/readme.md new file mode 100644 index 000000000..fcd4ba857 --- /dev/null +++ b/keyboards/wuque/mammoth20x/keymaps/via/readme.md | |||
@@ -0,0 +1 @@ | |||
# The via keymap for mammoth20x | |||
diff --git a/keyboards/wuque/mammoth20x/keymaps/via/rules.mk b/keyboards/wuque/mammoth20x/keymaps/via/rules.mk new file mode 100644 index 000000000..36b7ba9cb --- /dev/null +++ b/keyboards/wuque/mammoth20x/keymaps/via/rules.mk | |||
@@ -0,0 +1,2 @@ | |||
1 | VIA_ENABLE = yes | ||
2 | LTO_ENABLE = yes | ||
diff --git a/keyboards/wuque/mammoth20x/mammoth20x.c b/keyboards/wuque/mammoth20x/mammoth20x.c new file mode 100644 index 000000000..da6ccecd3 --- /dev/null +++ b/keyboards/wuque/mammoth20x/mammoth20x.c | |||
@@ -0,0 +1,59 @@ | |||
1 | /* Copyright 2021 wuquestudio | ||
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 | #include "mammoth20x.h" | ||
18 | |||
19 | |||
20 | static uint8_t encoder_state[ENCODERS] = {0}; | ||
21 | static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY; | ||
22 | static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY; | ||
23 | |||
24 | void encoder_action_unregister(void) | ||
25 | { | ||
26 | for (int index = 0; index < ENCODERS; ++index) | ||
27 | { | ||
28 | if (encoder_state[index]) | ||
29 | { | ||
30 | keyevent_t encoder_event = (keyevent_t){ | ||
31 | .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], | ||
32 | .pressed = false, | ||
33 | .time = (timer_read() | 1)}; | ||
34 | encoder_state[index] = 0; | ||
35 | action_exec(encoder_event); | ||
36 | } | ||
37 | } | ||
38 | } | ||
39 | void encoder_action_register(uint8_t index, bool clockwise) | ||
40 | { | ||
41 | keyevent_t encoder_event = (keyevent_t){ | ||
42 | .key = clockwise ? encoder_cw[index] : encoder_ccw[index], | ||
43 | .pressed = true, | ||
44 | .time = (timer_read() | 1)}; | ||
45 | encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); | ||
46 | action_exec(encoder_event); | ||
47 | } | ||
48 | |||
49 | void matrix_scan_kb(void) | ||
50 | { | ||
51 | encoder_action_unregister(); | ||
52 | matrix_scan_user(); | ||
53 | } | ||
54 | |||
55 | bool encoder_update_kb(uint8_t index, bool clockwise) | ||
56 | { | ||
57 | encoder_action_register(index, clockwise); | ||
58 | return true; | ||
59 | }; | ||
diff --git a/keyboards/wuque/mammoth20x/mammoth20x.h b/keyboards/wuque/mammoth20x/mammoth20x.h new file mode 100644 index 000000000..cd0d8d478 --- /dev/null +++ b/keyboards/wuque/mammoth20x/mammoth20x.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* Copyright 2021 wuquestudio | ||
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 "quantum.h" | ||
20 | |||
21 | #define LAYOUT_default( \ | ||
22 | K00, K01, K02, K03, \ | ||
23 | K10, K11, K12, K13, \ | ||
24 | K20, K21, K22, K23, \ | ||
25 | K30, K31, K32, K33, \ | ||
26 | K40, K41, K42, K43, \ | ||
27 | K50, K52, K53 \ | ||
28 | ) { \ | ||
29 | { K00, K01, K02, K03 }, \ | ||
30 | { K10, K11, K12, K13 }, \ | ||
31 | { K20, K21, K22, K23 }, \ | ||
32 | { K30, K31, K32, K33 }, \ | ||
33 | { K40, K41, K42, K43 }, \ | ||
34 | { K50, KC_NO, K52, K53 }, \ | ||
35 | } | ||
36 | |||
diff --git a/keyboards/wuque/mammoth20x/readme.md b/keyboards/wuque/mammoth20x/readme.md new file mode 100644 index 000000000..4b731a159 --- /dev/null +++ b/keyboards/wuque/mammoth20x/readme.md | |||
@@ -0,0 +1,22 @@ | |||
1 | # mammoth20x | ||
2 | | ||
3 | More Info at[wuquestudio](https://shop.wuquestudio.com/). | ||
4 | | ||
5 | * Keyboard Maintainer: [spbgzh](https://github.com/spbgzh) | ||
6 | * Hardware Supported: mammoth20x Standard | ||
7 | * Hardware Availability: [mammoth20x](https://shop.wuquestudio.com/) | ||
8 | | ||
9 | Make example for this keyboard (after setting up your build environment): | ||
10 | |||
11 | make wuque/mammoth20x:default | ||
12 | |||
13 | Flashing example for this keyboard: | ||
14 | |||
15 | make wuque/mammoth20x:default:flash | ||
16 | |||
17 | To reset the board into bootloader mode, do one of the following: | ||
18 | |||
19 | * Tap the Reset switch mounted on the PCB | ||
20 | * Hold the Esc key while connecting the USB cable (also erases persistent settings) | ||
21 | |||
22 | 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/wuque/mammoth20x/rules.mk b/keyboards/wuque/mammoth20x/rules.mk new file mode 100644 index 000000000..8431b9817 --- /dev/null +++ b/keyboards/wuque/mammoth20x/rules.mk | |||
@@ -0,0 +1,24 @@ | |||
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 = yes # Mouse keys | ||
12 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
13 | CONSOLE_ENABLE = yes # 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 = no # Enable keyboard RGB underglow | ||
21 | BLUETOOTH_ENABLE = no # Enable Bluetooth | ||
22 | AUDIO_ENABLE = no # Audio output | ||
23 | ENCODER_ENABLE = yes # Enable Encoder | ||
24 | |||