~ruther/qmk_firmware

a9b3c0a807e00e7279bb039abb5d5696ecd6d0c1 — halfenergized 5 years ago ac447d8
Adding TGR Tris/Tris CE Numpad (#9139)

* Add TGR Tris

* Update readme.md

* Update rules.mk

* Update keyboards/tgr/tris/keymaps/default/keymap.c

Co-authored-by: Joel Challis <git@zvecr.com>

* Update keyboards/tgr/tris/keymaps/via/keymap.c

Co-authored-by: Joel Challis <git@zvecr.com>

* Update keyboards/tgr/tris/keymaps/default/keymap.c

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Update keyboards/tgr/tris/keymaps/via/keymap.c

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Update keyboards/tgr/tris/tris.h

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Update keyboards/tgr/tris/info.json

Co-authored-by: Joel Challis <git@zvecr.com>

* update formatting

* Revert "update formatting"

This reverts commit ae2d6832673985a874f7f43d42bdb56679d851d6.

Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
A keyboards/tgr/tris/config.h => keyboards/tgr/tris/config.h +50 -0
@@ 0,0 1,50 @@
/*
Copyright 2020 halfenergized

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"

#define VENDOR_ID 0x5447  //TG
#define PRODUCT_ID 0x5452 //TR
#define DEVICE_VER 0x0001
#define MANUFACTURER TGR
#define PRODUCT Tris
#define DESCRIPTION Numpad by TGR

#define MATRIX_ROWS 6
#define MATRIX_COLS 4

#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5 }
#define MATRIX_COL_PINS { A3, A2, A1, A0 }

#define DIODE_DIRECTION COL2ROW
#define DEBOUNCE 5

#define BACKLIGHT_PIN D4
#define BACKLIGHT_LEVELS 3

#define RGBLED_NUM 6
#define RGBLIGHT_ANIMATIONS

/* key combination for magic key command */
/* defined by default; to change, uncomment and set to the combination you want */
// #define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT)

/* Bootmagic Lite key configuration */
// #define BOOTMAGIC_LITE_ROW 0
// #define BOOTMAGIC_LITE_COLUMN 0

A keyboards/tgr/tris/info.json => keyboards/tgr/tris/info.json +16 -0
@@ 0,0 1,16 @@
{
    "keyboard_name": "TGR Tris",
    "url": "",
    "maintainer": "halfenergized",
    "width": 4,
    "height": 6,
    "layouts": {
        "LAYOUT_ortho_6x4": {
            "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":0, "y":1.25}, {"x":1, "y":1.25}, {"x":2, "y":1.25}, {"x":3, "y":1.25}, {"x":0, "y":2.25}, {"x":1, "y":2.25}, {"x":2, "y":2.25}, {"x":3, "y":2.25}, {"x":0, "y":3.25}, {"x":1, "y":3.25}, {"x":2, "y":3.25}, {"x":3, "y":3.25}, {"x":0, "y":4.25}, {"x":1, "y":4.25}, {"x":2, "y":4.25}, {"x":3, "y":4.25}, {"x":0, "y":5.25}, {"x":1, "y":5.25}, {"x":2, "y":5.25}, {"x":3, "y":5.25}]
        },

        "LAYOUT_numpad_6x4": {
            "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":0, "y":1.25}, {"x":1, "y":1.25}, {"x":2, "y":1.25}, {"x":3, "y":1.25}, {"x":0, "y":2.25}, {"x":1, "y":2.25}, {"x":2, "y":2.25}, {"x":0, "y":3.25}, {"x":1, "y":3.25}, {"x":2, "y":3.25}, {"x":3, "y":2.25, "h":2}, {"x":0, "y":4.25}, {"x":1, "y":4.25}, {"x":2, "y":4.25}, {"x":0, "y":5.25, "w":2}, {"x":2, "y":5.25}, {"x":3, "y":4.25, "h":2}]
        }
    }
}

A keyboards/tgr/tris/keymaps/default/keymap.c => keyboards/tgr/tris/keymaps/default/keymap.c +47 -0
@@ 0,0 1,47 @@
/* Copyright 2020 halfenergized
 *
 * 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_numpad_6x4(
        KC_ESC,  KC_TAB,  MO(1),   KC_BSPC,
        KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
        KC_P7,   KC_P8,   KC_P9,
        KC_P4,   KC_P5,   KC_P6,   KC_PPLS,
        KC_P1,   KC_P2,   KC_P3,
        KC_P0,            KC_PDOT, KC_PENT
    ),

    [1] = LAYOUT_numpad_6x4(
        KC_TRNS,   KC_TRNS, KC_TRNS, MO(2),
        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
        KC_HOME, KC_UP,   KC_PGUP,
        KC_LEFT, KC_TRNS, KC_RGHT, KC_TRNS,
        KC_END,  KC_DOWN, KC_PGDN,
        KC_INS,           KC_DEL,  KC_TRNS
    ),

    [2] = LAYOUT_numpad_6x4(
        RESET,   KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS,          KC_TRNS, KC_TRNS
    )
};

A keyboards/tgr/tris/keymaps/default/readme.md => keyboards/tgr/tris/keymaps/default/readme.md +1 -0
@@ 0,0 1,1 @@
# The default keymap for tris

A keyboards/tgr/tris/keymaps/via/keymap.c => keyboards/tgr/tris/keymaps/via/keymap.c +57 -0
@@ 0,0 1,57 @@
/* Copyright 2020 halfenergized
 *
 * 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_numpad_6x4(
        KC_ESC,  KC_TAB,  MO(1),   KC_BSPC,
        KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
        KC_P7,   KC_P8,   KC_P9,
        KC_P4,   KC_P5,   KC_P6,   KC_PPLS,
        KC_P1,   KC_P2,   KC_P3,
        KC_P0,            KC_PDOT, KC_PENT
    ),

    [1] = LAYOUT_numpad_6x4(
        KC_TRNS,   KC_TRNS, KC_TRNS, MO(2),
        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
        KC_HOME, KC_UP,   KC_PGUP,
        KC_LEFT, KC_TRNS, KC_RGHT, KC_TRNS,
        KC_END,  KC_DOWN, KC_PGDN,
        KC_INS,           KC_DEL,  KC_TRNS
    ),

    [2] = LAYOUT_numpad_6x4(
        RESET,   KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS,          KC_TRNS, KC_TRNS
    ),

    [3] = LAYOUT_numpad_6x4(
        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS,
        KC_TRNS,          KC_TRNS, KC_TRNS
    )

};

A keyboards/tgr/tris/keymaps/via/rules.mk => keyboards/tgr/tris/keymaps/via/rules.mk +4 -0
@@ 0,0 1,4 @@
VIA_ENABLE = yes
LTO_ENABLE = yes

EXTRAKEY_ENABLE = no

A keyboards/tgr/tris/readme.md => keyboards/tgr/tris/readme.md +19 -0
@@ 0,0 1,19 @@
# TGR Tris/Tris CE

A short description of the keyboard/project

* Keyboard Maintainer: [poisonking](https://github.com/halfenergized)
* Hardware Supported: Tris PCB
* Hardware Availability: https://geekhack.org/index.php?topic=86221.0

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

    make tris:default

Flashing example for this keyboard ([after setting up the bootloadHID flashing environment](https://docs.qmk.fm/#/flashing_bootloadhid))

    make tris:default:flash

**Reset Key**: Hold down the key located at top right position, while plugging in the keyboard.

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/tgr/tris/rules.mk => keyboards/tgr/tris/rules.mk +26 -0
@@ 0,0 1,26 @@
# MCU name
MCU = atmega32a

# Bootloader selection
#   Teensy       halfkay
#   Pro Micro    caterina
#   Atmel DFU    atmel-dfu
#   LUFA DFU     lufa-dfu
#   QMK DFU      qmk-dfu
#   ATmega32A    bootloadHID
#   ATmega328P   USBasp
BOOTLOADER = bootloadHID

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = no
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = no
COMMAND_ENABLE = yes
BACKLIGHT_ENABLE = yes
RGBLIGHT_ENABLE = yes
WS2812_DRIVER = i2c

LAYOUTS = numpad_6x4 ortho_6x4

A keyboards/tgr/tris/tris.c => keyboards/tgr/tris/tris.c +33 -0
@@ 0,0 1,33 @@
/* Copyright 2020 halfenergized
 *
 * 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 "tris.h"

void keyboard_pre_init_kb(void) {
    led_init_ports();
    keyboard_pre_init_user();
}

void led_init_ports(void) {
    setPinOutput(D0);
}

bool led_update_kb(led_t led_state) {
    if (led_update_user(led_state)) {
        writePin(D0, led_state.num_lock);
    }
    return true;
}

A keyboards/tgr/tris/tris.h => keyboards/tgr/tris/tris.h +63 -0
@@ 0,0 1,63 @@
/* Copyright 2020 halfenergized
 *
 * 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"

/* This is a shortcut to help you visually see your layout.
 *
 * The first section contains all of the arguments representing the physical
 * layout of the board and position of the keys.
 *
 * The second converts the arguments into a two-dimensional array which
 * represents the switch matrix.
 */
#define ___ KC_NO

#define LAYOUT_ortho_6x4( \
    k00, k01, k02, k03,  \
    k10, k11, k12, k13,  \
    k20, k21, k22, k23,  \
    k30, k31, k32, k33,  \
    k40, k41, k42, k43,  \
    k50, k51, k52, k53   \
)\
{ \
    { k00, k01, k02, k03 },  \
    { k10, k11, k12, k13 },  \
    { k20, k21, k22, k23 },  \
    { k30, k31, k32, k33 },  \
    { k40, k41, k42, k43 },  \
    { k50, k51, k52, k53 }   \
}

#define LAYOUT_numpad_6x4( \
    k00, k01, k02, k03, \
    k10, k11, k12, k13, \
    k20, k21, k22,      \
    k30, k31, k32, k33, \
    k40, k41, k42,      \
    k50,      k52, k43  \
) \
{ \
    { k00, k01, k02, k03 }, \
    { k10, k11, k12, k13 }, \
    { k20, k21, k22, ___ }, \
    { k30, k31, k32, k33 }, \
    { k40, k41, k42, k43 }, \
    { k50, ___, k52, ___ }  \
}