Merge pull request #540 from lesshonor/q3-2023-merge/refactor-builddefs

refactor: Vial builddefs
This commit is contained in:
xyzz 2023-09-09 23:23:16 -06:00 committed by GitHub
commit 385b1b289c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 79 additions and 259 deletions

36
builddefs/build_vial.mk Normal file
View File

@ -0,0 +1,36 @@
# Copyright 2023 Ilya Zhuravlev
# SPDX-License-Identifier: GPL-2.0-or-later
QMK_SETTINGS ?= yes
TAP_DANCE_ENABLE ?= yes
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
OPT_DEFS += -DTAPPING_TERM_PER_KEY
endif
COMBO_ENABLE ?= yes
KEY_OVERRIDE_ENABLE ?= yes
SRC += $(QUANTUM_DIR)/vial.c
OPT_DEFS += -DVIAL_ENABLE -DNO_DEBUG -DSERIAL_NUMBER=\"vial:f64c2b3c\"
ifeq ($(strip $(VIAL_INSECURE)), yes)
OPT_DEFS += -DVIAL_INSECURE
endif
ifeq ($(strip $(VIALRGB_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/vialrgb.c
OPT_DEFS += -DVIALRGB_ENABLE
endif
ifeq ($(strip $(QMK_SETTINGS)), yes)
AUTO_SHIFT_ENABLE := yes
SRC += $(QUANTUM_DIR)/qmk_settings.c
OPT_DEFS += -DQMK_SETTINGS \
-DAUTO_SHIFT_NO_SETUP -DAUTO_SHIFT_REPEAT_PER_KEY -DAUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY \
-DPERMISSIVE_HOLD_PER_KEY -DHOLD_ON_OTHER_KEY_PRESS_PER_KEY -DTAPPING_FORCE_HOLD_PER_KEY -DRETRO_TAPPING_PER_KEY \
-DCOMBO_TERM_PER_COMBO
endif
# Generate Vial layout definition header from JSON
$(QUANTUM_DIR)/vial.c: $(INTERMEDIATE_OUTPUT)/src/vial_generated_keyboard_definition.h
$(INTERMEDIATE_OUTPUT)/src/vial_generated_keyboard_definition.h: $(KEYMAP_PATH)/vial.json
python3 util/vial_generate_definition.py $(KEYMAP_PATH)/vial.json $(INTERMEDIATE_OUTPUT)/src/vial_generated_keyboard_definition.h

View File

@ -627,39 +627,7 @@ ifeq ($(strip $(VIA_ENABLE)), yes)
endif
ifeq ($(strip $(VIAL_ENABLE)), yes)
QMK_SETTINGS ?= yes
TAP_DANCE_ENABLE ?= yes
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
OPT_DEFS += -DTAPPING_TERM_PER_KEY
endif
COMBO_ENABLE ?= yes
KEY_OVERRIDE_ENABLE ?= yes
SRC += $(QUANTUM_DIR)/vial.c
EXTRAINCDIRS += $(INTERMEDIATE_OUTPUT)
OPT_DEFS += -DVIAL_ENABLE -DNO_DEBUG -DSERIAL_NUMBER=\"vial:f64c2b3c\"
$(QUANTUM_DIR)/vial.c: $(INTERMEDIATE_OUTPUT)/vial_generated_keyboard_definition.h
$(INTERMEDIATE_OUTPUT)/vial_generated_keyboard_definition.h: $(KEYMAP_PATH)/vial.json
python3 util/vial_generate_definition.py $(KEYMAP_PATH)/vial.json $(INTERMEDIATE_OUTPUT)/vial_generated_keyboard_definition.h
endif
ifeq ($(strip $(VIAL_INSECURE)), yes)
OPT_DEFS += -DVIAL_INSECURE
endif
ifeq ($(strip $(VIALRGB_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/vialrgb.c
OPT_DEFS += -DVIALRGB_ENABLE
endif
ifeq ($(strip $(QMK_SETTINGS)), yes)
AUTO_SHIFT_ENABLE := yes
SRC += $(QUANTUM_DIR)/qmk_settings.c
OPT_DEFS += -DQMK_SETTINGS \
-DAUTO_SHIFT_NO_SETUP -DAUTO_SHIFT_REPEAT_PER_KEY -DAUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY \
-DPERMISSIVE_HOLD_PER_KEY -DHOLD_ON_OTHER_KEY_PRESS_PER_KEY -DTAPPING_FORCE_HOLD_PER_KEY -DRETRO_TAPPING_PER_KEY \
-DCOMBO_TERM_PER_COMBO
include $(BUILDDEFS_PATH)/build_vial.mk
endif
VALID_MAGIC_TYPES := yes

View File

@ -0,0 +1,42 @@
/* Copyright 2021 Maxime Coirault, Don Kjer, Tyler Tidman
*
* 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
// Layer shorthand
enum _layer {
_BASE,
_FN
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_all( /* Base Layer */
KC_ESC, 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_PSCR, KC_SCRL, KC_PAUS,
KC_GRV, 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_INS, KC_HOME, KC_PGUP,
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_BSLS, KC_DEL, KC_END, KC_PGDN,
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_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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[_FN] = LAYOUT_all( /* Function Layer */
_______, KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, GUI_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
};

View File

@ -1,128 +0,0 @@
/* Copyright 2021 Maxime Coirault, Don Kjer, Tyler Tidman
*
* 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
// Layer shorthand
enum _layer {
_BASE,
_FN,
_LAYER3,
_LAYER4,
_LAYER5,
_LAYER6,
_LAYER7,
_LAYER8
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BASE: Base Layer (Default Layer)
*
* Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10F11F12 PScSlkPse
*
*
* ` 1 2 3 4 5 6 7 8 9 0 - = Backsp InsHomPgU Num / * -
*
* Tab Q W E R T Y U I O P [ ] \ DelEndPgD 7 8 9
* +
* Caps A S D F G H J K L ; ' # Entr 4 5 6
*
* Shft \ Z X C V B N M , . / Shift 1 2 3
* Ent
* CtrlGUI Alt AltFunc AppCtrl 0 .
*
*/
[_BASE] = LAYOUT_all( /* Base Layer */
KC_ESC, 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_PSCR, KC_SCRL, KC_PAUS,
KC_GRV, 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_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
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_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS,
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_P4, KC_P5, KC_P6,
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_P1, KC_P2, KC_P3, KC_PENT,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
),
/* Keymap _FN: Function Layer
*
* PlyStpPrvNxt MutVo+Vo-
*
*
*
*
*
*
*
*
*
*
* Lock Func Sys
*
*/
[_FN] = LAYOUT_all( /* Function Layer */
_______, KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_TGUI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_LAYER3] = LAYOUT_all( /* Layer 3 */
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_LAYER4] = LAYOUT_all( /* Layer 4 */
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_LAYER5] = LAYOUT_all( /* Layer 5 */
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_LAYER6] = LAYOUT_all( /* Layer 6 */
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_LAYER7] = LAYOUT_all( /* Layer 7 */
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_LAYER8] = LAYOUT_all( /* Layer 8 */
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
};

View File

@ -1,16 +0,0 @@
# The default keymap for Durgod Taurus K3X0 (K310, K320, etc.) without backlight
Supports both ANSI and ISO layouts.
Layer 0 : Standard layout (Windows)
Layer 1 : Media control and Windows lock key
- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7
- Fn + Windows to toggle Windows lock key functionality
## Windows key lock
You can hold down Fn + Windows key to disable the Windows key while in locked mode.
The 'Lock' LED indicates if the Windows key is locked.
This is similar to the stock K310/K320 Windows key lock functionality.

View File

@ -1,82 +0,0 @@
# K3X0 = K310, K320, etc.
This K3X0 code is shared between both the ANSI and ISO variants of both the
K310 full-sized 104/105-key and K320 TKL 87/88-key keyboards.
* Keyboard Maintainers: [dkjer](https://github.com/dkjer) and [tylert](https://github.com/tylert)
* Hardware Supported:
* [Durgod Taurus K310 with STM32F070RBT6](https://www.durgod.com/page9?product_id=53&_l=en "Taurus K310 Product Page | Durgod.com")
* [Durgod Taurus K320 with STM32F070RBT6](https://www.durgod.com/page9?product_id=47&_l=en "Taurus K320 Product Page | Durgod.com")
* Hardware Availability:
* [K310 on Amazon.com](https://www.amazon.com/Durgod-Taurus-K310-Mechanical-Keyboard/dp/B07TXB4XF3)
* [K320 on Amazon.com](https://www.amazon.com/Durgod-Taurus-Corona-Mechanical-Keyboard/dp/B078H3WPHM)
## Instructions
### Build
Instructions for building the K310 and K320 firmware can be found here:
* [K310](k310/readme.md)
* [K320](k320/readme.md)
### Initial Flash
#### Requirements
- The Durgod K320/K310 - different batches have different controllers, so when opening the keyboard, you will have to make sure it's using SMT32 controller.
- Another keyboard - when on bootloader mode, you can't use the keyboard to type and execute the commands (not really required if you can use any mouse interface to type and execute the commands).
- 2 prying tools - to open the keyboard.
- Another helping hand - it can be also done with just two hands, but it will require a lot of dexterity.
- A small cable with both ends cut.
#### Enter bootloader while using the original firmware
1. Unplug USB cable.
2. Open the keyboard case - there are plenty of youtube videos in that, but you will basically need 2 prying tools and a certain amount of force.
3. After opening the keyboard, put the PCB upsides down, and the controller should be near the LEDs, and make sure it's using the right controller (SMT32).
4. Use the cable to short Boot0 to Vdd, by shorting R21 to C27 on the sides closest to the processor, as shown:
<img src="https://i.imgur.com/hvDnw5a.jpg" width="520" height="693" alt="Shorting Boot0 to Vdd on K320">
5. While shorting both contacts as instructed in step 4, plug in the USB cable.
6. When the USB cable is fully inserted, the LEDs should not turn on and the keyboard it's not able to type, you are probably on bootloader mode, to be sure:
- Using dfu-util, it should show something like "Found DFU…" after using this command:
```
dfu-util --list
```
Now that you are sure to be in bootloader mode, you can backup the original firmware and flash QMK Firmware.
If it does not behave like described, remove the cable and go back to step 4.
#### Backup original firmware
1. Be in Bootloader mode.
2. Execute this command to backup:
- Using dfu-util:
```bash
dfu-util -a 0 -d 0483:DF11 -s 0x08000000 -U k3x0_original.bin
```
#### Flash the QMK Firmware Image
1. Be in Bootloader mode.
2. Here are a few options for performing the initial Flash:
- Using [QMK Toolbox](https://github.com/qmk/qmk_toolbox)
- Using qmk on command line:
```bash
# k310
qmk flash -kb durgod/k3x0/k310 -km default
# k320
qmk flash -kb durgod/k3x0/k320 -km default
```
### Subsequent Flashing
For repeating Flashing you can use BootMagic Lite has been enabled by default and assigned to the "Esc" key:
1. Unplug USB Cable.
2. Hold the "Esc" key.
2. Plug in the USB Cable, the Keyboard should be in ST-Bootloader state.