~ruther/qmk_firmware

a0b7c1618af74cc1e18a482ac79ed1ddedcda2df — etiennelepagel 3 years ago 2d8dcf0
[Keyboard] Add MachKeyboards Mach3 (#14791)

Co-authored-by: Ryan <fauxpark@gmail.com>
A keyboards/machkeyboards/mach3/config.h => keyboards/machkeyboards/mach3/config.h +45 -0
@@ 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 <http://www.gnu.org/licenses/>.
*/

#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

A keyboards/machkeyboards/mach3/info.json => keyboards/machkeyboards/mach3/info.json +47 -0
@@ 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

A keyboards/machkeyboards/mach3/keymaps/default/keymap.c => keyboards/machkeyboards/mach3/keymaps/default/keymap.c +24 -0
@@ 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 <http://www.gnu.org/licenses/>.
 */
#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

A keyboards/machkeyboards/mach3/keymaps/default/readme.md => keyboards/machkeyboards/mach3/keymaps/default/readme.md +4 -0
@@ 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

A keyboards/machkeyboards/mach3/keymaps/via/keymap.c => keyboards/machkeyboards/mach3/keymaps/via/keymap.c +24 -0
@@ 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 <http://www.gnu.org/licenses/>.
 */
#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

A keyboards/machkeyboards/mach3/keymaps/via/rules.mk => keyboards/machkeyboards/mach3/keymaps/via/rules.mk +2 -0
@@ 0,0 1,2 @@
VIA_ENABLE = yes
LTO_ENABLE = yes

A keyboards/machkeyboards/mach3/mach3.c => keyboards/machkeyboards/mach3/mach3.c +42 -0
@@ 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 <http://www.gnu.org/licenses/>.
 */
#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

A keyboards/machkeyboards/mach3/mach3.h => keyboards/machkeyboards/mach3/mach3.h +29 -0
@@ 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 <http://www.gnu.org/licenses/>.
 */
#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 }  \
  }

A keyboards/machkeyboards/mach3/readme.md => keyboards/machkeyboards/mach3/readme.md +22 -0
@@ 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).

A keyboards/machkeyboards/mach3/rules.mk => keyboards/machkeyboards/mach3/rules.mk +23 -0
@@ 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

A keyboards/machkeyboards/readme.md => keyboards/machkeyboards/readme.md +7 -0
@@ 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