From 9eda8c60b419bb4e6a98403fe337494ad89a872a Mon Sep 17 00:00:00 2001 From: etiennelepagel <50152897+etiennelepagel@users.noreply.github.com> Date: Mon, 11 Oct 2021 22:42:14 -0400 Subject: [PATCH] [Keyboard] Add MachKeyboards Mach3 (#14791) Co-authored-by: Ryan --- keyboards/machkeyboards/mach3/config.h | 45 ++++++++++++++++++ keyboards/machkeyboards/mach3/info.json | 47 +++++++++++++++++++ .../mach3/keymaps/default/keymap.c | 24 ++++++++++ .../mach3/keymaps/default/readme.md | 4 ++ .../machkeyboards/mach3/keymaps/via/keymap.c | 24 ++++++++++ .../machkeyboards/mach3/keymaps/via/rules.mk | 2 + keyboards/machkeyboards/mach3/mach3.c | 42 +++++++++++++++++ keyboards/machkeyboards/mach3/mach3.h | 29 ++++++++++++ keyboards/machkeyboards/mach3/readme.md | 22 +++++++++ keyboards/machkeyboards/mach3/rules.mk | 23 +++++++++ keyboards/machkeyboards/readme.md | 7 +++ 11 files changed, 269 insertions(+) create mode 100644 keyboards/machkeyboards/mach3/config.h create mode 100644 keyboards/machkeyboards/mach3/info.json create mode 100644 keyboards/machkeyboards/mach3/keymaps/default/keymap.c create mode 100644 keyboards/machkeyboards/mach3/keymaps/default/readme.md create mode 100644 keyboards/machkeyboards/mach3/keymaps/via/keymap.c create mode 100644 keyboards/machkeyboards/mach3/keymaps/via/rules.mk create mode 100644 keyboards/machkeyboards/mach3/mach3.c create mode 100644 keyboards/machkeyboards/mach3/mach3.h create mode 100644 keyboards/machkeyboards/mach3/readme.md create mode 100644 keyboards/machkeyboards/mach3/rules.mk create mode 100644 keyboards/machkeyboards/readme.md diff --git a/keyboards/machkeyboards/mach3/config.h b/keyboards/machkeyboards/mach3/config.h new file mode 100644 index 000000000000..d78f8dce9b37 --- /dev/null +++ b/keyboards/machkeyboards/mach3/config.h @@ -0,0 +1,45 @@ +/* Copyright 2021 Mach Keyboards + +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 . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x4D41 +#define PRODUCT_ID 0x4D33 +#define DEVICE_VER 0x0001 +#define MANUFACTURER MachKeyboard +#define PRODUCT Mach33 + +/* key matrix size */ +#define MATRIX_ROWS 3 +#define MATRIX_COLS 3 + +/* key pins */ +#define MATRIX_ROW_PINS { D1, D0, D4 } +#define MATRIX_COL_PINS { E6, B4, B5 } + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +/* backlight */ +#define BACKLIGHT_PIN B6 +#define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 5 + +/* debounce */ +#define DEBOUNCE 5 \ No newline at end of file diff --git a/keyboards/machkeyboards/mach3/info.json b/keyboards/machkeyboards/mach3/info.json new file mode 100644 index 000000000000..42f29a98733a --- /dev/null +++ b/keyboards/machkeyboards/mach3/info.json @@ -0,0 +1,47 @@ +{ + "keyboard_name": "Mach 3", + "url": "https://machkeyboards.com", + "maintainer": "etiennelepagel", + "layouts": { + "LAYOUT_3x3": { + "layout": [ + { + "x": 0, + "y": 0 + }, + { + "x": 1, + "y": 0 + }, + { + "x": 2, + "y": 0 + }, + { + "x": 0, + "y": 1 + }, + { + "x": 1, + "y": 1 + }, + { + "x": 2, + "y": 1 + }, + { + "x": 0, + "y": 2 + }, + { + "x": 1, + "y": 2 + }, + { + "x": 2, + "y": 2 + } + ] + } + } +} \ No newline at end of file diff --git a/keyboards/machkeyboards/mach3/keymaps/default/keymap.c b/keyboards/machkeyboards/mach3/keymaps/default/keymap.c new file mode 100644 index 000000000000..19133200e03e --- /dev/null +++ b/keyboards/machkeyboards/mach3/keymaps/default/keymap.c @@ -0,0 +1,24 @@ +/* Copyright 2021 Mach Keyboards + * + * 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 . + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_3x3( + BL_INC, BL_DEC, BL_BRTG, + BL_INC, BL_DEC, BL_BRTG, + BL_INC, BL_DEC, BL_BRTG + ) +}; \ No newline at end of file diff --git a/keyboards/machkeyboards/mach3/keymaps/default/readme.md b/keyboards/machkeyboards/mach3/keymaps/default/readme.md new file mode 100644 index 000000000000..d12e48d497b6 --- /dev/null +++ b/keyboards/machkeyboards/mach3/keymaps/default/readme.md @@ -0,0 +1,4 @@ +# Default Mach 3 Keymap + +This is the default layout that comes with the Mach 3. +The keys are set to only control the backlight. \ No newline at end of file diff --git a/keyboards/machkeyboards/mach3/keymaps/via/keymap.c b/keyboards/machkeyboards/mach3/keymaps/via/keymap.c new file mode 100644 index 000000000000..19133200e03e --- /dev/null +++ b/keyboards/machkeyboards/mach3/keymaps/via/keymap.c @@ -0,0 +1,24 @@ +/* Copyright 2021 Mach Keyboards + * + * 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 . + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_3x3( + BL_INC, BL_DEC, BL_BRTG, + BL_INC, BL_DEC, BL_BRTG, + BL_INC, BL_DEC, BL_BRTG + ) +}; \ No newline at end of file diff --git a/keyboards/machkeyboards/mach3/keymaps/via/rules.mk b/keyboards/machkeyboards/mach3/keymaps/via/rules.mk new file mode 100644 index 000000000000..36b7ba9cbc98 --- /dev/null +++ b/keyboards/machkeyboards/mach3/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes diff --git a/keyboards/machkeyboards/mach3/mach3.c b/keyboards/machkeyboards/mach3/mach3.c new file mode 100644 index 000000000000..9769d02a531c --- /dev/null +++ b/keyboards/machkeyboards/mach3/mach3.c @@ -0,0 +1,42 @@ +/* Copyright 2021 Mach Keyboards + * + * 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 . + */ +#include "mach3.h" + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { + // Key Matrix to LED Index + { 0, 1, 2 }, + { 7, 6, 5 }, + { 8, 9, 10 }, +}, { + // LED Index to Physical Position + { 0, 0 }, { 112, 0 }, { 224, 0 }, + { 0, 112 }, { 112, 112 }, { 224, 112 }, + { 0, 224 }, { 112, 224 }, { 224, 224 }, +}, { + // LED Index to Flag + 4, 4, 4, + 4, 4, 4, + 4, 4, 4 +} }; +#endif + +void keyboard_pre_init_kb(void) { + setPinOutput(F5); + writePinHigh(F5); + + keyboard_pre_init_user(); +} \ No newline at end of file diff --git a/keyboards/machkeyboards/mach3/mach3.h b/keyboards/machkeyboards/mach3/mach3.h new file mode 100644 index 000000000000..2eeadb3fbaa2 --- /dev/null +++ b/keyboards/machkeyboards/mach3/mach3.h @@ -0,0 +1,29 @@ +/* Copyright 2021 Mach Keyboards + * + * 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 . + */ +#pragma once + +#include "quantum.h" + +#define LAYOUT_3x3( \ + K00, K01, K02, \ + K10, K11, K12, \ + K20, K21, K22 \ + ) \ + { \ + { K00, K01, K02 }, \ + { K10, K11, K12 }, \ + { K20, K21, K22 } \ + } diff --git a/keyboards/machkeyboards/mach3/readme.md b/keyboards/machkeyboards/mach3/readme.md new file mode 100644 index 000000000000..16c61511b192 --- /dev/null +++ b/keyboards/machkeyboards/mach3/readme.md @@ -0,0 +1,22 @@ +# Mach 3 + +A 3x3 macropad with RGB underglow. +Note: It sets an output pin to high, which is the alimentation of the backlight circuit. + +* Keyboard Maintainer: [etiennelepagel](https://github.com/etiennelepagel) +* Hardware Supported: Mach 3 from Mach Keyboards +* Hardware Availability: [Mach Keyboards Official Website](https://machkeyboards.com/) + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB +* **Keycode in layout**: Press the key mapped to `RESET` if it is available + +Make example for this keyboard (after setting up your build environment): + + make machkeyboards/mach3:default + +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/machkeyboards/mach3/rules.mk b/keyboards/machkeyboards/mach3/rules.mk new file mode 100644 index 000000000000..e8f6fb4038c9 --- /dev/null +++ b/keyboards/machkeyboards/mach3/rules.mk @@ -0,0 +1,23 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # 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 = no # USB Nkey Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +UNICODE_ENABLE = yes +BACKLIGHT_DRIVER = pwm \ No newline at end of file diff --git a/keyboards/machkeyboards/readme.md b/keyboards/machkeyboards/readme.md new file mode 100644 index 000000000000..ef2f8b159d78 --- /dev/null +++ b/keyboards/machkeyboards/readme.md @@ -0,0 +1,7 @@ +# Mach Keyboards + +Mach Keyboards focus itself on selling the best macropad in the world. + +[Mach Keyboards Official Website](https://machkeyboards.com) +[Discord](https://discord.gg/ukFKFc7eXy) +[Instagram](https://www.instagram.com/machkeyboards) \ No newline at end of file