[Keyboard] Add Mammoth20x (#14014)

This commit is contained in:
GG 2021-08-19 21:17:54 +03:00 committed by GitHub
parent c592128219
commit f4f679779e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 328 additions and 0 deletions

View File

@ -0,0 +1,54 @@
/*
Copyright 2021 wuquestudio
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xB06B
#define PRODUCT_ID 0x0005
#define DEVICE_VER 0x0001
#define MANUFACTURER wuque studio
#define PRODUCT mammoth20x
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 4
#define MATRIX_ROW_PINS { D5, F0, F1, F4, F5, F6 }
#define MATRIX_COL_PINS { B0, B1, E6, F7 }
#define DIODE_DIRECTION COL2ROW
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* Enable encoder */
#define ENCODERS_PAD_A { D3 }
#define ENCODERS_PAD_B { D2 }
#define ENCODERS 1
// Note: array is { col, row )
#define ENCODERS_CW_KEY { { 3, 2 } }
#define ENCODERS_CCW_KEY { { 3, 4 } }

View File

@ -0,0 +1,41 @@
{
"keyboard_name": "mammoth20x",
"url": "https://shop.wuquestudio.com/",
"maintainer": "spbgzh",
"width": 4,
"height": 6,
"layouts": {
"LAYOUT_default": {
"layout": [
{ "label": "Esc", "x": 0, "y": 0 },
{ "label": "Pause", "x": 1, "y": 0 },
{ "label": "Delete", "x": 2, "y": 0 },
{ "label": "E", "x": 3.5, "y": 0 },
{ "label": "Num", "x": 0, "y": 1 },
{ "label": "/", "x": 1, "y": 1 },
{ "label": "*", "x": 2, "y": 1 },
{ "label": "-", "x": 3, "y": 1 },
{ "label": "7", "x": 0, "y": 2 },
{ "label": "8", "x": 1, "y": 2 },
{ "label": "9", "x": 2, "y": 2 },
{ "label": "LeftEncode", "x": 3, "y": 0, "w": 0.5 },
{ "label": "4", "x": 0, "y": 3 },
{ "label": "5", "x": 1, "y": 3 },
{ "label": "6", "x": 2, "y": 3 },
{ "label": "+", "x": 3, "y": 2, "h": 2 },
{ "label": "1", "x": 0, "y": 4 },
{ "label": "2", "x": 1, "y": 4 },
{ "label": "3", "x": 2, "y": 4 },
{ "label": "RightEncode", "x": 4.5, "y": 0, "w" : 0.25 },
{ "label": "0", "x": 0, "y": 5, "w": 2 },
{ "label": ".", "x": 2, "y": 5 },
{ "label": "Enter", "x": 3, "y": 4,"h":2 }
]
}
}
}

View File

@ -0,0 +1,36 @@
/* Copyright 2021 wuquestudio
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_default(
KC_ESC, KC_PAUS, KC_DEL, KC_MUTE,
KC_LNUM, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_VOLU,
KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3, KC_VOLD,
KC_P0, KC_PDOT, KC_PENT
),
[1] = LAYOUT_default(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______
),
};

View File

@ -0,0 +1 @@
# The default keymap for mammoth20x

View File

@ -0,0 +1,52 @@
/* Copyright 2021 wuquestudio
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_default(
KC_ESC, KC_PAUS, KC_DEL, KC_MUTE,
KC_LNUM, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_VOLU,
KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3, KC_VOLD,
KC_P0, KC_PDOT, KC_PENT
),
[1] = LAYOUT_default(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______
),
[2] = LAYOUT_default(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______
),
[3] = LAYOUT_default(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______
),
};

View File

@ -0,0 +1 @@
# The via keymap for mammoth20x

View File

@ -0,0 +1,2 @@
VIA_ENABLE = yes
LTO_ENABLE = yes

View File

@ -0,0 +1,59 @@
/* Copyright 2021 wuquestudio
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mammoth20x.h"
static uint8_t encoder_state[ENCODERS] = {0};
static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY;
void encoder_action_unregister(void)
{
for (int index = 0; index < ENCODERS; ++index)
{
if (encoder_state[index])
{
keyevent_t encoder_event = (keyevent_t){
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = (timer_read() | 1)};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise)
{
keyevent_t encoder_event = (keyevent_t){
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = (timer_read() | 1)};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_kb(void)
{
encoder_action_unregister();
matrix_scan_user();
}
bool encoder_update_kb(uint8_t index, bool clockwise)
{
encoder_action_register(index, clockwise);
return true;
};

View File

@ -0,0 +1,36 @@
/* Copyright 2021 wuquestudio
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
#define LAYOUT_default( \
K00, K01, K02, K03, \
K10, K11, K12, K13, \
K20, K21, K22, K23, \
K30, K31, K32, K33, \
K40, K41, K42, K43, \
K50, K52, K53 \
) { \
{ K00, K01, K02, K03 }, \
{ K10, K11, K12, K13 }, \
{ K20, K21, K22, K23 }, \
{ K30, K31, K32, K33 }, \
{ K40, K41, K42, K43 }, \
{ K50, KC_NO, K52, K53 }, \
}

View File

@ -0,0 +1,22 @@
# mammoth20x
More Info at[wuquestudio](https://shop.wuquestudio.com/).
* Keyboard Maintainer: [spbgzh](https://github.com/spbgzh)
* Hardware Supported: mammoth20x Standard
* Hardware Availability: [mammoth20x](https://shop.wuquestudio.com/)
Make example for this keyboard (after setting up your build environment):
make wuque/mammoth20x:default
Flashing example for this keyboard:
make wuque/mammoth20x:default:flash
To reset the board into bootloader mode, do one of the following:
* Tap the Reset switch mounted on the PCB
* Hold the Esc key while connecting the USB cable (also erases persistent settings)
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).

View File

@ -0,0 +1,24 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes # Enable Encoder