~ruther/qmk_firmware

e08203f16a5d9b69abea796583491d4b2de3aa6b — Rafael Yumagulov 4 years ago 4a47ee9
[Keyboard] Added Compound keyboard support (#12942)

* [Keyboard] Added Compound keyboard support

* Small fixes for Compound keyboard

* Fixed readme and header file for Compound keyboard

* Update keyboards/compound/rules.mk

Co-authored-by: Ryan <fauxpark@gmail.com>

* Changed info.json and readme.md for Compound Keyboard

info.json - removed key_count
readme.md - changed PCB picture url to low-resolution

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
A keyboards/compound/compound.c => keyboards/compound/compound.c +18 -0
@@ 0,0 1,18 @@
/*
Copyright 2021 Rafael Yumagulov

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 "compound.h"

A keyboards/compound/compound.h => keyboards/compound/compound.h +38 -0
@@ 0,0 1,38 @@
/*
Copyright 2021 Rafael Yumagulov

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"

// Improve readability
#define XXX KC_NO

#define LAYOUT( \
    k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, \
    k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, \
    k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \
    k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \
    k40, k41, k42,                k46,                k4a, k4b, k4c \
) \
{ \
    {k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e}, \
    {k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, XXX}, \
    {k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, XXX, XXX}, \
    {k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, XXX, XXX}, \
    {k40, k41, k42, XXX, XXX, XXX, k46, XXX, XXX, XXX, k4a, k4b, k4c, XXX, XXX}  \
}

A keyboards/compound/config.h => keyboards/compound/config.h +48 -0
@@ 0,0 1,48 @@
/*
Copyright 2021 Rafael Yumagulov

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       0x420A
#define PRODUCT_ID      0xB0BA
#define DEVICE_VER      0x0001
#define MANUFACTURER    Sabomov
#define PRODUCT         Compound

/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 15

// ROWS: Top to bottom, COLS: Left to right

#define MATRIX_ROW_PINS {B0,B7,D0,D1,D2}
#define MATRIX_COL_PINS {F0,D5,D4,D6,D7,B4,B5,B6,C6,C7,F7,F6,F5,F4,F1}

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW

/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST

/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5

#define QMK_ESC_OUTPUT B3 // usually COL
#define QMK_ESC_INPUT F0 // usually ROW

A keyboards/compound/info.json => keyboards/compound/info.json +79 -0
@@ 0,0 1,79 @@
{
    "keyboard_name": "Compound",
    "url": "https://geekhack.org/index.php?topic=111187.0",
    "maintainer": "yumagulovrn",
    "width": 15,
    "height": 5,
    "layouts": {
        "LAYOUT": {
            "layout": [
                {"x": 0, "y": 0},
                {"x": 1, "y": 0},
                {"x": 2, "y": 0},
                {"x": 3, "y": 0},
                {"x": 4, "y": 0},
                {"x": 5, "y": 0},
                {"x": 6, "y": 0},
                {"x": 7, "y": 0},
                {"x": 8, "y": 0},
                {"x": 9, "y": 0},
                {"x": 10, "y": 0},
                {"x": 11, "y": 0},
                {"x": 12, "y": 0},
                {"x": 13, "y": 0},
                {"x": 14, "y": 0},

                {"x": 0, "y": 1, "w": 1.5},
                {"x": 1.5, "y": 1},
                {"x": 2.5, "y": 1},
                {"x": 3.5, "y": 1},
                {"x": 4.5, "y": 1},
                {"x": 5.5, "y": 1},
                {"x": 6.5, "y": 1},
                {"x": 7.5, "y": 1},
                {"x": 8.5, "y": 1},
                {"x": 9.5, "y": 1},
                {"x": 10.5, "y": 1},
                {"x": 11.5, "y": 1},
                {"x": 12.5, "y": 1},
                {"x": 13.5, "y": 1, "w": 1.5},

                {"x": 0, "y": 2, "w": 1.75},
                {"x": 1.75, "y": 2},
                {"x": 2.75, "y": 2},
                {"x": 3.75, "y": 2},
                {"x": 4.75, "y": 2},
                {"x": 5.75, "y": 2},
                {"x": 6.75, "y": 2},
                {"x": 7.75, "y": 2},
                {"x": 8.75, "y": 2},
                {"x": 9.75, "y": 2},
                {"x": 10.75, "y": 2},
                {"x": 11.75, "y": 2},
                {"x": 12.75, "y": 2, "w": 2.25},

                {"x": 0, "y": 3, "w": 2.25},
                {"x": 2.25, "y": 3},
                {"x": 3.25, "y": 3},
                {"x": 4.25, "y": 3},
                {"x": 5.25, "y": 3},
                {"x": 6.25, "y": 3},
                {"x": 7.25, "y": 3},
                {"x": 8.25, "y": 3},
                {"x": 9.25, "y": 3},
                {"x": 10.25, "y": 3},
                {"x": 11.25, "y": 3},
                {"x": 12.25, "y": 3, "w": 1.75},
                {"x": 14, "y": 3},

                {"x": 0, "y": 4, "w": 1.5},
                {"x": 1.5, "y": 4},
                {"x": 2.5, "y": 4, "w": 1.5},
                {"x": 4, "y": 4, "w": 7},
                {"x": 11, "y": 4, "w": 1.5},
                {"x": 12.5, "y": 4},
                {"x": 13.5, "y": 4, "w": 1.5}
            ]
        }
    }
}

A keyboards/compound/keymaps/default/keymap.c => keyboards/compound/keymaps/default/keymap.c +40 -0
@@ 0,0 1,40 @@
/*
Copyright 2021 Rafael Yumagulov

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

enum _layer {
  _MA,
  _FN
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[_MA] = LAYOUT(
  KC_ESC,  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_BSLS, KC_GRV,
  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_BSPC,
  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_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT, MO(_FN),
  KC_LCTL, KC_LGUI, KC_LALT,                            KC_SPC,                             KC_RALT, KC_RGUI, KC_RCTL),

[_FN] = LAYOUT(
  RESET,   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  KC_INS,  KC_DEL,
  KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP,   _______, _______,
  _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_MPLY, _______, _______, _______, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______,
  _______, _______, _______, _______, _______, _______, _______, _______, KC_END,  KC_PGDN, KC_DOWN, _______, _______,
  _______, _______, _______,                            _______,                            _______, _______, _______)
};

A keyboards/compound/keymaps/via/keymap.c => keyboards/compound/keymaps/via/keymap.c +49 -0
@@ 0,0 1,49 @@
/*
Copyright 2021 Rafael Yumagulov

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(
  KC_ESC,  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_BSLS, KC_GRV,
  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_BSPC,
  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_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT, MO(1),
  KC_LCTL, KC_LGUI, KC_LALT,                            KC_SPC,                             KC_RALT, KC_RGUI, KC_RCTL),

[1] = LAYOUT(
  RESET,   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  KC_INS,  KC_DEL,
  KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP,   _______, _______,
  _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_MPLY, _______, _______, _______, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______,
  _______, _______, _______, _______, _______, _______, _______, _______, KC_END,  KC_PGDN, KC_DOWN, _______, _______,
  _______, _______, _______,                            _______,                            _______, _______, _______),

[2] = LAYOUT(
  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  _______, _______, _______,                            _______,                            _______, _______, _______),

[3] = LAYOUT(
  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  _______, _______, _______,                            _______,                            _______, _______, _______),
};

A keyboards/compound/keymaps/via/rules.mk => keyboards/compound/keymaps/via/rules.mk +1 -0
@@ 0,0 1,1 @@
VIA_ENABLE = yes

A keyboards/compound/readme.md => keyboards/compound/readme.md +30 -0
@@ 0,0 1,30 @@
# Compound

![Compound](https://imgur.com/0DC9F9dh.jpg)

A compact 60% Compound keyboard with fixed Tsangan style layout.

* Keyboard Maintainer: [yumagulovrn](https://github.com/yumagulovrn)  
* Hardware Supported: Compound PCB
* Hardware Availability: [GeekHack IC](https://geekhack.org/index.php?topic=111187.0)

## Entering bootloader mode

Keyboard doesn't have dedicated RESET button on the PCB, however, there are alternatives:

### Bootmagic

Hold down ESC while plugging the keyboard in.

### Shorting RESET pin

Short GND and RST pads on the bottom of the keyboard. Location of the pads can be seen [here](https://imgur.com/uw7Zz7Y.jpg).


## Building keyboard firmware

Make example for this keyboard (after setting up your build environment):

    make compound: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/compound/rules.mk => keyboards/compound/rules.mk +22 -0
@@ 0,0 1,22 @@
# 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 = no        # 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 = no       # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no       # Enable Bluetooth
AUDIO_ENABLE = no           # Audio output