From dabbc93df47815c4df42696de220684edd05f873 Mon Sep 17 00:00:00 2001 From: David Hoelscher Date: Tue, 13 Jun 2023 01:32:54 -0500 Subject: [PATCH] [Keyboard] Add ErgoStrafer keyboard (#21195) --- keyboards/custommk/ergostrafer/config.h | 26 ++++++ keyboards/custommk/ergostrafer/halconf.h | 30 +++++++ keyboards/custommk/ergostrafer/info.json | 83 +++++++++++++++++++ .../ergostrafer/keymaps/default/keymap.c | 21 +++++ .../ergostrafer/keymaps/default/rules.mk | 1 + .../custommk/ergostrafer/keymaps/via/config.h | 13 +++ .../custommk/ergostrafer/keymaps/via/keymap.c | 21 +++++ .../custommk/ergostrafer/keymaps/via/rules.mk | 2 + keyboards/custommk/ergostrafer/mcuconf.h | 27 ++++++ keyboards/custommk/ergostrafer/readme.md | 27 ++++++ keyboards/custommk/ergostrafer/rules.mk | 3 + 11 files changed, 254 insertions(+) create mode 100644 keyboards/custommk/ergostrafer/config.h create mode 100644 keyboards/custommk/ergostrafer/halconf.h create mode 100644 keyboards/custommk/ergostrafer/info.json create mode 100644 keyboards/custommk/ergostrafer/keymaps/default/keymap.c create mode 100644 keyboards/custommk/ergostrafer/keymaps/default/rules.mk create mode 100644 keyboards/custommk/ergostrafer/keymaps/via/config.h create mode 100644 keyboards/custommk/ergostrafer/keymaps/via/keymap.c create mode 100644 keyboards/custommk/ergostrafer/keymaps/via/rules.mk create mode 100644 keyboards/custommk/ergostrafer/mcuconf.h create mode 100644 keyboards/custommk/ergostrafer/readme.md create mode 100644 keyboards/custommk/ergostrafer/rules.mk diff --git a/keyboards/custommk/ergostrafer/config.h b/keyboards/custommk/ergostrafer/config.h new file mode 100644 index 000000000000..c5a0ec75b575 --- /dev/null +++ b/keyboards/custommk/ergostrafer/config.h @@ -0,0 +1,26 @@ +// Copyright 2023 customMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +// FRAM configuration +#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN B7 +#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 4 // 48MHz / 4 = 12MHz; max supported by MB85R64 is 20MHz + +// SPI configuration +#define SPI_DRIVER SPID1 +#define SPI_SCK_PIN B3 +#define SPI_SCK_PAL_MODE 5 +#define SPI_MOSI_PIN B5 +#define SPI_MOSI_PAL_MODE 5 +#define SPI_MISO_PIN B4 +#define SPI_MISO_PAL_MODE 5 + +#define TAP_CODE_DELAY 10 + +// Audio configuration +#define AUDIO_PIN B8 +#define AUDIO_PWM_DRIVER PWMD4 +#define AUDIO_PWM_CHANNEL 3 +#define AUDIO_PWM_PAL_MODE 2 +#define AUDIO_STATE_TIMER GPTD5 \ No newline at end of file diff --git a/keyboards/custommk/ergostrafer/halconf.h b/keyboards/custommk/ergostrafer/halconf.h new file mode 100644 index 000000000000..aed037ba2a49 --- /dev/null +++ b/keyboards/custommk/ergostrafer/halconf.h @@ -0,0 +1,30 @@ +/* Copyright 2023 customMK + * + * 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 + +#define HAL_USE_PWM TRUE + +#define HAL_USE_SPI TRUE + +#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD + +#define SERIAL_BUFFERS_SIZE 256 + +// This enables interrupt-driven mode +#define SPI_USE_WAIT TRUE + +#include_next diff --git a/keyboards/custommk/ergostrafer/info.json b/keyboards/custommk/ergostrafer/info.json new file mode 100644 index 000000000000..66f1562fd986 --- /dev/null +++ b/keyboards/custommk/ergostrafer/info.json @@ -0,0 +1,83 @@ +{ + "manufacturer": "customMK", + "keyboard_name": "ErgoStrafer", + "maintainer": "customMK", + "bootloader": "stm32-dfu", + "diode_direction": "ROW2COL", + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true, + "encoder": true, + "audio": true + }, + "matrix_pins": { + "cols": ["B0", "A1", "A2", "A3", "A6", "B6", "B10"], + "rows": ["C13", "C14", "C15", "B1", "A7", "A5"] + }, + "processor": "STM32F411", + "url": "https://shop.custommk.com/collections/ergostrafer/products/ergostrafer", + "usb": { + "device_version": "1.0.0", + "pid": "0xFAB8", + "vid": "0xF35B" + }, + "layouts": { + "LAYOUT": { + "layout": [ + { "matrix": [0, 0], "label":"F9", "x":7.5, "y":0 }, + { "matrix": [0, 1], "label":"7", "x":1.5, "y":1.25 }, + { "matrix": [0, 2], "label":"8", "x":2.5, "y":1.25 }, + { "matrix": [0, 3], "label":"9", "x":3.5, "y":1.25 }, + { "matrix": [0, 4], "label":"0", "x":4.5, "y":1.25 }, + { "matrix": [0, 5], "label":"-", "x":5.5, "y":1.25 }, + { "matrix": [0, 6], "label":"T", "x":7.25, "y":3.25, "w":1.5 }, + + { "matrix": [1, 0], "label":"PrtScr", "x":7.5, "y":1 }, + { "matrix": [1, 1], "label":"1", "x":1, "y":2.25 }, + { "matrix": [1, 2], "label":"2", "x":2, "y":2.25 }, + { "matrix": [1, 3], "label":"3", "x":3, "y":2.25 }, + { "matrix": [1, 4], "label":"5", "x":5, "y":2.25 }, + { "matrix": [1, 5], "label":"6", "x":6, "y":2.25 }, + { "matrix": [1, 6], "label":"G", "x":7.25, "y":4.25, "w":1.5 }, + + { "matrix": [2, 0], "label":"F5", "x":7.5, "y":2 }, + { "matrix": [2, 1], "label":"Tab", "x":1, "y":3.5 }, + { "matrix": [2, 2], "label":"Q", "x":2.5, "y":3.4 }, + { "matrix": [2, 3], "label":"4", "x":4, "y":2.25 }, + { "matrix": [2, 4], "label":"E", "x":4.5, "y":3.4 }, + { "matrix": [2, 5], "label":"R", "x":6, "y":3.3 }, + { "matrix": [2, 6], "label":"B", "x":6.5, "y":5.75, "w":1.5 }, + + { "matrix": [3, 0], "label":"Caps Lock", "x":0, "y":3.5 }, + { "matrix": [3, 1], "label":"L Alt", "x":0.25, "y":4.75, "w":1.5 }, + { "matrix": [3, 2], "label":"A", "x":2.5, "y":4.5 }, + { "matrix": [3, 3], "label":"W", "x":3.5, "y":3.4 }, + { "matrix": [3, 4], "label":"D", "x":4.5, "y":4.5 }, + { "matrix": [3, 5], "label":"F", "x":6, "y":4.3 }, + { "matrix": [3, 6], "label":"P", "x":8, "y":5.75 }, + + { "matrix": [4, 1], "label":"L Shift", "x":0.25, "y":5.75, "w":1.5 }, + { "matrix": [4, 2], "label":"Z", "x":2.5, "y":5.6 }, + { "matrix": [4, 3], "label":"S", "x":3.5, "y":4.5 }, + { "matrix": [4, 5], "label":"V", "x":5, "y":5.75, "w":1.5 }, + { "matrix": [4, 6], "label":"Space", "x":6.5, "y":6.85, "w":1.75 } + + { "matrix": [5, 1], "label":"L Ctrl Duck", "x":0.25, "y":6.75, "w":1.5 }, + { "matrix": [5, 3], "label":"X", "x":3.5, "y":5.6 }, + { "matrix": [5, 5], "label":"C", "x":4.75, "y":6.85, "w":1.75 }, + { "matrix": [5, 6], "label":"L Ctrl", "x":9.5, "y":5.75 } + ] + } + }, + "encoder": { + "rotary": [ + { "pin_a": "A8", "pin_b": "A4"}, + { "pin_a": "B12", "pin_b": "B14"}, + { "pin_a": "B15", "pin_b": "A15"} + ] + } +} \ No newline at end of file diff --git a/keyboards/custommk/ergostrafer/keymaps/default/keymap.c b/keyboards/custommk/ergostrafer/keymaps/default/keymap.c new file mode 100644 index 000000000000..31ceb4f1e698 --- /dev/null +++ b/keyboards/custommk/ergostrafer/keymaps/default/keymap.c @@ -0,0 +1,21 @@ +// Copyright 2023 customMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_F9, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_T, + KC_PSCR, KC_1, KC_2, KC_3, KC_5, KC_6, KC_G, + KC_F5, KC_TAB, KC_Q, KC_4, KC_E, KC_R, KC_B, + KC_CAPS, KC_LALT, KC_A, KC_W, KC_D, KC_F, KC_P, + KC_LSFT, KC_Z, KC_S, KC_V, KC_SPC, + KC_LCTL, KC_X, KC_C, KC_LCTL + ) +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) } +}; +#endif \ No newline at end of file diff --git a/keyboards/custommk/ergostrafer/keymaps/default/rules.mk b/keyboards/custommk/ergostrafer/keymaps/default/rules.mk new file mode 100644 index 000000000000..a40474b4d5c7 --- /dev/null +++ b/keyboards/custommk/ergostrafer/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes \ No newline at end of file diff --git a/keyboards/custommk/ergostrafer/keymaps/via/config.h b/keyboards/custommk/ergostrafer/keymaps/via/config.h new file mode 100644 index 000000000000..81f399d46ba6 --- /dev/null +++ b/keyboards/custommk/ergostrafer/keymaps/via/config.h @@ -0,0 +1,13 @@ +// Copyright 2023 customMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +// With 8k FRAM, max out dynamic keymap layers and macros +// 7x6 matrix (84 bytes) and three encoders (12 bytes) consume 96 bytes per layer +// 32 layers consumes 3072 bytes +#define DYNAMIC_KEYMAP_LAYER_COUNT 32 + +// Most of the remaining space can be used for macros +// QMK Macro keycode range allows up to 128 macros +#define DYNAMIC_KEYMAP_MACRO_COUNT 128 diff --git a/keyboards/custommk/ergostrafer/keymaps/via/keymap.c b/keyboards/custommk/ergostrafer/keymaps/via/keymap.c new file mode 100644 index 000000000000..68f1df1c26d3 --- /dev/null +++ b/keyboards/custommk/ergostrafer/keymaps/via/keymap.c @@ -0,0 +1,21 @@ +// Copyright 2023 customMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_F9, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_T, + KC_PSCR, KC_1, KC_2, KC_3, KC_5, KC_6, KC_G, + KC_F5, KC_TAB, KC_Q, KC_4, KC_E, KC_R, KC_B, + KC_CAPS, KC_LALT, KC_A, KC_W, KC_D, KC_F, KC_P, + KC_LSFT, KC_Z, KC_S, KC_V, KC_SPC, + KC_LCTL, KC_X, KC_C, KC_LCTL + ) +}; + +//#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) } +}; +//#endif \ No newline at end of file diff --git a/keyboards/custommk/ergostrafer/keymaps/via/rules.mk b/keyboards/custommk/ergostrafer/keymaps/via/rules.mk new file mode 100644 index 000000000000..4253f570f0bb --- /dev/null +++ b/keyboards/custommk/ergostrafer/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes \ No newline at end of file diff --git a/keyboards/custommk/ergostrafer/mcuconf.h b/keyboards/custommk/ergostrafer/mcuconf.h new file mode 100644 index 000000000000..160b94f786ec --- /dev/null +++ b/keyboards/custommk/ergostrafer/mcuconf.h @@ -0,0 +1,27 @@ +/* Copyright 2023 customMK + * + * 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_next + +// Used for audio +#undef STM32_PWM_USE_TIM4 +#define STM32_PWM_USE_TIM4 TRUE + +// Used for FRAM +#undef STM32_SPI_USE_SPI1 +#define STM32_SPI_USE_SPI1 TRUE \ No newline at end of file diff --git a/keyboards/custommk/ergostrafer/readme.md b/keyboards/custommk/ergostrafer/readme.md new file mode 100644 index 000000000000..dab089647ffc --- /dev/null +++ b/keyboards/custommk/ergostrafer/readme.md @@ -0,0 +1,27 @@ +# ergostrafer + +![ergostrafer](https://i.imgur.com/ncJgD3jh.jpeg) + +ErgoStrafer is a gaming mechanical keyboard that reproduces the layout of the discontinued SteelSeries Merc Stealth a.k.a. Zboard. + +* Keyboard Maintainer: [customMK](https://github.com/customMK) +* Hardware Supported: ErgoStrafer +* Hardware Availability: [customMK](https://shop.custommk.com/collections/ergostrafer/products/ergostrafer) + +Make example for this keyboard (after setting up your build environment): + + make custommk/ergostrafer:default + +Flashing example for this keyboard: + + make custommk/ergostrafer:default:flash + +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). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (the "Load" key in the top right corner) 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 `QK_BOOT` if it is available diff --git a/keyboards/custommk/ergostrafer/rules.mk b/keyboards/custommk/ergostrafer/rules.mk new file mode 100644 index 000000000000..ee519ea8b55b --- /dev/null +++ b/keyboards/custommk/ergostrafer/rules.mk @@ -0,0 +1,3 @@ +EEPROM_DRIVER = spi + +AUDIO_DRIVER = pwm_hardware