From b531bd3b04e99e2a46004114997aa791d2699466 Mon Sep 17 00:00:00 2001 From: vattern Date: Thu, 6 Aug 2020 23:18:34 +0100 Subject: [PATCH] [Keyboard] Add new "stoutgat" keyboard (#9837) * Add new "stoutgat" keyboard Add new 65% ISO keyboard "stoutgat" with dual encoders * Apply suggestions from code review * Update readme with information about the keyboard * Fix erroneous trailing comma in info.json * Fix layout bits for qmk info * Update keyboards/stoutgat/info.json * Update keyboards/stoutgat/stoutgat.h * Fix keymap and macro after updates * Apply suggestions from code review * Update keyboards/stoutgat/info.json * Update keyboards/stoutgat/keymaps/default/keymap.c * Update keyboards/stoutgat/info.json * Update keyboards/stoutgat/readme.md * Fix encoder volume bug * Adding 65_iso and 65_ansi layouts * Update keyboards/stoutgat/config.h * Update keyboards/stoutgat/rules.mk --- keyboards/stoutgat/config.h | 43 ++++++++++ keyboards/stoutgat/info.json | 89 ++++++++++++++++++++ keyboards/stoutgat/keymaps/default/keymap.c | 77 +++++++++++++++++ keyboards/stoutgat/keymaps/default/readme.md | 1 + keyboards/stoutgat/readme.md | 16 ++++ keyboards/stoutgat/rules.mk | 27 ++++++ keyboards/stoutgat/stoutgat.c | 17 ++++ keyboards/stoutgat/stoutgat.h | 71 ++++++++++++++++ 8 files changed, 341 insertions(+) create mode 100644 keyboards/stoutgat/config.h create mode 100644 keyboards/stoutgat/info.json create mode 100644 keyboards/stoutgat/keymaps/default/keymap.c create mode 100644 keyboards/stoutgat/keymaps/default/readme.md create mode 100644 keyboards/stoutgat/readme.md create mode 100644 keyboards/stoutgat/rules.mk create mode 100644 keyboards/stoutgat/stoutgat.c create mode 100644 keyboards/stoutgat/stoutgat.h diff --git a/keyboards/stoutgat/config.h b/keyboards/stoutgat/config.h new file mode 100644 index 0000000000..2c60e8b565 --- /dev/null +++ b/keyboards/stoutgat/config.h @@ -0,0 +1,43 @@ +/*Copyright 2020 Thys de Wet + +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" + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x7811 +#define DEVICE_VER 0x0001 +#define MANUFACTURER TKW +#define PRODUCT stoutgat + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 +#define TAP_CODE_DELAY 10 + +#define MATRIX_ROW_PINS { D1, D0, A0, A1, A2 } +#define MATRIX_COL_PINS { D6, D5, D7, C0, C1, C2, C3, C4, C5, C6, C7, A7, A6, A5, A4 } +#define ENCODERS_PAD_A { B4, B0 } +#define ENCODERS_PAD_B { B3, B1 } + +#define UNUSED_PINS + +#define DIODE_DIRECTION COL2ROW + +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION diff --git a/keyboards/stoutgat/info.json b/keyboards/stoutgat/info.json new file mode 100644 index 0000000000..f66a54152d --- /dev/null +++ b/keyboards/stoutgat/info.json @@ -0,0 +1,89 @@ +{ + "keyboard_name": "stoutgat", + "url": "https://github.com/vattern/stoutgat", + "maintainer": "vattern", + "width": 16, + "height": 6, + "layouts": { + "LAYOUT_encoder": { + "layout": [ + {"x": 1,"y": 0}, + {"x": 14,"y": 0}, + + {"x": 0, "y": 1}, + {"x": 1, "y": 1}, + {"x": 2, "y": 1}, + {"x": 3, "y": 1}, + {"x": 4, "y": 1}, + {"x": 5, "y": 1}, + {"x": 6, "y": 1}, + {"x": 7, "y": 1}, + {"x": 8, "y": 1}, + {"x": 9, "y": 1}, + {"x": 10, "y": 1}, + {"x": 11, "y": 1}, + {"x": 12, "y": 1}, + {"x": 13, "y": 1, "w": 2}, + {"x": 15, "y": 1}, + + {"x": 0, "y": 2, "w": 1.5}, + {"x": 1.5, "y": 2}, + {"x": 2.5, "y": 2}, + {"x": 3.5, "y": 2}, + {"x": 4.5, "y": 2}, + {"x": 5.5, "y": 2}, + {"x": 6.5, "y": 2}, + {"x": 7.5, "y": 2}, + {"x": 8.5, "y": 2}, + {"x": 9.5, "y": 2}, + {"x": 10.5, "y": 2}, + {"x": 11.5, "y": 2}, + {"x": 12.5, "y": 2}, + {"x": 15, "y": 2}, + + {"x": 0, "y": 3, "w": 1.75}, + {"x": 1.75, "y": 3}, + {"x": 2.75, "y": 3}, + {"x": 3.75, "y": 3}, + {"x": 4.75, "y": 3}, + {"x": 5.75, "y": 3}, + {"x": 6.75, "y": 3}, + {"x": 7.75, "y": 3}, + {"x": 8.75, "y": 3}, + {"x": 9.75, "y": 3}, + {"x": 10.75, "y": 3}, + {"x": 11.75, "y": 3}, + {"x": 12.75, "y": 3}, + {"x": 13.75, "y": 2, "w": 1.25, "h": 2}, + {"x": 15, "y": 3}, + + {"x": 0, "y": 4, "w": 1.25}, + {"x": 1.25, "y": 4}, + {"x": 2.25, "y": 4}, + {"x": 3.25, "y": 4}, + {"x": 4.25, "y": 4}, + {"x": 5.25, "y": 4}, + {"x": 6.25, "y": 4}, + {"x": 7.25, "y": 4}, + {"x": 8.25, "y": 4}, + {"x": 9.25, "y": 4}, + {"x": 10.25, "y": 4}, + {"x": 11.25, "y": 4}, + {"x": 12.25, "y": 4, "w": 1.75}, + {"x": 14, "y": 4}, + {"x": 15, "y": 4}, + + {"x": 0, "y": 5, "w": 1.25}, + {"x": 1.25, "y": 5, "w": 1.25}, + {"x": 2.5, "y": 5, "w": 1.25}, + {"x": 3.75, "y": 5, "w": 6.25}, + {"x": 10, "y": 5}, + {"x": 11, "y": 5}, + {"x": 12, "y": 5}, + {"x": 13, "y": 5}, + {"x": 14, "y": 5}, + {"x": 15, "y": 5} + ] + } + } +} diff --git a/keyboards/stoutgat/keymaps/default/keymap.c b/keyboards/stoutgat/keymaps/default/keymap.c new file mode 100644 index 0000000000..bf9d905843 --- /dev/null +++ b/keyboards/stoutgat/keymaps/default/keymap.c @@ -0,0 +1,77 @@ +#include QMK_KEYBOARD_H + +#define _BL 0 +#define _FL 1 + + + + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_encoder( + KC_MPLY,KC_ESC, + KC_GESC, 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_BSPC, 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_DEL, + 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_NUHS, KC_ENT, KC_PGUP, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC ,KC_RALT, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT), + + [1] = LAYOUT_encoder( + KC_MPLY,KC_ESC, + /* esc 1 2 3 4 5 6 7 8 9 0 - = bkspc `~ */ + KC_GRV, 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_DEL, KC_PSCR, + /* tab Q W E R T Y U I O P [ ] delete*/ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS,KC_TRNS,KC_TRNS,KC_INS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAUS, KC_TRNS, + /* caps A S D F G H J K L ; ' # enter pg up*/ + 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_INS, KC_TRNS, KC_HOME, + /* shift \ Z X C V B N M , . / shift up pg dn*/ + KC_LSFT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_RSFT, KC_VOLU, KC_END, + /* ctrl win alt space alt fn ctrl left down right*/ + KC_LCTL, KC_LGUI, KC_LALT, KC_TRNS, KC_RALT, KC_TRNS, KC_RCTL, KC_TRNS, KC_VOLD, KC_TRNS) + }; + + + + +#ifdef ENCODER_ENABLE +void encoder_update_user(uint8_t index, bool clockwise) { + + if (index == 0) { + switch (get_highest_layer(layer_state)) { + case _BL: + // Move whole words. Hold shift to select while moving. + if (clockwise) { + tap_code16(C(KC_RGHT)); + } else { + tap_code16(C(KC_LEFT)); + } + break; + default: + // History scrubbing. For Adobe products, hold shift while moving + // backward to go forward instead. + if (clockwise) { + tap_code16(C(KC_Z)); + } else { + tap_code16(C(KC_Y)); + } + break; + } + } else if (index == 1) { + switch (get_highest_layer(layer_state)) { + case _BL: + // Scrolling with PageUp and PgDn. + if (clockwise) { + tap_code16(KC_PGDN); + } else { + tap_code16(KC_PGUP); + } + break; + default: + if (clockwise) { + tap_code16(KC_VOLU); + } else { + tap_code16(KC_VOLD); + } + break; + } + } +} +#endif diff --git a/keyboards/stoutgat/keymaps/default/readme.md b/keyboards/stoutgat/keymaps/default/readme.md new file mode 100644 index 0000000000..1985507354 --- /dev/null +++ b/keyboards/stoutgat/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for stoutgat diff --git a/keyboards/stoutgat/readme.md b/keyboards/stoutgat/readme.md new file mode 100644 index 0000000000..13953e2319 --- /dev/null +++ b/keyboards/stoutgat/readme.md @@ -0,0 +1,16 @@ +# stoutgat + +![stoutgat](https://i.imgur.com/CfWa5AGl.jpg?1) + +An ISO through hole component 65% keyboard with dual encoders. Uses the ATMega32A. +Inspired by the cftkb Discipline. + +* Keyboard Maintainer: [Thys de Wet](https://github.com/vattern) +* Hardware Supported: Stoutgat PCBs , running ATMega32A +* Hardware Availability: https://github.com/vattern/stoutgat + +Make example for this keyboard (after setting up your build environment): + + make stoutgat: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/stoutgat/rules.mk b/keyboards/stoutgat/rules.mk new file mode 100644 index 0000000000..a9b6c4fc30 --- /dev/null +++ b/keyboards/stoutgat/rules.mk @@ -0,0 +1,27 @@ +# MCU name +MCU = atmega32a + +# Processor frequency +F_CPU = 16000000 + +# Bootloader selection +BOOTLOADER = USBasp + +# 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 = 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 +ENCODER_ENABLE = yes +LAYOUTS = 65_iso 65_ansi diff --git a/keyboards/stoutgat/stoutgat.c b/keyboards/stoutgat/stoutgat.c new file mode 100644 index 0000000000..10c82fd9f9 --- /dev/null +++ b/keyboards/stoutgat/stoutgat.c @@ -0,0 +1,17 @@ +/* Copyright 2020 Thys de Wet + * + * 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 diff --git a/keyboards/stoutgat/stoutgat.h b/keyboards/stoutgat/stoutgat.h new file mode 100644 index 0000000000..7c8c715748 --- /dev/null +++ b/keyboards/stoutgat/stoutgat.h @@ -0,0 +1,71 @@ +/* Copyright 2020 Thys de Wet + * + * 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 _x_ KC_NO + +/* 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 LAYOUT_encoder( \ + K44, K48, \ + 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, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K1D, K2E, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ + K40, K41, K42, K46, K49, K4A, K4B, K4C, K4D, K4E \ +) { \ +{ 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, K1E }, \ +{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, _x_, K2D, K2E }, \ +{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ +{ K40, K41, K42, _x_, K44, _x_, K46, _x_, K48, K49, K4A, K4B, K4C, K4D, K4E } \ +} + +#define LAYOUT_65_iso( \ + 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, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K1D, K2E, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ + K40, K41, K42, K46, K49, K4A, K4B, K4C, K4D, K4E \ +) { \ +{ 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, K1E }, \ +{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, _x_, K2D, K2E }, \ +{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ +{ K40, K41, K42, _x_, _x_, _x_, K46, _x_, _x_, K49, K4A, K4B, K4C, K4D, K4E } \ +} + +#define LAYOUT_65_ansi( \ + 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, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K2E, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ + K40, K41, K42, K46, K49, K4A, K4B, K4C, K4D, K4E \ +) { \ +{ 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, K1E }, \ +{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, _x_, K2D, K2E }, \ +{ K30, _x_, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ +{ K40, K41, K42, _x_, _x_, _x_, K46, _x_, _x_, K49, K4A, K4B, K4C, K4D, K4E} \ +}