aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile13
-rwxr-xr-xbin/qmk3
-rw-r--r--build_json.mk2
-rw-r--r--build_keyboard.mk9
-rw-r--r--common_features.mk37
-rw-r--r--data/schemas/keyboard.jsonschema2
-rw-r--r--docs/feature_rgb_matrix.md2
-rw-r--r--docs/keycodes.md3
-rw-r--r--docs/one_shot_keys.md3
-rw-r--r--docs/ws2812_driver.md22
-rw-r--r--drivers/chibios/ws2812_pwm.c11
-rw-r--r--drivers/chibios/ws2812_spi.c45
-rw-r--r--drivers/oled/oled_driver.h4
-rw-r--r--keyboards/aeboards/ext65/rev2/config.h2
-rw-r--r--keyboards/aeboards/ext65/rev2/halconf.h2
-rw-r--r--keyboards/aeboards/ext65/rev2/mcuconf.h2
-rw-r--r--keyboards/cannonkeys/an_c/rules.mk2
-rw-r--r--keyboards/cannonkeys/chimera65/rules.mk2
-rw-r--r--keyboards/cannonkeys/instant60/rules.mk2
-rw-r--r--keyboards/cannonkeys/iron165/rules.mk2
-rw-r--r--keyboards/cannonkeys/satisfaction75/rules.mk2
-rw-r--r--keyboards/cannonkeys/savage65/rules.mk2
-rw-r--r--keyboards/cannonkeys/tmov2/rules.mk2
-rw-r--r--keyboards/cannonkeys/tsukuyomi/rules.mk2
-rw-r--r--keyboards/clueboard/66_hotswap/gen1/gen1.c2
-rw-r--r--keyboards/crkbd/rev1/common/config.h1
-rw-r--r--keyboards/crkbd/rev1/common/rules.mk1
-rw-r--r--keyboards/crkbd/rev1/rev1.c2
-rw-r--r--keyboards/daji/seis_cinco/rules.mk2
-rw-r--r--keyboards/durgod/boards/DURGOD_STM32_F070/board.h (renamed from keyboards/durgod/k320/board.h)1
-rw-r--r--keyboards/durgod/boards/DURGOD_STM32_F070/board.mk12
-rw-r--r--keyboards/durgod/boards/DURGOD_STM32_F070/bootloader_defs.h (renamed from keyboards/durgod/k320/bootloader_defs.h)0
-rw-r--r--keyboards/durgod/boards/DURGOD_STM32_F070/chconf.h (renamed from keyboards/durgod/k320/chconf.h)15
-rw-r--r--keyboards/durgod/boards/DURGOD_STM32_F070/mcuconf.h (renamed from keyboards/durgod/k320/mcuconf.h)0
-rw-r--r--keyboards/durgod/k320/config.h39
-rw-r--r--keyboards/durgod/k320/info.json1186
-rw-r--r--keyboards/durgod/k320/k320.c20
-rw-r--r--keyboards/durgod/k320/k320.h31
-rw-r--r--keyboards/durgod/k320/keymaps/default/keymap.c95
-rw-r--r--keyboards/durgod/k320/keymaps/default/keymap.json26
-rw-r--r--keyboards/durgod/k320/keymaps/default/readme.md4
-rw-r--r--keyboards/durgod/k320/keymaps/default_iso/keymap.c72
-rw-r--r--keyboards/durgod/k320/keymaps/default_iso/readme.md7
-rw-r--r--keyboards/durgod/k320/keymaps/default_iso_mac/keymap.c71
-rw-r--r--keyboards/durgod/k320/keymaps/default_iso_mac/readme.md6
-rw-r--r--keyboards/durgod/k320/keymaps/default_mac/keymap.json26
-rw-r--r--keyboards/durgod/k320/keymaps/default_mac/readme.md8
-rw-r--r--keyboards/durgod/k320/keymaps/default_toggle_mac_windows/keymap.c108
-rw-r--r--keyboards/durgod/k320/keymaps/default_toggle_mac_windows/readme.md7
-rw-r--r--keyboards/durgod/k320/keymaps/default_toggle_mac_windows/rules.mk1
-rw-r--r--keyboards/durgod/k320/keymaps/kuenhlee/keymap.c5
-rw-r--r--keyboards/durgod/k320/keymaps/via/keymap.c29
-rw-r--r--keyboards/durgod/k320/keymaps/via/readme.md2
-rw-r--r--keyboards/durgod/k320/keymaps/via/rules.mk2
-rw-r--r--keyboards/durgod/k320/readme.md5
-rw-r--r--keyboards/durgod/k320/rules.mk2
-rw-r--r--keyboards/handwired/ck4x4/rules.mk2
-rw-r--r--keyboards/handwired/onekey/rules.mk4
-rw-r--r--keyboards/projectkb/alice/config.h3
-rw-r--r--keyboards/projectkb/alice/halconf.h2
-rw-r--r--keyboards/projectkb/alice/mcuconf.h2
-rw-r--r--keyboards/projectkb/signature87/rules.mk2
-rw-r--r--keyboards/ramonimbao/wete/config.h2
-rw-r--r--keyboards/ramonimbao/wete/halconf.h2
-rw-r--r--keyboards/ramonimbao/wete/mcuconf.h2
-rw-r--r--keyboards/readme.md2
-rw-r--r--keyboards/rgbkb/zygomorph/keymaps/xulkal/rules.mk14
-rw-r--r--keyboards/rgbkb/zygomorph/rev1/config.h4
-rw-r--r--keyboards/rgbkb/zygomorph/rev1/rev1.c102
-rw-r--r--keyboards/terrazzo/terrazzo.c1
-rw-r--r--keyboards/westfoxtrot/prophet/config.h2
-rw-r--r--keyboards/westfoxtrot/prophet/halconf.h27
-rw-r--r--keyboards/westfoxtrot/prophet/mcuconf.h5
-rw-r--r--lib/python/qmk/commands.py1
-rw-r--r--lib/python/qmk/constants.py2
-rw-r--r--lib/python/qmk/tests/test_cli_commands.py4
-rw-r--r--quantum/bootmagic/bootmagic.h24
-rw-r--r--quantum/bootmagic/bootmagic_full.c (renamed from tmk_core/common/bootmagic.c)112
-rw-r--r--quantum/bootmagic/bootmagic_full.h (renamed from tmk_core/common/bootmagic.h)21
-rw-r--r--quantum/bootmagic/bootmagic_lite.c (renamed from tmk_core/common/bootmagic_lite.c)17
-rw-r--r--quantum/bootmagic/bootmagic_lite.h25
-rw-r--r--quantum/bootmagic/magic.c54
-rw-r--r--quantum/bootmagic/magic.h (renamed from keyboards/durgod/k320/keymaps/via/config.h)8
-rw-r--r--quantum/keycode_config.h1
-rw-r--r--quantum/led_matrix.c82
-rw-r--r--quantum/led_matrix.h7
-rw-r--r--quantum/led_matrix_drivers.c7
-rw-r--r--quantum/led_matrix_types.h27
-rw-r--r--quantum/mcu_selection.mk27
-rw-r--r--quantum/process_keycode/process_backlight.c29
-rw-r--r--quantum/quantum.c28
-rw-r--r--quantum/quantum.h55
-rw-r--r--quantum/quantum_keycodes.h14
-rw-r--r--quantum/rgb_matrix.c34
-rw-r--r--quantum/rgb_matrix_types.h9
-rw-r--r--quantum/split_common/split_util.c70
-rw-r--r--quantum/split_common/transport.c45
-rw-r--r--readme.md6
-rw-r--r--tmk_core/common.mk23
-rw-r--r--tmk_core/common/action_util.c58
-rw-r--r--tmk_core/common/action_util.h5
-rw-r--r--tmk_core/common/arm_atsam/_wait.h22
-rw-r--r--tmk_core/common/avr/_wait.h29
-rw-r--r--tmk_core/common/avr/suspend.c4
-rw-r--r--tmk_core/common/chibios/_wait.h55
-rw-r--r--tmk_core/common/chibios/bootloader.c2
-rw-r--r--tmk_core/common/chibios/chibios_config.h7
-rw-r--r--tmk_core/common/chibios/sleep_led.c88
-rw-r--r--tmk_core/common/chibios/suspend.c8
-rw-r--r--tmk_core/common/chibios/wait.c89
-rw-r--r--tmk_core/common/eeconfig.c2
-rw-r--r--tmk_core/common/eeconfig.h14
-rw-r--r--tmk_core/common/keyboard.c10
-rw-r--r--tmk_core/common/magic.c39
-rw-r--r--tmk_core/common/magic.h3
-rw-r--r--tmk_core/common/test/_wait.h22
-rw-r--r--tmk_core/common/usb_util.c29
-rw-r--r--tmk_core/common/usb_util.h22
-rw-r--r--tmk_core/common/wait.h125
-rw-r--r--tmk_core/protocol.mk4
-rw-r--r--tmk_core/protocol/chibios.mk1
-rw-r--r--tmk_core/protocol/chibios/usb_util.c21
-rw-r--r--tmk_core/protocol/lufa.mk1
-rw-r--r--tmk_core/protocol/lufa/usb_util.c34
-rw-r--r--tmk_core/protocol/vusb.mk1
-rw-r--r--tmk_core/protocol/vusb/usb_util.c24
126 files changed, 1704 insertions, 1891 deletions
diff --git a/Makefile b/Makefile
index 91ab9e4e8..80e1a90a1 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,13 @@ $(info QMK Firmware $(QMK_VERSION))
29endif 29endif
30endif 30endif
31 31
32# Determine which qmk cli to use
33ifeq (,$(shell which qmk))
34 QMK_BIN = bin/qmk
35else
36 QMK_BIN = qmk
37endif
38
32# avoid 'Entering|Leaving directory' messages 39# avoid 'Entering|Leaving directory' messages
33MAKEFLAGS += --no-print-directory 40MAKEFLAGS += --no-print-directory
34 41
@@ -384,7 +391,7 @@ define PARSE_KEYMAP
384 # Format it in bold 391 # Format it in bold
385 KB_SP := $(BOLD)$$(KB_SP)$(NO_COLOR) 392 KB_SP := $(BOLD)$$(KB_SP)$(NO_COLOR)
386 # Specify the variables that we are passing forward to submake 393 # Specify the variables that we are passing forward to submake
387 MAKE_VARS := KEYBOARD=$$(CURRENT_KB) KEYMAP=$$(CURRENT_KM) REQUIRE_PLATFORM_KEY=$$(REQUIRE_PLATFORM_KEY) 394 MAKE_VARS := KEYBOARD=$$(CURRENT_KB) KEYMAP=$$(CURRENT_KM) REQUIRE_PLATFORM_KEY=$$(REQUIRE_PLATFORM_KEY) QMK_BIN=$$(QMK_BIN)
388 # And the first part of the make command 395 # And the first part of the make command
389 MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_keyboard.mk $$(MAKE_TARGET) 396 MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_keyboard.mk $$(MAKE_TARGET)
390 # The message to display 397 # The message to display
@@ -501,8 +508,8 @@ endef
501%: 508%:
502 # Check if we have the CMP tool installed 509 # Check if we have the CMP tool installed
503 cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi; 510 cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi;
504 # Ensure that bin/qmk works. 511 # Ensure that $(QMK_BIN) works.
505 if ! bin/qmk hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; exit 1; fi 512 if ! $(QMK_BIN) hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; exit 1; fi
506 # Check if the submodules are dirty, and display a warning if they are 513 # Check if the submodules are dirty, and display a warning if they are
507ifndef SKIP_GIT 514ifndef SKIP_GIT
508 if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi 515 if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi
diff --git a/bin/qmk b/bin/qmk
index a3c1be328..a2af2951c 100755
--- a/bin/qmk
+++ b/bin/qmk
@@ -73,8 +73,11 @@ def main():
73 """ 73 """
74 # Change to the root of our checkout 74 # Change to the root of our checkout
75 os.environ['ORIG_CWD'] = os.getcwd() 75 os.environ['ORIG_CWD'] = os.getcwd()
76 os.environ['DEPRECATED_BIN_QMK'] = '1'
76 os.chdir(qmk_dir) 77 os.chdir(qmk_dir)
77 78
79 print('Warning: The bin/qmk script is being deprecated. Please install the QMK CLI: python3 -m pip install qmk', file=sys.stderr)
80
78 # Import the subcommands 81 # Import the subcommands
79 import qmk.cli # noqa 82 import qmk.cli # noqa
80 83
diff --git a/build_json.mk b/build_json.mk
index 6e2f9c4c8..8822be6a1 100644
--- a/build_json.mk
+++ b/build_json.mk
@@ -28,4 +28,4 @@ endif
28 28
29# Generate the keymap.c 29# Generate the keymap.c
30$(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON) 30$(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
31 bin/qmk json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON) 31 $(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON)
diff --git a/build_keyboard.mk b/build_keyboard.mk
index 366d1f5d2..74046a094 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -12,6 +12,9 @@ endif
12 12
13include common.mk 13include common.mk
14 14
15# Set the qmk cli to use
16QMK_BIN ?= qmk
17
15# Set the filename for the final firmware binary 18# Set the filename for the final firmware binary
16KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD)) 19KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
17TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP) 20TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
@@ -97,7 +100,7 @@ MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
97MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP) 100MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
98 101
99# Pull in rules from info.json 102# Pull in rules from info.json
100INFO_RULES_MK = $(shell bin/qmk generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk) 103INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk)
101include $(INFO_RULES_MK) 104include $(INFO_RULES_MK)
102 105
103# Check for keymap.json first, so we can regenerate keymap.c 106# Check for keymap.json first, so we can regenerate keymap.c
@@ -294,10 +297,10 @@ endif
294CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h 297CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
295 298
296$(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES) 299$(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES)
297 bin/qmk generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h 300 $(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h
298 301
299$(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES) 302$(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES)
300 bin/qmk generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h 303 $(QMK_BIN) generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h
301 304
302generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h 305generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
303 306
diff --git a/common_features.mk b/common_features.mk
index 8c9d0a90c..2e2991c64 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -223,14 +223,16 @@ VALID_LED_MATRIX_TYPES := IS31FL3731 custom
223 223
224ifeq ($(strip $(LED_MATRIX_ENABLE)), yes) 224ifeq ($(strip $(LED_MATRIX_ENABLE)), yes)
225 ifeq ($(filter $(LED_MATRIX_DRIVER),$(VALID_LED_MATRIX_TYPES)),) 225 ifeq ($(filter $(LED_MATRIX_DRIVER),$(VALID_LED_MATRIX_TYPES)),)
226 $(error LED_MATRIX_DRIVER="$(LED_MATRIX_DRIVER)" is not a valid matrix type) 226 $(error "$(LED_MATRIX_DRIVER)" is not a valid matrix type)
227 else
228 BACKLIGHT_ENABLE = yes
229 BACKLIGHT_DRIVER = custom
230 OPT_DEFS += -DLED_MATRIX_ENABLE
231 SRC += $(QUANTUM_DIR)/led_matrix.c
232 SRC += $(QUANTUM_DIR)/led_matrix_drivers.c
233 endif 227 endif
228 OPT_DEFS += -DLED_MATRIX_ENABLE
229ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 at90usb162))
230 # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines
231 OPT_DEFS += -DLIB8_ATTINY
232endif
233 SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
234 SRC += $(QUANTUM_DIR)/led_matrix.c
235 SRC += $(QUANTUM_DIR)/led_matrix_drivers.c
234 236
235 ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3731) 237 ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3731)
236 OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE 238 OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
@@ -422,10 +424,6 @@ ifeq ($(strip $(TERMINAL_ENABLE)), yes)
422 OPT_DEFS += -DUSER_PRINT 424 OPT_DEFS += -DUSER_PRINT
423endif 425endif
424 426
425ifeq ($(strip $(USB_HID_ENABLE)), yes)
426 include $(TMK_DIR)/protocol/usb_hid.mk
427endif
428
429ifeq ($(strip $(WPM_ENABLE)), yes) 427ifeq ($(strip $(WPM_ENABLE)), yes)
430 SRC += $(QUANTUM_DIR)/wpm.c 428 SRC += $(QUANTUM_DIR)/wpm.c
431 OPT_DEFS += -DWPM_ENABLE 429 OPT_DEFS += -DWPM_ENABLE
@@ -459,6 +457,23 @@ ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes)
459 SRC += $(QUANTUM_DIR)/dip_switch.c 457 SRC += $(QUANTUM_DIR)/dip_switch.c
460endif 458endif
461 459
460VALID_MAGIC_TYPES := yes full lite
461BOOTMAGIC_ENABLE ?= no
462ifneq ($(strip $(BOOTMAGIC_ENABLE)), no)
463 ifeq ($(filter $(BOOTMAGIC_ENABLE),$(VALID_MAGIC_TYPES)),)
464 $(error BOOTMAGIC_ENABLE="$(BOOTMAGIC_ENABLE)" is not a valid type of magic)
465 endif
466 ifeq ($(strip $(BOOTMAGIC_ENABLE)), lite)
467 OPT_DEFS += -DBOOTMAGIC_LITE
468 QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_lite.c
469 else
470 OPT_DEFS += -DBOOTMAGIC_ENABLE
471 QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_full.c
472 endif
473endif
474COMMON_VPATH += $(QUANTUM_DIR)/bootmagic
475QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/magic.c
476
462VALID_CUSTOM_MATRIX_TYPES:= yes lite no 477VALID_CUSTOM_MATRIX_TYPES:= yes lite no
463 478
464CUSTOM_MATRIX ?= no 479CUSTOM_MATRIX ?= no
diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema
index ec03a8828..3034242fd 100644
--- a/data/schemas/keyboard.jsonschema
+++ b/data/schemas/keyboard.jsonschema
@@ -25,7 +25,7 @@
25 }, 25 },
26 "processor": { 26 "processor": {
27 "type": "string", 27 "type": "string",
28 "enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F411", "STM32G431", "STM32G474", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"] 28 "enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK66F18", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F411", "STM32G431", "STM32G474", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"]
29 }, 29 },
30 "board": { 30 "board": {
31 "type": "string", 31 "type": "string",
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 6917de5ab..a83e1d2a2 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -441,6 +441,8 @@ These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blo
441#define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set 441#define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set
442#define RGB_MATRIX_STARTUP_SPD 127 // Sets the default animation speed, if none has been set 442#define RGB_MATRIX_STARTUP_SPD 127 // Sets the default animation speed, if none has been set
443#define RGB_MATRIX_DISABLE_KEYCODES // disables control of rgb matrix by keycodes (must use code functions to control the feature) 443#define RGB_MATRIX_DISABLE_KEYCODES // disables control of rgb matrix by keycodes (must use code functions to control the feature)
444#define RGB_MATRIX_SPLIT { X, Y } // (Optional) For split keyboards, the number of LEDs connected on each half. X = left, Y = Right.
445 // If RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is enabled, you also will want to enable SPLIT_TRANSPORT_MIRROR
444``` 446```
445 447
446## EEPROM storage :id=eeprom-storage 448## EEPROM storage :id=eeprom-storage
diff --git a/docs/keycodes.md b/docs/keycodes.md
index 9acf8b683..f3c519b13 100644
--- a/docs/keycodes.md
+++ b/docs/keycodes.md
@@ -516,6 +516,9 @@ See also: [One Shot Keys](one_shot_keys.md)
516|------------|----------------------------------| 516|------------|----------------------------------|
517|`OSM(mod)` |Hold `mod` for one keypress | 517|`OSM(mod)` |Hold `mod` for one keypress |
518|`OSL(layer)`|Switch to `layer` for one keypress| 518|`OSL(layer)`|Switch to `layer` for one keypress|
519|`OS_ON` |Turns One Shot keys on |
520|`OS_OFF` |Turns One Shot keys off |
521|`OS_TOGG` |Toggles One Shot keys status |
519 522
520## Space Cadet :id=space-cadet 523## Space Cadet :id=space-cadet
521 524
diff --git a/docs/one_shot_keys.md b/docs/one_shot_keys.md
index 9a082d7d6..9fc548629 100644
--- a/docs/one_shot_keys.md
+++ b/docs/one_shot_keys.md
@@ -17,6 +17,9 @@ You can control the behavior of one shot keys by defining these in `config.h`:
17 17
18* `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](mod_tap.md), not the `KC_*` codes. 18* `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](mod_tap.md), not the `KC_*` codes.
19* `OSL(layer)` - momentary switch to *layer*. 19* `OSL(layer)` - momentary switch to *layer*.
20* `OS_ON` - Turns on One Shot keys.
21* `OS_OFF` - Turns off One Shot keys. OSM act as regular mod keys, OSL act like `MO`.
22* `ON_TOGG` - Toggles the one shot key status.
20 23
21Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine. 24Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine.
22 25
diff --git a/docs/ws2812_driver.md b/docs/ws2812_driver.md
index cca6827ec..e69400364 100644
--- a/docs/ws2812_driver.md
+++ b/docs/ws2812_driver.md
@@ -77,6 +77,25 @@ Configure the hardware via your config.h:
77 77
78You must also turn on the SPI feature in your halconf.h and mcuconf.h 78You must also turn on the SPI feature in your halconf.h and mcuconf.h
79 79
80#### Circular Buffer Mode
81Some boards may flicker while in the normal buffer mode. To fix this issue, circular buffer mode may be used to rectify the issue.
82
83By default, the circular buffer mode is disabled.
84
85To enable this alternative buffer mode, place this into your `config.h` file:
86```c
87#define WS2812_SPI_USE_CIRCULAR_BUFFER
88```
89
90#### Setting baudrate with divisor
91To adjust the baudrate at which the SPI peripheral is configured, users will need to derive the target baudrate from the clock tree provided by STM32CubeMX.
92
93Only divisors of 2, 4, 8, 16, 32, 64, 128 and 256 are supported by hardware.
94
95|Define |Default|Description |
96|--------------------|-------|-------------------------------------|
97|`WS2812_SPI_DIVISOR`|`16` |SPI source clock peripheral divisor |
98
80#### Testing Notes 99#### Testing Notes
81 100
82While not an exhaustive list, the following table provides the scenarios that have been partially validated: 101While not an exhaustive list, the following table provides the scenarios that have been partially validated:
@@ -102,11 +121,14 @@ Configure the hardware via your config.h:
102#define WS2812_PWM_DRIVER PWMD2 // default: PWMD2 121#define WS2812_PWM_DRIVER PWMD2 // default: PWMD2
103#define WS2812_PWM_CHANNEL 2 // default: 2 122#define WS2812_PWM_CHANNEL 2 // default: 2
104#define WS2812_PWM_PAL_MODE 2 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2 123#define WS2812_PWM_PAL_MODE 2 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2
124//#define WS2812_PWM_COMPLEMENTARY_OUTPUT // Define for a complementary timer output (TIMx_CHyN); omit for a normal timer output (TIMx_CHy).
105#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. 125#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
106#define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. 126#define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
107#define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU. 127#define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU.
108``` 128```
109 129
130Note that using a complementary timer output (TIMx_CHyN) is possible only for advanced-control timers (TIM1, TIM8, TIM20 on STM32), and the `STM32_PWM_USE_ADVANCED` option in mcuconf.h must be set to `TRUE`. Complementary outputs of general-purpose timers are not supported due to ChibiOS limitations.
131
110You must also turn on the PWM feature in your halconf.h and mcuconf.h 132You must also turn on the PWM feature in your halconf.h and mcuconf.h
111 133
112#### Testing Notes 134#### Testing Notes
diff --git a/drivers/chibios/ws2812_pwm.c b/drivers/chibios/ws2812_pwm.c
index 140120d48..e6af55b6b 100644
--- a/drivers/chibios/ws2812_pwm.c
+++ b/drivers/chibios/ws2812_pwm.c
@@ -27,6 +27,15 @@
27# error "please consult your MCU's datasheet and specify in your config.h: #define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM?_UP" 27# error "please consult your MCU's datasheet and specify in your config.h: #define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM?_UP"
28#endif 28#endif
29 29
30#ifndef WS2812_PWM_COMPLEMENTARY_OUTPUT
31# define WS2812_PWM_OUTPUT_MODE PWM_OUTPUT_ACTIVE_HIGH
32#else
33# if !STM32_PWM_USE_ADVANCED
34# error "WS2812_PWM_COMPLEMENTARY_OUTPUT requires STM32_PWM_USE_ADVANCED == TRUE"
35# endif
36# define WS2812_PWM_OUTPUT_MODE PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH
37#endif
38
30// Push Pull or Open Drain Configuration 39// Push Pull or Open Drain Configuration
31// Default Push Pull 40// Default Push Pull
32#ifndef WS2812_EXTERNAL_PULLUP 41#ifndef WS2812_EXTERNAL_PULLUP
@@ -247,7 +256,7 @@ void ws2812_init(void) {
247 .channels = 256 .channels =
248 { 257 {
249 [0 ... 3] = {.mode = PWM_OUTPUT_DISABLED, .callback = NULL}, // Channels default to disabled 258 [0 ... 3] = {.mode = PWM_OUTPUT_DISABLED, .callback = NULL}, // Channels default to disabled
250 [WS2812_PWM_CHANNEL - 1] = {.mode = PWM_OUTPUT_ACTIVE_HIGH, .callback = NULL}, // Turn on the channel we care about 259 [WS2812_PWM_CHANNEL - 1] = {.mode = WS2812_PWM_OUTPUT_MODE, .callback = NULL}, // Turn on the channel we care about
251 }, 260 },
252 .cr2 = 0, 261 .cr2 = 0,
253 .dier = TIM_DIER_UDE, // DMA on update event for next period 262 .dier = TIM_DIER_UDE, // DMA on update event for next period
diff --git a/drivers/chibios/ws2812_spi.c b/drivers/chibios/ws2812_spi.c
index 89df2987b..e02cbabc0 100644
--- a/drivers/chibios/ws2812_spi.c
+++ b/drivers/chibios/ws2812_spi.c
@@ -32,6 +32,37 @@
32# endif 32# endif
33#endif 33#endif
34 34
35// Define SPI config speed
36// baudrate should target 3.2MHz
37// F072 fpclk = 48MHz
38// 48/16 = 3Mhz
39#if WS2812_SPI_DIVISOR == 2
40# define WS2812_SPI_DIVISOR (0)
41#elif WS2812_SPI_DIVISOR == 4
42# define WS2812_SPI_DIVISOR (SPI_CR1_BR_0)
43#elif WS2812_SPI_DIVISOR == 8
44# define WS2812_SPI_DIVISOR (SPI_CR1_BR_1)
45#elif WS2812_SPI_DIVISOR == 16 // same as default
46# define WS2812_SPI_DIVISOR (SPI_CR1_BR_1 | SPI_CR1_BR_0)
47#elif WS2812_SPI_DIVISOR == 32
48# define WS2812_SPI_DIVISOR (SPI_CR1_BR_2)
49#elif WS2812_SPI_DIVISOR == 64
50# define WS2812_SPI_DIVISOR (SPI_CR1_BR_2 | SPI_CR1_BR_0)
51#elif WS2812_SPI_DIVISOR == 128
52# define WS2812_SPI_DIVISOR (SPI_CR1_BR_2 | SPI_CR1_BR_1)
53#elif WS2812_SPI_DIVISOR == 256
54# define WS2812_SPI_DIVISOR (SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0)
55#else
56# define WS2812_SPI_DIVISOR (SPI_CR1_BR_1 | SPI_CR1_BR_0) // default
57#endif
58
59// Use SPI circular buffer
60#ifdef WS2812_SPI_USE_CIRCULAR_BUFFER
61# define WS2812_SPI_BUFFER_MODE 1 // circular buffer
62#else
63# define WS2812_SPI_BUFFER_MODE 0 // normal buffer
64#endif
65
35#define BYTES_FOR_LED_BYTE 4 66#define BYTES_FOR_LED_BYTE 4
36#define NB_COLORS 3 67#define NB_COLORS 3
37#define BYTES_FOR_LED (BYTES_FOR_LED_BYTE * NB_COLORS) 68#define BYTES_FOR_LED (BYTES_FOR_LED_BYTE * NB_COLORS)
@@ -81,14 +112,14 @@ void ws2812_init(void) {
81 palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE); 112 palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE);
82 113
83 // TODO: more dynamic baudrate 114 // TODO: more dynamic baudrate
84 static const SPIConfig spicfg = { 115 static const SPIConfig spicfg = {WS2812_SPI_BUFFER_MODE, NULL, PAL_PORT(RGB_DI_PIN), PAL_PAD(RGB_DI_PIN), WS2812_SPI_DIVISOR};
85 0, NULL, PAL_PORT(RGB_DI_PIN), PAL_PAD(RGB_DI_PIN),
86 SPI_CR1_BR_1 | SPI_CR1_BR_0 // baudrate : fpclk / 8 => 1tick is 0.32us (2.25 MHz)
87 };
88 116
89 spiAcquireBus(&WS2812_SPI); /* Acquire ownership of the bus. */ 117 spiAcquireBus(&WS2812_SPI); /* Acquire ownership of the bus. */
90 spiStart(&WS2812_SPI, &spicfg); /* Setup transfer parameters. */ 118 spiStart(&WS2812_SPI, &spicfg); /* Setup transfer parameters. */
91 spiSelect(&WS2812_SPI); /* Slave Select assertion. */ 119 spiSelect(&WS2812_SPI); /* Slave Select assertion. */
120#ifdef WS2812_SPI_USE_CIRCULAR_BUFFER
121 spiStartSend(&WS2812_SPI, sizeof(txbuf) / sizeof(txbuf[0]), txbuf);
122#endif
92} 123}
93 124
94void ws2812_setleds(LED_TYPE* ledarray, uint16_t leds) { 125void ws2812_setleds(LED_TYPE* ledarray, uint16_t leds) {
@@ -104,9 +135,11 @@ void ws2812_setleds(LED_TYPE* ledarray, uint16_t leds) {
104 135
105 // Send async - each led takes ~0.03ms, 50 leds ~1.5ms, animations flushing faster than send will cause issues. 136 // Send async - each led takes ~0.03ms, 50 leds ~1.5ms, animations flushing faster than send will cause issues.
106 // Instead spiSend can be used to send synchronously (or the thread logic can be added back). 137 // Instead spiSend can be used to send synchronously (or the thread logic can be added back).
107#ifdef WS2812_SPI_SYNC 138#ifndef WS2812_SPI_USE_CIRCULAR_BUFFER
139# ifdef WS2812_SPI_SYNC
108 spiSend(&WS2812_SPI, sizeof(txbuf) / sizeof(txbuf[0]), txbuf); 140 spiSend(&WS2812_SPI, sizeof(txbuf) / sizeof(txbuf[0]), txbuf);
109#else 141# else
110 spiStartSend(&WS2812_SPI, sizeof(txbuf) / sizeof(txbuf[0]), txbuf); 142 spiStartSend(&WS2812_SPI, sizeof(txbuf) / sizeof(txbuf[0]), txbuf);
143# endif
111#endif 144#endif
112} 145}
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h
index 72ab21247..00896f01c 100644
--- a/drivers/oled/oled_driver.h
+++ b/drivers/oled/oled_driver.h
@@ -158,6 +158,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
158# define OLED_I2C_TIMEOUT 100 158# define OLED_I2C_TIMEOUT 100
159#endif 159#endif
160 160
161#if !defined(OLED_UPDATE_INTERVAL) && defined(SPLIT_KEYBOARD)
162# define OLED_UPDATE_INTERVAL 50
163#endif
164
161typedef struct __attribute__((__packed__)) { 165typedef struct __attribute__((__packed__)) {
162 uint8_t *current_element; 166 uint8_t *current_element;
163 uint16_t remaining_element_count; 167 uint16_t remaining_element_count;
diff --git a/keyboards/aeboards/ext65/rev2/config.h b/keyboards/aeboards/ext65/rev2/config.h
index 541f07ee9..dc1bfb71c 100644
--- a/keyboards/aeboards/ext65/rev2/config.h
+++ b/keyboards/aeboards/ext65/rev2/config.h
@@ -74,3 +74,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
74#define BACKLIGHT_LEVELS 6 74#define BACKLIGHT_LEVELS 6
75#define BACKLIGHT_BREATHING 75#define BACKLIGHT_BREATHING
76#define BREATHING_PERIOD 6 76#define BREATHING_PERIOD 6
77
78#define SLEEP_LED_GPT_DRIVER GPTD1
diff --git a/keyboards/aeboards/ext65/rev2/halconf.h b/keyboards/aeboards/ext65/rev2/halconf.h
index 6e2f53640..9fa1eca60 100644
--- a/keyboards/aeboards/ext65/rev2/halconf.h
+++ b/keyboards/aeboards/ext65/rev2/halconf.h
@@ -27,5 +27,7 @@
27 27
28#define HAL_USE_SPI TRUE 28#define HAL_USE_SPI TRUE
29 29
30#define HAL_USE_GPT TRUE
31
30#include_next <halconf.h> 32#include_next <halconf.h>
31 33
diff --git a/keyboards/aeboards/ext65/rev2/mcuconf.h b/keyboards/aeboards/ext65/rev2/mcuconf.h
index 26ce80615..43d53d4f2 100644
--- a/keyboards/aeboards/ext65/rev2/mcuconf.h
+++ b/keyboards/aeboards/ext65/rev2/mcuconf.h
@@ -32,3 +32,5 @@
32#undef STM32_SPI_USE_SPI2 32#undef STM32_SPI_USE_SPI2
33#define STM32_SPI_USE_SPI2 TRUE 33#define STM32_SPI_USE_SPI2 TRUE
34 34
35#undef STM32_GPT_USE_TIM1
36#define STM32_GPT_USE_TIM1 TRUE
diff --git a/keyboards/cannonkeys/an_c/rules.mk b/keyboards/cannonkeys/an_c/rules.mk
index 8ed2d0ead..7309744d1 100644
--- a/keyboards/cannonkeys/an_c/rules.mk
+++ b/keyboards/cannonkeys/an_c/rules.mk
@@ -11,7 +11,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys
11EXTRAKEY_ENABLE = yes # Audio control and System control 11EXTRAKEY_ENABLE = yes # Audio control and System control
12CONSOLE_ENABLE = yes # Console for debug 12CONSOLE_ENABLE = yes # Console for debug
13COMMAND_ENABLE = yes # Commands for debug and configuration 13COMMAND_ENABLE = yes # Commands for debug and configuration
14SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 14SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
15NKRO_ENABLE = yes # USB Nkey Rollover 15NKRO_ENABLE = yes # USB Nkey Rollover
16CUSTOM_MATRIX = no # Custom matrix file 16CUSTOM_MATRIX = no # Custom matrix file
17BACKLIGHT_ENABLE = yes 17BACKLIGHT_ENABLE = yes
diff --git a/keyboards/cannonkeys/chimera65/rules.mk b/keyboards/cannonkeys/chimera65/rules.mk
index 4d940da78..a08f2fa49 100644
--- a/keyboards/cannonkeys/chimera65/rules.mk
+++ b/keyboards/cannonkeys/chimera65/rules.mk
@@ -11,7 +11,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys
11EXTRAKEY_ENABLE = yes # Audio control and System control 11EXTRAKEY_ENABLE = yes # Audio control and System control
12CONSOLE_ENABLE = yes # Console for debug 12CONSOLE_ENABLE = yes # Console for debug
13COMMAND_ENABLE = yes # Commands for debug and configuration 13COMMAND_ENABLE = yes # Commands for debug and configuration
14SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 14SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
15NKRO_ENABLE = yes # USB Nkey Rollover 15NKRO_ENABLE = yes # USB Nkey Rollover
16CUSTOM_MATRIX = no # Custom matrix file 16CUSTOM_MATRIX = no # Custom matrix file
17BACKLIGHT_ENABLE = yes 17BACKLIGHT_ENABLE = yes
diff --git a/keyboards/cannonkeys/instant60/rules.mk b/keyboards/cannonkeys/instant60/rules.mk
index 0973ad954..e5ba2903b 100644
--- a/keyboards/cannonkeys/instant60/rules.mk
+++ b/keyboards/cannonkeys/instant60/rules.mk
@@ -10,7 +10,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys
10EXTRAKEY_ENABLE = yes # Audio control and System control 10EXTRAKEY_ENABLE = yes # Audio control and System control
11CONSOLE_ENABLE = yes # Console for debug 11CONSOLE_ENABLE = yes # Console for debug
12COMMAND_ENABLE = yes # Commands for debug and configuration 12COMMAND_ENABLE = yes # Commands for debug and configuration
13SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 13SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
14NKRO_ENABLE = yes # USB Nkey Rollover 14NKRO_ENABLE = yes # USB Nkey Rollover
15CUSTOM_MATRIX = no # Custom matrix file 15CUSTOM_MATRIX = no # Custom matrix file
16BACKLIGHT_ENABLE = yes 16BACKLIGHT_ENABLE = yes
diff --git a/keyboards/cannonkeys/iron165/rules.mk b/keyboards/cannonkeys/iron165/rules.mk
index 3925458dd..9de75a614 100644
--- a/keyboards/cannonkeys/iron165/rules.mk
+++ b/keyboards/cannonkeys/iron165/rules.mk
@@ -9,7 +9,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys
9EXTRAKEY_ENABLE = yes # Audio control and System control 9EXTRAKEY_ENABLE = yes # Audio control and System control
10CONSOLE_ENABLE = yes # Console for debug 10CONSOLE_ENABLE = yes # Console for debug
11COMMAND_ENABLE = yes # Commands for debug and configuration 11COMMAND_ENABLE = yes # Commands for debug and configuration
12SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 12SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
13NKRO_ENABLE = yes # USB Nkey Rollover 13NKRO_ENABLE = yes # USB Nkey Rollover
14CUSTOM_MATRIX = no # Custom matrix file 14CUSTOM_MATRIX = no # Custom matrix file
15BACKLIGHT_ENABLE = yes 15BACKLIGHT_ENABLE = yes
diff --git a/keyboards/cannonkeys/satisfaction75/rules.mk b/keyboards/cannonkeys/satisfaction75/rules.mk
index e3abea546..3861b4849 100644
--- a/keyboards/cannonkeys/satisfaction75/rules.mk
+++ b/keyboards/cannonkeys/satisfaction75/rules.mk
@@ -15,7 +15,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys
15EXTRAKEY_ENABLE = yes # Audio control and System control 15EXTRAKEY_ENABLE = yes # Audio control and System control
16CONSOLE_ENABLE = yes # Console for debug 16CONSOLE_ENABLE = yes # Console for debug
17COMMAND_ENABLE = yes # Commands for debug and configuration 17COMMAND_ENABLE = yes # Commands for debug and configuration
18SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 18SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
19NKRO_ENABLE = yes # USB Nkey Rollover 19NKRO_ENABLE = yes # USB Nkey Rollover
20CUSTOM_MATRIX = no # Custom matrix file 20CUSTOM_MATRIX = no # Custom matrix file
21ENCODER_ENABLE = yes 21ENCODER_ENABLE = yes
diff --git a/keyboards/cannonkeys/savage65/rules.mk b/keyboards/cannonkeys/savage65/rules.mk
index 8e1b984fd..2454573d2 100644
--- a/keyboards/cannonkeys/savage65/rules.mk
+++ b/keyboards/cannonkeys/savage65/rules.mk
@@ -11,7 +11,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys
11EXTRAKEY_ENABLE = yes # Audio control and System control 11EXTRAKEY_ENABLE = yes # Audio control and System control
12CONSOLE_ENABLE = yes # Console for debug 12CONSOLE_ENABLE = yes # Console for debug
13COMMAND_ENABLE = yes # Commands for debug and configuration 13COMMAND_ENABLE = yes # Commands for debug and configuration
14SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 14SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
15NKRO_ENABLE = yes # USB Nkey Rollover 15NKRO_ENABLE = yes # USB Nkey Rollover
16CUSTOM_MATRIX = no # Custom matrix file 16CUSTOM_MATRIX = no # Custom matrix file
17BACKLIGHT_ENABLE = yes 17BACKLIGHT_ENABLE = yes
diff --git a/keyboards/cannonkeys/tmov2/rules.mk b/keyboards/cannonkeys/tmov2/rules.mk
index 9b29e8fd1..294c873ee 100644
--- a/keyboards/cannonkeys/tmov2/rules.mk
+++ b/keyboards/cannonkeys/tmov2/rules.mk
@@ -11,7 +11,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys
11EXTRAKEY_ENABLE = yes # Audio control and System control 11EXTRAKEY_ENABLE = yes # Audio control and System control
12CONSOLE_ENABLE = yes # Console for debug 12CONSOLE_ENABLE = yes # Console for debug
13COMMAND_ENABLE = yes # Commands for debug and configuration 13COMMAND_ENABLE = yes # Commands for debug and configuration
14SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 14SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
15NKRO_ENABLE = yes # USB Nkey Rollover 15NKRO_ENABLE = yes # USB Nkey Rollover
16CUSTOM_MATRIX = no # Custom matrix file 16CUSTOM_MATRIX = no # Custom matrix file
17BACKLIGHT_ENABLE = yes 17BACKLIGHT_ENABLE = yes
diff --git a/keyboards/cannonkeys/tsukuyomi/rules.mk b/keyboards/cannonkeys/tsukuyomi/rules.mk
index ce881f198..4e7791a79 100644
--- a/keyboards/cannonkeys/tsukuyomi/rules.mk
+++ b/keyboards/cannonkeys/tsukuyomi/rules.mk
@@ -10,7 +10,7 @@ EXTRAKEY_ENABLE = yes # Audio control and System control
10CONSOLE_ENABLE = yes # Console for debug 10CONSOLE_ENABLE = yes # Console for debug
11COMMAND_ENABLE = yes # Commands for debug and configuration 11COMMAND_ENABLE = yes # Commands for debug and configuration
12# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 12# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
13SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 13SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
14# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 14# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
15NKRO_ENABLE = yes # USB Nkey Rollover 15NKRO_ENABLE = yes # USB Nkey Rollover
16BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 16BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
diff --git a/keyboards/clueboard/66_hotswap/gen1/gen1.c b/keyboards/clueboard/66_hotswap/gen1/gen1.c
index dd399317c..339bd78d5 100644
--- a/keyboards/clueboard/66_hotswap/gen1/gen1.c
+++ b/keyboards/clueboard/66_hotswap/gen1/gen1.c
@@ -16,8 +16,6 @@
16#include "gen1.h" 16#include "gen1.h"
17 17
18#ifdef LED_MATRIX_ENABLE 18#ifdef LED_MATRIX_ENABLE
19 #include "is31fl3731-simple.h"
20
21const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { 19const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
22/* Refer to IS31 manual for these locations 20/* Refer to IS31 manual for these locations
23 * driver 21 * driver
diff --git a/keyboards/crkbd/rev1/common/config.h b/keyboards/crkbd/rev1/common/config.h
index a2c2cde0b..b468fe395 100644
--- a/keyboards/crkbd/rev1/common/config.h
+++ b/keyboards/crkbd/rev1/common/config.h
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
23 23
24#ifdef RGB_MATRIX_ENABLE 24#ifdef RGB_MATRIX_ENABLE
25# define RGB_MATRIX_SPLIT { 27, 27 } 25# define RGB_MATRIX_SPLIT { 27, 27 }
26# define SPLIT_TRANSPORT_MIRROR
26#endif 27#endif
27 28
28#define DIODE_DIRECTION COL2ROW 29#define DIODE_DIRECTION COL2ROW
diff --git a/keyboards/crkbd/rev1/common/rules.mk b/keyboards/crkbd/rev1/common/rules.mk
index 0b8106e3f..d38a61809 100644
--- a/keyboards/crkbd/rev1/common/rules.mk
+++ b/keyboards/crkbd/rev1/common/rules.mk
@@ -1,2 +1 @@
1SPLIT_KEYBOARD = yes SPLIT_KEYBOARD = yes
2SPLIT_TRANSPORT = mirror # for when Split Mirroring drops, it will maintain mirroring functionality
diff --git a/keyboards/crkbd/rev1/rev1.c b/keyboards/crkbd/rev1/rev1.c
index f2df8942a..347f98150 100644
--- a/keyboards/crkbd/rev1/rev1.c
+++ b/keyboards/crkbd/rev1/rev1.c
@@ -87,7 +87,7 @@ led_config_t g_led_config = { {
87 87
88void matrix_init_kb(void) { 88void matrix_init_kb(void) {
89 89
90#ifdef RGB_MATRIX_ENABLE 90#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_SPLIT)
91 if (!isLeftHand) { 91 if (!isLeftHand) {
92 g_led_config = (led_config_t){ { 92 g_led_config = (led_config_t){ {
93 { 51, 50, 45, 44, 37, 36 }, 93 { 51, 50, 45, 44, 37, 36 },
diff --git a/keyboards/daji/seis_cinco/rules.mk b/keyboards/daji/seis_cinco/rules.mk
index fa34092cd..768e50069 100644
--- a/keyboards/daji/seis_cinco/rules.mk
+++ b/keyboards/daji/seis_cinco/rules.mk
@@ -11,7 +11,7 @@ EXTRAKEY_ENABLE = yes # Audio control and System control
11CONSOLE_ENABLE = no # Console for debug 11CONSOLE_ENABLE = no # Console for debug
12COMMAND_ENABLE = no # Commands for debug and configuration 12COMMAND_ENABLE = no # Commands for debug and configuration
13# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 13# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
14SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 14SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
15# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 15# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
16NKRO_ENABLE = yes # USB Nkey Rollover 16NKRO_ENABLE = yes # USB Nkey Rollover
17BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality 17BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
diff --git a/keyboards/durgod/k320/board.h b/keyboards/durgod/boards/DURGOD_STM32_F070/board.h
index 17d08b17f..2d04bccbd 100644
--- a/keyboards/durgod/k320/board.h
+++ b/keyboards/durgod/boards/DURGOD_STM32_F070/board.h
@@ -20,4 +20,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20#define STM32_HSECLK 12000000U 20#define STM32_HSECLK 12000000U
21#include_next <board.h> 21#include_next <board.h>
22#undef STM32_HSE_BYPASS 22#undef STM32_HSE_BYPASS
23
diff --git a/keyboards/durgod/boards/DURGOD_STM32_F070/board.mk b/keyboards/durgod/boards/DURGOD_STM32_F070/board.mk
new file mode 100644
index 000000000..479184833
--- /dev/null
+++ b/keyboards/durgod/boards/DURGOD_STM32_F070/board.mk
@@ -0,0 +1,12 @@
1# List of all the board related files.
2BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F070RB/board.c
3
4# Required include directories
5BOARDINC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F070RB
6
7# Include mcu configuration
8EXTRAINCDIRS = $(BOARD_PATH)/boards/DURGOD_STM32_F070
9
10# Shared variables
11ALLCSRC += $(BOARDSRC)
12ALLINC += $(BOARDINC)
diff --git a/keyboards/durgod/k320/bootloader_defs.h b/keyboards/durgod/boards/DURGOD_STM32_F070/bootloader_defs.h
index 02c48c4e6..02c48c4e6 100644
--- a/keyboards/durgod/k320/bootloader_defs.h
+++ b/keyboards/durgod/boards/DURGOD_STM32_F070/bootloader_defs.h
diff --git a/keyboards/durgod/k320/chconf.h b/keyboards/durgod/boards/DURGOD_STM32_F070/chconf.h
index 374a03003..a7d95c51a 100644
--- a/keyboards/durgod/k320/chconf.h
+++ b/keyboards/durgod/boards/DURGOD_STM32_F070/chconf.h
@@ -25,19 +25,4 @@
25 25
26#define CH_CFG_ST_TIMEDELTA 0 26#define CH_CFG_ST_TIMEDELTA 0
27 27
28#define CH_CFG_OPTIMIZE_SPEED FALSE
29
30#define CH_CFG_USE_REGISTRY TRUE
31
32#define CH_CFG_USE_WAITEXIT TRUE
33
34#define CH_CFG_USE_CONDVARS TRUE
35
36#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
37
38#define CH_CFG_USE_MESSAGES TRUE
39
40#define CH_CFG_USE_MAILBOXES TRUE
41
42#include_next <chconf.h> 28#include_next <chconf.h>
43
diff --git a/keyboards/durgod/k320/mcuconf.h b/keyboards/durgod/boards/DURGOD_STM32_F070/mcuconf.h
index 6d67aa96a..6d67aa96a 100644
--- a/keyboards/durgod/k320/mcuconf.h
+++ b/keyboards/durgod/boards/DURGOD_STM32_F070/mcuconf.h
diff --git a/keyboards/durgod/k320/config.h b/keyboards/durgod/k320/config.h
index 70438900e..323a9ccff 100644
--- a/keyboards/durgod/k320/config.h
+++ b/keyboards/durgod/k320/config.h
@@ -1,19 +1,18 @@
1/* 1/* Copyright 2021 kuenhlee and Don Kjer
2Copyright 2021 kuenhlee and Don Kjer 2 *
3 3 * This program is free software: you can redistribute it and/or modify
4This program is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by
5it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, either version 2 of the License, or
6the Free Software Foundation, either version 2 of the License, or 6 * (at your option) any later version.
7(at your option) any later version. 7 *
8 8 * This program is distributed in the hope that it will be useful,
9This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details.
12GNU General Public License for more details. 12 *
13 13 * You should have received a copy of the GNU General Public License
14You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */
16*/
17 16
18#pragma once 17#pragma once
19 18
@@ -36,8 +35,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
36/* COL2ROW, ROW2COL*/ 35/* COL2ROW, ROW2COL*/
37#define DIODE_DIRECTION ROW2COL 36#define DIODE_DIRECTION ROW2COL
38 37
38// Dynamic EEPROM
39// Something sensible or else VIA may crash
40// Users may enable more if they wish
41#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095
42
39/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ 43/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
40#define DEBOUNCE 7 44#define DEBOUNCE 5
41 45
42/* Bootmagic Lite key configuration */ 46/* Bootmagic Lite key configuration */
43#define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE 47#define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
@@ -50,4 +54,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
50#define LED_WIN_LOCK_PIN A9 54#define LED_WIN_LOCK_PIN A9
51#define LED_MR_LOCK_PIN A10 55#define LED_MR_LOCK_PIN A10
52#define LED_PIN_ON_STATE 0 56#define LED_PIN_ON_STATE 0
53
diff --git a/keyboards/durgod/k320/info.json b/keyboards/durgod/k320/info.json
index 5e33d8fcd..6c67c3d45 100644
--- a/keyboards/durgod/k320/info.json
+++ b/keyboards/durgod/k320/info.json
@@ -7,913 +7,293 @@
7 "layouts": { 7 "layouts": {
8 "LAYOUT_tkl_ansi": { 8 "LAYOUT_tkl_ansi": {
9 "layout": [ 9 "layout": [
10 { 10 { "label": "Esc", "x": 0, "y": 0 },
11 "label": "Esc", 11 { "label": "F1", "x": 2, "y": 0 },
12 "x": 0, 12 { "label": "F2", "x": 3, "y": 0 },
13 "y": 0 13 { "label": "F3", "x": 4, "y": 0 },
14 }, 14 { "label": "F4", "x": 5, "y": 0 },
15 { 15 { "label": "F5", "x": 6.5, "y": 0 },
16 "label": "F1", 16 { "label": "F6", "x": 7.5, "y": 0 },
17 "x": 2, 17 { "label": "F7", "x": 8.5, "y": 0 },
18 "y": 0 18 { "label": "F8", "x": 9.5, "y": 0 },
19 }, 19 { "label": "F9", "x": 11, "y": 0 },
20 { 20 { "label": "F10", "x": 12, "y": 0 },
21 "label": "F2", 21 { "label": "F11", "x": 13, "y": 0 },
22 "x": 3, 22 { "label": "F12", "x": 14, "y": 0 },
23 "y": 0 23 { "label": "PrtSc", "x": 15.25, "y": 0 },
24 }, 24 { "label": "Scroll Lock", "x": 16.25, "y": 0 },
25 { 25 { "label": "Pause", "x": 17.25, "y": 0 },
26 "label": "F3", 26
27 "x": 4, 27 { "label": "~", "x": 0, "y": 1.5 },
28 "y": 0 28 { "label": "!", "x": 1, "y": 1.5 },
29 }, 29 { "label": "@", "x": 2, "y": 1.5 },
30 { 30 { "label": "#", "x": 3, "y": 1.5 },
31 "label": "F4", 31 { "label": "$", "x": 4, "y": 1.5 },
32 "x": 5, 32 { "label": "%", "x": 5, "y": 1.5 },
33 "y": 0 33 { "label": "^", "x": 6, "y": 1.5 },
34 }, 34 { "label": "&", "x": 7, "y": 1.5 },
35 { 35 { "label": "*", "x": 8, "y": 1.5 },
36 "label": "F5", 36 { "label": "(", "x": 9, "y": 1.5 },
37 "x": 6.5, 37 { "label": ")", "x": 10, "y": 1.5 },
38 "y": 0 38 { "label": "_", "x": 11, "y": 1.5 },
39 }, 39 { "label": "+", "x": 12, "y": 1.5 },
40 { 40 { "label": "Backspace", "x": 13, "y": 1.5, "w": 2 },
41 "label": "F6", 41 { "label": "Insert", "x": 15.25, "y": 1.5 },
42 "x": 7.5, 42 { "label": "Home", "x": 16.25, "y": 1.5 },
43 "y": 0 43 { "label": "PgUp", "x": 17.25, "y": 1.5 },
44 }, 44
45 { 45 { "label": "Tab", "x": 0, "y": 2.5, "w": 1.5 },
46 "label": "F7", 46 { "label": "Q", "x": 1.5, "y": 2.5 },
47 "x": 8.5, 47 { "label": "W", "x": 2.5, "y": 2.5 },
48 "y": 0 48 { "label": "E", "x": 3.5, "y": 2.5 },
49 }, 49 { "label": "R", "x": 4.5, "y": 2.5 },
50 { 50 { "label": "T", "x": 5.5, "y": 2.5 },
51 "label": "F8", 51 { "label": "Y", "x": 6.5, "y": 2.5 },
52 "x": 9.5, 52 { "label": "U", "x": 7.5, "y": 2.5 },
53 "y": 0 53 { "label": "I", "x": 8.5, "y": 2.5 },
54 }, 54 { "label": "O", "x": 9.5, "y": 2.5 },
55 { 55 { "label": "P", "x": 10.5, "y": 2.5 },
56 "label": "F9", 56 { "label": "{", "x": 11.5, "y": 2.5 },
57 "x": 11, 57 { "label": "}", "x": 12.5, "y": 2.5 },
58 "y": 0 58 { "label": "|", "x": 13.5, "y": 2.5, "w": 1.5 },
59 }, 59 { "label": "Delete", "x": 15.25, "y": 2.5 },
60 { 60 { "label": "End", "x": 16.25, "y": 2.5 },
61 "label": "F10", 61 { "label": "PgDn", "x": 17.25, "y": 2.5 },
62 "x": 12, 62
63 "y": 0 63 { "label": "Caps Lock", "x": 0, "y": 3.5, "w": 1.75 },
64 }, 64 { "label": "A", "x": 1.75, "y": 3.5 },
65 { 65 { "label": "S", "x": 2.75, "y": 3.5 },
66 "label": "F11", 66 { "label": "D", "x": 3.75, "y": 3.5 },
67 "x": 13, 67 { "label": "F", "x": 4.75, "y": 3.5 },
68 "y": 0 68 { "label": "G", "x": 5.75, "y": 3.5 },
69 }, 69 { "label": "H", "x": 6.75, "y": 3.5 },
70 { 70 { "label": "J", "x": 7.75, "y": 3.5 },
71 "label": "F12", 71 { "label": "K", "x": 8.75, "y": 3.5 },
72 "x": 14, 72 { "label": "L", "x": 9.75, "y": 3.5 },
73 "y": 0 73 { "label": ":", "x": 10.75, "y": 3.5 },
74 }, 74 { "label": "\"", "x": 11.75, "y": 3.5 },
75 { 75 { "label": "Enter", "x": 12.75, "y": 3.5, "w": 2.25 },
76 "label": "PrtSc", 76
77 "x": 15.25, 77 { "label": "Shift", "x": 0, "y": 4.5, "w": 2.25 },
78 "y": 0 78 { "label": "Z", "x": 2.25, "y": 4.5 },
79 }, 79 { "label": "X", "x": 3.25, "y": 4.5 },
80 { 80 { "label": "C", "x": 4.25, "y": 4.5 },
81 "label": "Scroll Lock", 81 { "label": "V", "x": 5.25, "y": 4.5 },
82 "x": 16.25, 82 { "label": "B", "x": 6.25, "y": 4.5 },
83 "y": 0 83 { "label": "N", "x": 7.25, "y": 4.5 },
84 }, 84 { "label": "M", "x": 8.25, "y": 4.5 },
85 { 85 { "label": "<", "x": 9.25, "y": 4.5 },
86 "label": "Pause", 86 { "label": ">", "x": 10.25, "y": 4.5 },
87 "x": 17.25, 87 { "label": "?", "x": 11.25, "y": 4.5 },
88 "y": 0 88 { "label": "Shift", "x": 12.25, "y": 4.5, "w": 2.75 },
89 }, 89 { "label": "\u2191", "x": 16.25, "y": 4.5 },
90 { 90
91 "label": "~", 91 { "label": "Ctrl", "x": 0, "y": 5.5, "w": 1.25 },
92 "x": 0, 92 { "label": "Win", "x": 1.25, "y": 5.5, "w": 1.25 },
93 "y": 1.5 93 { "label": "Alt", "x": 2.5, "y": 5.5, "w": 1.25 },
94 }, 94 { "x": 3.75, "y": 5.5, "w": 6.25 },
95 { 95 { "label": "Alt", "x": 10, "y": 5.5, "w": 1.25 },
96 "label": "!", 96 { "label": "Fn", "x": 11.25, "y": 5.5, "w": 1.25 },
97 "x": 1, 97 { "label": "Menu", "x": 12.5, "y": 5.5, "w": 1.25 },
98 "y": 1.5 98 { "label": "Ctrl", "x": 13.75, "y": 5.5, "w": 1.25 },
99 }, 99 { "label": "\u2190", "x": 15.25, "y": 5.5 },
100 { 100 { "label": "\u2193", "x": 16.25, "y": 5.5 },
101 "label": "@", 101 { "label": "\u2192", "x": 17.25, "y": 5.5 }
102 "x": 2,
103 "y": 1.5
104 },
105 {
106 "label": "#",
107 "x": 3,
108 "y": 1.5
109 },
110 {
111 "label": "$",
112 "x": 4,
113 "y": 1.5
114 },
115 {
116 "label": "%",
117 "x": 5,
118 "y": 1.5
119 },
120 {
121 "label": "^",
122 "x": 6,
123 "y": 1.5
124 },
125 {
126 "label": "&",
127 "x": 7,
128 "y": 1.5
129 },
130 {
131 "label": "*",
132 "x": 8,
133 "y": 1.5
134 },
135 {
136 "label": "(",
137 "x": 9,
138 "y": 1.5
139 },
140 {
141 "label": ")",
142 "x": 10,
143 "y": 1.5
144 },
145 {
146 "label": "_",
147 "x": 11,
148 "y": 1.5
149 },
150 {
151 "label": "+",
152 "x": 12,
153 "y": 1.5
154 },
155 {
156 "label": "Backspace",
157 "x": 13,
158 "y": 1.5,
159 "w": 2
160 },
161 {
162 "label": "Insert",
163 "x": 15.25,
164 "y": 1.5
165 },
166 {
167 "label": "Home",
168 "x": 16.25,
169 "y": 1.5
170 },
171 {
172 "label": "PgUp",
173 "x": 17.25,
174 "y": 1.5
175 },
176 {
177 "label": "Tab",
178 "x": 0,
179 "y": 2.5,
180 "w": 1.5
181 },
182 {
183 "label": "Q",
184 "x": 1.5,
185 "y": 2.5
186 },
187 {
188 "label": "W",
189 "x": 2.5,
190 "y": 2.5
191 },
192 {
193 "label": "E",
194 "x": 3.5,
195 "y": 2.5
196 },
197 {
198 "label": "R",
199 "x": 4.5,
200 "y": 2.5
201 },
202 {
203 "label": "T",
204 "x": 5.5,
205 "y": 2.5
206 },
207 {
208 "label": "Y",
209 "x": 6.5,
210 "y": 2.5
211 },
212 {
213 "label": "U",
214 "x": 7.5,
215 "y": 2.5
216 },
217 {
218 "label": "I",
219 "x": 8.5,
220 "y": 2.5
221 },
222 {
223 "label": "O",
224 "x": 9.5,
225 "y": 2.5
226 },
227 {
228 "label": "P",
229 "x": 10.5,
230 "y": 2.5
231 },
232 {
233 "label": "{",
234 "x": 11.5,
235 "y": 2.5
236 },
237 {
238 "label": "}",
239 "x": 12.5,
240 "y": 2.5
241 },
242 {
243 "label": "|",
244 "x": 13.5,
245 "y": 2.5,
246 "w": 1.5
247 },
248 {
249 "label": "Delete",
250 "x": 15.25,
251 "y": 2.5
252 },
253 {
254 "label": "End",
255 "x": 16.25,
256 "y": 2.5
257 },
258 {
259 "label": "PgDn",
260 "x": 17.25,
261 "y": 2.5
262 },
263 {
264 "label": "Caps Lock",
265 "x": 0,
266 "y": 3.5,
267 "w": 1.75
268 },
269 {
270 "label": "A",
271 "x": 1.75,
272 "y": 3.5
273 },
274 {
275 "label": "S",
276 "x": 2.75,
277 "y": 3.5
278 },
279 {
280 "label": "D",
281 "x": 3.75,
282 "y": 3.5
283 },
284 {
285 "label": "F",
286 "x": 4.75,
287 "y": 3.5
288 },
289 {
290 "label": "G",
291 "x": 5.75,
292 "y": 3.5
293 },
294 {
295 "label": "H",
296 "x": 6.75,
297 "y": 3.5
298 },
299 {
300 "label": "J",
301 "x": 7.75,
302 "y": 3.5
303 },
304 {
305 "label": "K",
306 "x": 8.75,
307 "y": 3.5
308 },
309 {
310 "label": "L",
311 "x": 9.75,
312 "y": 3.5
313 },
314 {
315 "label": ":",
316 "x": 10.75,
317 "y": 3.5
318 },
319 {
320 "label": "\"",
321 "x": 11.75,
322 "y": 3.5
323 },
324 {
325 "label": "Enter",
326 "x": 12.75,
327 "y": 3.5,
328 "w": 2.25
329 },
330 {
331 "label": "Shift",
332 "x": 0,
333 "y": 4.5,
334 "w": 2.25
335 },
336 {
337 "label": "Z",
338 "x": 2.25,
339 "y": 4.5
340 },
341 {
342 "label": "X",
343 "x": 3.25,
344 "y": 4.5
345 },
346 {
347 "label": "C",
348 "x": 4.25,
349 "y": 4.5
350 },
351 {
352 "label": "V",
353 "x": 5.25,
354 "y": 4.5
355 },
356 {
357 "label": "B",
358 "x": 6.25,
359 "y": 4.5
360 },
361 {
362 "label": "N",
363 "x": 7.25,
364 "y": 4.5
365 },
366 {
367 "label": "M",
368 "x": 8.25,
369 "y": 4.5
370 },
371 {
372 "label": "<",
373 "x": 9.25,
374 "y": 4.5
375 },
376 {
377 "label": ">",
378 "x": 10.25,
379 "y": 4.5
380 },
381 {
382 "label": "?",
383 "x": 11.25,
384 "y": 4.5
385 },
386 {
387 "label": "Shift",
388 "x": 12.25,
389 "y": 4.5,
390 "w": 2.75
391 },
392 {
393 "label": "\u2191",
394 "x": 16.25,
395 "y": 4.5
396 },
397 {
398 "label": "Ctrl",
399 "x": 0,
400 "y": 5.5,
401 "w": 1.25
402 },
403 {
404 "label": "Win",
405 "x": 1.25,
406 "y": 5.5,
407 "w": 1.25
408 },
409 {
410 "label": "Alt",
411 "x": 2.5,
412 "y": 5.5,
413 "w": 1.25
414 },
415 {
416 "x": 3.75,
417 "y": 5.5,
418 "w": 6.25
419 },
420 {
421 "label": "Alt",
422 "x": 10,
423 "y": 5.5,
424 "w": 1.25
425 },
426 {
427 "label": "Fn",
428 "x": 11.25,
429 "y": 5.5,
430 "w": 1.25
431 },
432 {
433 "label": "Menu",
434 "x": 12.5,
435 "y": 5.5,
436 "w": 1.25
437 },
438 {
439 "label": "Ctrl",
440 "x": 13.75,
441 "y": 5.5,
442 "w": 1.25
443 },
444 {
445 "label": "\u2190",
446 "x": 15.25,
447 "y": 5.5
448 },
449 {
450 "label": "\u2193",
451 "x": 16.25,
452 "y": 5.5
453 },
454 {
455 "label": "\u2192",
456 "x": 17.25,
457 "y": 5.5
458 }
459 ] 102 ]
460 }, 103 },
461 "LAYOUT_tkl_iso": { 104 "LAYOUT_tkl_iso": {
462 "layout": [ 105 "layout": [
463 { 106 { "label": "Esc", "x": 0, "y": 0 },
464 "label": "Esc", 107 { "label": "F1", "x": 2, "y": 0 },
465 "x": 0, 108 { "label": "F2", "x": 3, "y": 0 },
466 "y": 0 109 { "label": "F3", "x": 4, "y": 0 },
467 }, 110 { "label": "F4", "x": 5, "y": 0 },
468 { 111 { "label": "F5", "x": 6.5, "y": 0 },
469 "label": "F1", 112 { "label": "F6", "x": 7.5, "y": 0 },
470 "x": 2, 113 { "label": "F7", "x": 8.5, "y": 0 },
471 "y": 0 114 { "label": "F8", "x": 9.5, "y": 0 },
472 }, 115 { "label": "F9", "x": 11, "y": 0 },
473 { 116 { "label": "F10", "x": 12, "y": 0 },
474 "label": "F2", 117 { "label": "F11", "x": 13, "y": 0 },
475 "x": 3, 118 { "label": "F12", "x": 14, "y": 0 },
476 "y": 0 119 { "label": "PrtSc", "x": 15.25, "y": 0 },
477 }, 120 { "label": "Scroll Lock", "x": 16.25, "y": 0 },
478 { 121 { "label": "Pause", "x": 17.25, "y": 0 },
479 "label": "F3", 122
480 "x": 4, 123 { "label": "~", "x": 0, "y": 1.5 },
481 "y": 0 124 { "label": "!", "x": 1, "y": 1.5 },
482 }, 125 { "label": "@", "x": 2, "y": 1.5 },
483 { 126 { "label": "#", "x": 3, "y": 1.5 },
484 "label": "F4", 127 { "label": "$", "x": 4, "y": 1.5 },
485 "x": 5, 128 { "label": "%", "x": 5, "y": 1.5 },
486 "y": 0 129 { "label": "^", "x": 6, "y": 1.5 },
487 }, 130 { "label": "&", "x": 7, "y": 1.5 },
488 { 131 { "label": "*", "x": 8, "y": 1.5 },
489 "label": "F5", 132 { "label": "(", "x": 9, "y": 1.5 },
490 "x": 6.5, 133 { "label": ")", "x": 10, "y": 1.5 },
491 "y": 0 134 { "label": "_", "x": 11, "y": 1.5 },
492 }, 135 { "label": "+", "x": 12, "y": 1.5 },
493 { 136 { "label": "Backspace", "x": 13, "y": 1.5, "w": 2 },
494 "label": "F6", 137 { "label": "Insert", "x": 15.25, "y": 1.5 },
495 "x": 7.5, 138 { "label": "Home", "x": 16.25, "y": 1.5 },
496 "y": 0 139 { "label": "PgUp", "x": 17.25, "y": 1.5 },
497 }, 140
498 { 141 { "label": "Tab", "x": 0, "y": 2.5, "w": 1.5 },
499 "label": "F7", 142 { "label": "Q", "x": 1.5, "y": 2.5 },
500 "x": 8.5, 143 { "label": "W", "x": 2.5, "y": 2.5 },
501 "y": 0 144 { "label": "E", "x": 3.5, "y": 2.5 },
502 }, 145 { "label": "R", "x": 4.5, "y": 2.5 },
503 { 146 { "label": "T", "x": 5.5, "y": 2.5 },
504 "label": "F8", 147 { "label": "Y", "x": 6.5, "y": 2.5 },
505 "x": 9.5, 148 { "label": "U", "x": 7.5, "y": 2.5 },
506 "y": 0 149 { "label": "I", "x": 8.5, "y": 2.5 },
507 }, 150 { "label": "O", "x": 9.5, "y": 2.5 },
508 { 151 { "label": "P", "x": 10.5, "y": 2.5 },
509 "label": "F9", 152 { "label": "{", "x": 11.5, "y": 2.5 },
510 "x": 11, 153 { "label": "}", "x": 12.5, "y": 2.5 },
511 "y": 0 154 { "label": "Delete", "x": 15.25, "y": 2.5 },
512 }, 155 { "label": "End", "x": 16.25, "y": 2.5 },
513 { 156 { "label": "PgDn", "x": 17.25, "y": 2.5 },
514 "label": "F10", 157
515 "x": 12, 158 { "label": "Caps Lock", "x": 0, "y": 3.5, "w": 1.75 },
516 "y": 0 159 { "label": "A", "x": 1.75, "y": 3.5 },
517 }, 160 { "label": "S", "x": 2.75, "y": 3.5 },
518 { 161 { "label": "D", "x": 3.75, "y": 3.5 },
519 "label": "F11", 162 { "label": "F", "x": 4.75, "y": 3.5 },
520 "x": 13, 163 { "label": "G", "x": 5.75, "y": 3.5 },
521 "y": 0 164 { "label": "H", "x": 6.75, "y": 3.5 },
522 }, 165 { "label": "J", "x": 7.75, "y": 3.5 },
523 { 166 { "label": "K", "x": 8.75, "y": 3.5 },
524 "label": "F12", 167 { "label": "L", "x": 9.75, "y": 3.5 },
525 "x": 14, 168 { "label": ":", "x": 10.75, "y": 3.5 },
526 "y": 0 169 { "label": "\"", "x": 11.75, "y": 3.5 },
527 }, 170 { "label": "#", "x": 12.75, "y": 3.5 },
528 { 171 { "label": "Enter", "x": 13.75, "y": 2.5, "w": 1.25, "h": 2 },
529 "label": "PrtSc", 172
530 "x": 15.25, 173 { "label": "Shift", "x": 0, "y": 4.5, "w": 1.25 },
531 "y": 0 174 { "label": "\\", "x": 1.25, "y": 4.5 },
532 }, 175 { "label": "Z", "x": 2.25, "y": 4.5 },
533 { 176 { "label": "X", "x": 3.25, "y": 4.5 },
534 "label": "Scroll Lock", 177 { "label": "C", "x": 4.25, "y": 4.5 },
535 "x": 16.25, 178 { "label": "V", "x": 5.25, "y": 4.5 },
536 "y": 0 179 { "label": "B", "x": 6.25, "y": 4.5 },
537 }, 180 { "label": "N", "x": 7.25, "y": 4.5 },
538 { 181 { "label": "M", "x": 8.25, "y": 4.5 },
539 "label": "Pause", 182 { "label": "<", "x": 9.25, "y": 4.5 },
540 "x": 17.25, 183 { "label": ">", "x": 10.25, "y": 4.5 },
541 "y": 0 184 { "label": "?", "x": 11.25, "y": 4.5 },
542 }, 185 { "label": "Shift", "x": 12.25, "y": 4.5, "w": 2.75 },
543 { 186 { "label": "\u2191", "x": 16.25, "y": 4.5 },
544 "label": "~", 187
545 "x": 0, 188 { "label": "Ctrl", "x": 0, "y": 5.5, "w": 1.25 },
546 "y": 1.5 189 { "label": "Win", "x": 1.25, "y": 5.5, "w": 1.25 },
547 }, 190 { "label": "Alt", "x": 2.5, "y": 5.5, "w": 1.25 },
548 { 191 { "x": 3.75, "y": 5.5, "w": 6.25 },
549 "label": "!", 192 { "label": "Alt", "x": 10, "y": 5.5, "w": 1.25 },
550 "x": 1, 193 { "label": "Fn", "x": 11.25, "y": 5.5, "w": 1.25 },
551 "y": 1.5 194 { "label": "Menu", "x": 12.5, "y": 5.5, "w": 1.25 },
552 }, 195 { "label": "Ctrl", "x": 13.75, "y": 5.5, "w": 1.25 },
553 { 196 { "label": "\u2190", "x": 15.25, "y": 5.5 },
554 "label": "@", 197 { "label": "\u2193", "x": 16.25, "y": 5.5 },
555 "x": 2, 198 { "label": "\u2192", "x": 17.25, "y": 5.5 }
556 "y": 1.5 199 ]
557 }, 200 },
558 { 201 "LAYOUT_all": {
559 "label": "#", 202 "layout": [
560 "x": 3, 203 { "label": "Esc", "x": 0, "y": 0 },
561 "y": 1.5 204 { "label": "F1", "x": 2, "y": 0 },
562 }, 205 { "label": "F2", "x": 3, "y": 0 },
563 { 206 { "label": "F3", "x": 4, "y": 0 },
564 "label": "$", 207 { "label": "F4", "x": 5, "y": 0 },
565 "x": 4, 208 { "label": "F5", "x": 6.5, "y": 0 },
566 "y": 1.5 209 { "label": "F6", "x": 7.5, "y": 0 },
567 }, 210 { "label": "F7", "x": 8.5, "y": 0 },
568 { 211 { "label": "F8", "x": 9.5, "y": 0 },
569 "label": "%", 212 { "label": "F9", "x": 11, "y": 0 },
570 "x": 5, 213 { "label": "F10", "x": 12, "y": 0 },
571 "y": 1.5 214 { "label": "F11", "x": 13, "y": 0 },
572 }, 215 { "label": "F12", "x": 14, "y": 0 },
573 { 216 { "label": "PrtSc", "x": 15.25, "y": 0 },
574 "label": "^", 217 { "label": "Scroll Lock", "x": 16.25, "y": 0 },
575 "x": 6, 218 { "label": "Pause", "x": 17.25, "y": 0 },
576 "y": 1.5 219
577 }, 220 { "label": "~", "x": 0, "y": 1.5 },
578 { 221 { "label": "!", "x": 1, "y": 1.5 },
579 "label": "&", 222 { "label": "@", "x": 2, "y": 1.5 },
580 "x": 7, 223 { "label": "#", "x": 3, "y": 1.5 },
581 "y": 1.5 224 { "label": "$", "x": 4, "y": 1.5 },
582 }, 225 { "label": "%", "x": 5, "y": 1.5 },
583 { 226 { "label": "^", "x": 6, "y": 1.5 },
584 "label": "*", 227 { "label": "&", "x": 7, "y": 1.5 },
585 "x": 8, 228 { "label": "*", "x": 8, "y": 1.5 },
586 "y": 1.5 229 { "label": "(", "x": 9, "y": 1.5 },
587 }, 230 { "label": ")", "x": 10, "y": 1.5 },
588 { 231 { "label": "_", "x": 11, "y": 1.5 },
589 "label": "(", 232 { "label": "+", "x": 12, "y": 1.5 },
590 "x": 9, 233 { "label": "Backspace", "x": 13, "y": 1.5, "w": 2 },
591 "y": 1.5 234 { "label": "Insert", "x": 15.25, "y": 1.5 },
592 }, 235 { "label": "Home", "x": 16.25, "y": 1.5 },
593 { 236 { "label": "PgUp", "x": 17.25, "y": 1.5 },
594 "label": ")", 237
595 "x": 10, 238 { "label": "Tab", "x": 0, "y": 2.5, "w": 1.5 },
596 "y": 1.5 239 { "label": "Q", "x": 1.5, "y": 2.5 },
597 }, 240 { "label": "W", "x": 2.5, "y": 2.5 },
598 { 241 { "label": "E", "x": 3.5, "y": 2.5 },
599 "label": "_", 242 { "label": "R", "x": 4.5, "y": 2.5 },
600 "x": 11, 243 { "label": "T", "x": 5.5, "y": 2.5 },
601 "y": 1.5 244 { "label": "Y", "x": 6.5, "y": 2.5 },
602 }, 245 { "label": "U", "x": 7.5, "y": 2.5 },
603 { 246 { "label": "I", "x": 8.5, "y": 2.5 },
604 "label": "+", 247 { "label": "O", "x": 9.5, "y": 2.5 },
605 "x": 12, 248 { "label": "P", "x": 10.5, "y": 2.5 },
606 "y": 1.5 249 { "label": "{", "x": 11.5, "y": 2.5 },
607 }, 250 { "label": "}", "x": 12.5, "y": 2.5 },
608 { 251 { "label": "|", "x": 13.5, "y": 2.5, "w": 1.5 },
609 "label": "Backspace", 252 { "label": "Delete", "x": 15.25, "y": 2.5 },
610 "x": 13, 253 { "label": "End", "x": 16.25, "y": 2.5 },
611 "y": 1.5, 254 { "label": "PgDn", "x": 17.25, "y": 2.5 },
612 "w": 2 255
613 }, 256 { "label": "Caps Lock", "x": 0, "y": 3.5, "w": 1.75 },
614 { 257 { "label": "A", "x": 1.75, "y": 3.5 },
615 "label": "Insert", 258 { "label": "S", "x": 2.75, "y": 3.5 },
616 "x": 15.25, 259 { "label": "D", "x": 3.75, "y": 3.5 },
617 "y": 1.5 260 { "label": "F", "x": 4.75, "y": 3.5 },
618 }, 261 { "label": "G", "x": 5.75, "y": 3.5 },
619 { 262 { "label": "H", "x": 6.75, "y": 3.5 },
620 "label": "Home", 263 { "label": "J", "x": 7.75, "y": 3.5 },
621 "x": 16.25, 264 { "label": "K", "x": 8.75, "y": 3.5 },
622 "y": 1.5 265 { "label": "L", "x": 9.75, "y": 3.5 },
623 }, 266 { "label": ":", "x": 10.75, "y": 3.5 },
624 { 267 { "label": "\"", "x": 11.75, "y": 3.5 },
625 "label": "PgUp", 268 { "label": "#", "x": 12.75, "y": 3.5 },
626 "x": 17.25, 269 { "label": "Enter", "x": 13.75, "y": 3.5, "w": 1.25 },
627 "y": 1.5 270
628 }, 271 { "label": "Shift", "x": 0, "y": 4.5, "w": 1.25 },
629 { 272 { "label": "\\", "x": 1.25, "y": 4.5 },
630 "label": "Tab", 273 { "label": "Z", "x": 2.25, "y": 4.5 },
631 "x": 0, 274 { "label": "X", "x": 3.25, "y": 4.5 },
632 "y": 2.5, 275 { "label": "C", "x": 4.25, "y": 4.5 },
633 "w": 1.5 276 { "label": "V", "x": 5.25, "y": 4.5 },
634 }, 277 { "label": "B", "x": 6.25, "y": 4.5 },
635 { 278 { "label": "N", "x": 7.25, "y": 4.5 },
636 "label": "Q", 279 { "label": "M", "x": 8.25, "y": 4.5 },
637 "x": 1.5, 280 { "label": "<", "x": 9.25, "y": 4.5 },
638 "y": 2.5 281 { "label": ">", "x": 10.25, "y": 4.5 },
639 }, 282 { "label": "?", "x": 11.25, "y": 4.5 },
640 { 283 { "label": "Shift", "x": 12.25, "y": 4.5, "w": 2.75 },
641 "label": "W", 284 { "label": "\u2191", "x": 16.25, "y": 4.5 },
642 "x": 2.5, 285
643 "y": 2.5 286 { "label": "Ctrl", "x": 0, "y": 5.5, "w": 1.25 },
644 }, 287 { "label": "Win", "x": 1.25, "y": 5.5, "w": 1.25 },
645 { 288 { "label": "Alt", "x": 2.5, "y": 5.5, "w": 1.25 },
646 "label": "E", 289 { "x": 3.75, "y": 5.5, "w": 6.25 },
647 "x": 3.5, 290 { "label": "Alt", "x": 10, "y": 5.5, "w": 1.25 },
648 "y": 2.5 291 { "label": "Fn", "x": 11.25, "y": 5.5, "w": 1.25 },
649 }, 292 { "label": "Menu", "x": 12.5, "y": 5.5, "w": 1.25 },
650 { 293 { "label": "Ctrl", "x": 13.75, "y": 5.5, "w": 1.25 },
651 "label": "R", 294 { "label": "\u2190", "x": 15.25, "y": 5.5 },
652 "x": 4.5, 295 { "label": "\u2193", "x": 16.25, "y": 5.5 },
653 "y": 2.5 296 { "label": "\u2192", "x": 17.25, "y": 5.5 }
654 },
655 {
656 "label": "T",
657 "x": 5.5,
658 "y": 2.5
659 },
660 {
661 "label": "Y",
662 "x": 6.5,
663 "y": 2.5
664 },
665 {
666 "label": "U",
667 "x": 7.5,
668 "y": 2.5
669 },
670 {
671 "label": "I",
672 "x": 8.5,
673 "y": 2.5
674 },
675 {
676 "label": "O",
677 "x": 9.5,
678 "y": 2.5
679 },
680 {
681 "label": "P",
682 "x": 10.5,
683 "y": 2.5
684 },
685 {
686 "label": "{",
687 "x": 11.5,
688 "y": 2.5
689 },
690 {
691 "label": "}",
692 "x": 12.5,
693 "y": 2.5
694 },
695 {
696 "label": "Enter",
697 "x": 13.75,
698 "y": 2.5,
699 "w": 1.25,
700 "h": 2
701 },
702 {
703 "label": "Delete",
704 "x": 15.25,
705 "y": 2.5
706 },
707 {
708 "label": "End",
709 "x": 16.25,
710 "y": 2.5
711 },
712 {
713 "label": "PgDn",
714 "x": 17.25,
715 "y": 2.5
716 },
717 {
718 "label": "Caps Lock",
719 "x": 0,
720 "y": 3.5,
721 "w": 1.75
722 },
723 {
724 "label": "A",
725 "x": 1.75,
726 "y": 3.5
727 },
728 {
729 "label": "S",
730 "x": 2.75,
731 "y": 3.5
732 },
733 {
734 "label": "D",
735 "x": 3.75,
736 "y": 3.5
737 },
738 {
739 "label": "F",
740 "x": 4.75,
741 "y": 3.5
742 },
743 {
744 "label": "G",
745 "x": 5.75,
746 "y": 3.5
747 },
748 {
749 "label": "H",
750 "x": 6.75,
751 "y": 3.5
752 },
753 {
754 "label": "J",
755 "x": 7.75,
756 "y": 3.5
757 },
758 {
759 "label": "K",
760 "x": 8.75,
761 "y": 3.5
762 },
763 {
764 "label": "L",
765 "x": 9.75,
766 "y": 3.5
767 },
768 {
769 "label": ":",
770 "x": 10.75,
771 "y": 3.5
772 },
773 {
774 "label": "\"",
775 "x": 11.75,
776 "y": 3.5
777 },
778 {
779 "label": "#",
780 "x": 12.75,
781 "y": 3.5
782 },
783 {
784 "label": "Shift",
785 "x": 0,
786 "y": 4.5,
787 "w": 1.25
788 },
789 {
790 "label": "\\",
791 "x": 1.25,
792 "y": 4.5
793 },
794 {
795 "label": "Z",
796 "x": 2.25,
797 "y": 4.5
798 },
799 {
800 "label": "X",
801 "x": 3.25,
802 "y": 4.5
803 },
804 {
805 "label": "C",
806 "x": 4.25,
807 "y": 4.5
808 },
809 {
810 "label": "V",
811 "x": 5.25,
812 "y": 4.5
813 },
814 {
815 "label": "B",
816 "x": 6.25,
817 "y": 4.5
818 },
819 {
820 "label": "N",
821 "x": 7.25,
822 "y": 4.5
823 },
824 {
825 "label": "M",
826 "x": 8.25,
827 "y": 4.5
828 },
829 {
830 "label": "<",
831 "x": 9.25,
832 "y": 4.5
833 },
834 {
835 "label": ">",
836 "x": 10.25,
837 "y": 4.5
838 },
839 {
840 "label": "?",
841 "x": 11.25,
842 "y": 4.5
843 },
844 {
845 "label": "Shift",
846 "x": 12.25,
847 "y": 4.5,
848 "w": 2.75
849 },
850 {
851 "label": "\u2191",
852 "x": 16.25,
853 "y": 4.5
854 },
855 {
856 "label": "Ctrl",
857 "x": 0,
858 "y": 5.5,
859 "w": 1.25
860 },
861 {
862 "label": "Win",
863 "x": 1.25,
864 "y": 5.5,
865 "w": 1.25
866 },
867 {
868 "label": "Alt",
869 "x": 2.5,
870 "y": 5.5,
871 "w": 1.25
872 },
873 {
874 "x": 3.75,
875 "y": 5.5,
876 "w": 6.25
877 },
878 {
879 "label": "Alt",
880 "x": 10,
881 "y": 5.5,
882 "w": 1.25
883 },
884 {
885 "label": "Fn",
886 "x": 11.25,
887 "y": 5.5,
888 "w": 1.25
889 },
890 {
891 "label": "Menu",
892 "x": 12.5,
893 "y": 5.5,
894 "w": 1.25
895 },
896 {
897 "label": "Ctrl",
898 "x": 13.75,
899 "y": 5.5,
900 "w": 1.25
901 },
902 {
903 "label": "\u2190",
904 "x": 15.25,
905 "y": 5.5
906 },
907 {
908 "label": "\u2193",
909 "x": 16.25,
910 "y": 5.5
911 },
912 {
913 "label": "\u2192",
914 "x": 17.25,
915 "y": 5.5
916 }
917 ] 297 ]
918 } 298 }
919 } 299 }
diff --git a/keyboards/durgod/k320/k320.c b/keyboards/durgod/k320/k320.c
index f5500ea83..42091f36c 100644
--- a/keyboards/durgod/k320/k320.c
+++ b/keyboards/durgod/k320/k320.c
@@ -40,3 +40,23 @@ void led_init_ports(void) {
40 off_all_leds(); 40 off_all_leds();
41} 41}
42 42
43
44#ifndef WINLOCK_DISABLED
45static bool win_key_locked = false;
46
47bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
48 switch (keycode) {
49 case KC_TGUI:
50 if (record->event.pressed) {
51 // Toggle GUI lock on key press
52 win_key_locked = !win_key_locked;
53 writePin(LED_WIN_LOCK_PIN, !win_key_locked);
54 }
55 break;
56 case KC_LGUI:
57 if (win_key_locked) { return false; }
58 break;
59 }
60 return process_record_user(keycode, record);
61}
62#endif /* WINLOCK_DISABLED */
diff --git a/keyboards/durgod/k320/k320.h b/keyboards/durgod/k320/k320.h
index 48da04841..c504f5a2b 100644
--- a/keyboards/durgod/k320/k320.h
+++ b/keyboards/durgod/k320/k320.h
@@ -17,6 +17,17 @@
17 17
18#include "quantum.h" 18#include "quantum.h"
19 19
20#ifndef WINLOCK_DISABLED
21// Define the TGUI key here so it is available in QMK configurator
22enum K320_keycodes {
23 KC_TGUI = SAFE_RANGE, // Toggle between GUI Lock or Unlock
24 NEW_SAFE_RANGE
25};
26
27#undef SAFE_RANGE
28#define SAFE_RANGE NEW_SAFE_RANGE
29#endif /* WINLOCK_DISABLED */
30
20/* Function Prototype */ 31/* Function Prototype */
21void off_all_leds(void); 32void off_all_leds(void);
22void on_all_leds(void); 33void on_all_leds(void);
@@ -26,12 +37,12 @@ void on_all_leds(void);
26 37
27// This a shortcut to help you visually see your layout. 38// This a shortcut to help you visually see your layout.
28#define LAYOUT_tkl_ansi( \ 39#define LAYOUT_tkl_ansi( \
29 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \ 40 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \
30 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1E, K2E, K2F, K1F, \ 41 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1E, K2E, K2F, K1F, \
31 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K3D, K3E, K3F, \ 42 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K3D, K3E, K3F, \
32 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K4E, \ 43 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K4E, \
33 K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K4F, \ 44 K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K4F, \
34 K50, K51, K52, K56, K5A, K5B, K5C, K5D, K5E, K5F, K6F \ 45 K50, K51, K52, K56, K5A, K5B, K5C, K5D, K5E, K5F, K6F \
35) { \ 46) { \
36 { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, \ 47 { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, \
37 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, XXX, K1E, K1F }, \ 48 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, XXX, K1E, K1F }, \
@@ -45,10 +56,10 @@ void on_all_leds(void);
45 56
46// This a shortcut to help you visually see your layout. 57// This a shortcut to help you visually see your layout.
47#define LAYOUT_tkl_iso( \ 58#define LAYOUT_tkl_iso( \
48 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \ 59 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \
49 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1E, K2E, K2F, K1F, \ 60 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1E, K2E, K2F, K1F, \
50 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K4E, K3D, K3E, K3F, \ 61 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K3D, K3E, K3F, \
51 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, \ 62 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K4E, \
52 K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K4F, \ 63 K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K4F, \
53 K50, K51, K52, K56, K5A, K5B, K5C, K5D, K5E, K5F, K6F \ 64 K50, K51, K52, K56, K5A, K5B, K5C, K5D, K5E, K5F, K6F \
54) { \ 65) { \
@@ -64,7 +75,7 @@ void on_all_leds(void);
64 75
65// This a shortcut to help you visually see your layout. 76// This a shortcut to help you visually see your layout.
66#define LAYOUT_all( \ 77#define LAYOUT_all( \
67 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \ 78 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \
68 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1E, K2E, K2F, K1F, \ 79 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1E, K2E, K2F, K1F, \
69 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K3D, K3E, K3F, \ 80 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K3D, K3E, K3F, \
70 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K4E, \ 81 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K4E, \
diff --git a/keyboards/durgod/k320/keymaps/default/keymap.c b/keyboards/durgod/k320/keymaps/default/keymap.c
deleted file mode 100644
index 49a14ec29..000000000
--- a/keyboards/durgod/k320/keymaps/default/keymap.c
+++ /dev/null
@@ -1,95 +0,0 @@
1/* Copyright 2021 kuenhlee and Don Kjer
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17
18// Layer shorthand
19enum _layer {
20 _BASE,
21 _FUNC
22};
23
24static bool win_key_locked = false;
25
26// Defines the keycodes used by our macros in process_record_user
27enum custom_keycodes {
28 KC_TGUI = SAFE_RANGE // Toggle between GUI Lock or Unlock
29};
30
31const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32 /* Keymap _BASE: Base Layer (Default Layer)
33 * ,-----------------------------------------------------------. ,--------------.
34 * |Esc |f1| f2| f3| f4| | f5| f6| f7| f8| | f9|f10|f11|f12| |Prnt|ScLk|Paus|
35 * |-----------------------------------------------------------| |--------------|
36 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0| - | = |Backsp | | Ins|Home|PgUp|
37 * |-----------------------------------------------------------| |--------------|
38 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | Del| End|PgDn|
39 * |-----------------------------------------------------------| `--------------'
40 * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return |
41 * |-----------------------------------------------------------| ,----.
42 * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | | Up |
43 * |-----------------------------------------------------------| ,-------------.
44 * |Ctrl|Gui |Alt | Space |Alt |Func |App |Ctrl| |Lft| Dn |Rig |
45 * `-----------------------------------------------------------' `-------------'
46 */
47 [_BASE] = LAYOUT_tkl_ansi( /* Base Layer */
48 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_SLCK, KC_PAUS,
49 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,
50 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,
51 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,
52 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
53 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FUNC),KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
54 ),
55 /* Keymap _FUNC: Function Layer
56 * ,-----------------------------------------------------------. ,--------------.
57 * | |Play|Stop|Prev|Next| |Mute|Vol+|Vol-| | | | | | | | | | |
58 * |-----------------------------------------------------------| |--------------|
59 * | | | | | | | | | | | | | | | | | | |
60 * |-----------------------------------------------------------| |--------------|
61 * | | | | | | | | | | | | | | | | | | |
62 * |-----------------------------------------------------------| `--------------'
63 * | | | | | | | | | | | | | |
64 * |-----------------------------------------------------------| ,----.
65 * | | | | | | | | | | | | | | |
66 * |-----------------------------------------------------------| ,-------------.
67 * | |Lock| | | |Func | | | | | | |
68 * `-----------------------------------------------------------' `-------------'
69 */
70 [_FUNC] = LAYOUT_tkl_ansi( /* Function Layer */
71 _______, KC_MPLY, KC_MSTP, KC_MRWD, KC_MFFD, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______,
72 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
73 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
74 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
75 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
76 _______, KC_TGUI, _______, _______, _______, _______, _______, _______, _______, _______, _______
77 )
78};
79
80bool process_record_user(uint16_t keycode, keyrecord_t *record) {
81 switch (keycode) {
82 case KC_TGUI:
83 if (!record->event.pressed) {
84 // Toggle GUI lock on key release
85 win_key_locked = !win_key_locked;
86 writePin(LED_WIN_LOCK_PIN, !win_key_locked);
87 }
88 break;
89 case KC_LGUI:
90 if (win_key_locked) { return false; }
91 break;
92 }
93 return true;
94}
95
diff --git a/keyboards/durgod/k320/keymaps/default/keymap.json b/keyboards/durgod/k320/keymaps/default/keymap.json
new file mode 100644
index 000000000..d8242ae76
--- /dev/null
+++ b/keyboards/durgod/k320/keymaps/default/keymap.json
@@ -0,0 +1,26 @@
1{
2 "keyboard": "durgod/k320",
3 "keymap": "default",
4 "layout": "LAYOUT_all",
5 "layers": [
6 [
7 "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_SLCK", "KC_PAUS",
8 "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",
9 "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",
10 "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",
11 "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",
12 "KC_LCTL", "KC_LGUI", "KC_LALT", "KC_SPC", "KC_RALT", "MO(1)", "KC_APP", "KC_RCTL", "KC_LEFT", "KC_DOWN", "KC_RGHT"
13 ],
14 [
15 "KC_TRNS", "KC_MPLY", "KC_MSTP", "KC_MPRV", "KC_MNXT", "KC_MUTE", "KC_VOLD", "KC_VOLU", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS",
16 "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",
17 "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",
18 "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",
19 "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",
20 "KC_TRNS", "KC_TGUI", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"
21 ]
22 ],
23 "author":"dkjer",
24 "notes":"",
25 "version":1
26}
diff --git a/keyboards/durgod/k320/keymaps/default/readme.md b/keyboards/durgod/k320/keymaps/default/readme.md
index e26c79c8a..c94943a83 100644
--- a/keyboards/durgod/k320/keymaps/default/readme.md
+++ b/keyboards/durgod/k320/keymaps/default/readme.md
@@ -1,6 +1,8 @@
1# The default keymap for Durgod Taurus K320. 1# The default keymap for Durgod Taurus K320.
2 2
3Layer 0 : Standard ANSI 87 Keys TKL layout (Windows) 3Supports both ANSI and ISO layouts.
4
5Layer 0 : Standard 87/88 keys TKL layout (Windows)
4 6
5Layer 1 : Media control and Windows lock key 7Layer 1 : Media control and Windows lock key
6- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7 8- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7
diff --git a/keyboards/durgod/k320/keymaps/default_iso/keymap.c b/keyboards/durgod/k320/keymaps/default_iso/keymap.c
deleted file mode 100644
index 559b6fe71..000000000
--- a/keyboards/durgod/k320/keymaps/default_iso/keymap.c
+++ /dev/null
@@ -1,72 +0,0 @@
1/* Copyright 2021 kuenhlee and Don Kjer
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17
18// Layer shorthand
19enum _layer {
20 _BASE,
21 _FUNC
22};
23
24const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
25 /* Keymap _BASE: Base Layer (Default Layer)
26 * ,-----------------------------------------------------------. ,--------------.
27 * |Esc |f1| f2| f3| f4| | f5| f6| f7| f8| | f9|f10|f11|f12| |Prnt|ScLk|Paus|
28 * |-----------------------------------------------------------| |--------------|
29 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0| - | = |Backsp | | Ins|Home|PgUp|
30 * |-----------------------------------------------------------| |--------------|
31 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | Del| End|PgDn|
32 * |------------------------------------------------------ Ret | `--------------'
33 * |CAPS | A| S| D| F| G| H| J| K| L| ;| '| #| |
34 * |-----------------------------------------------------------| ,----.
35 * |Shift| \| Z| X| C| V| B| N| M| ,| .| /|Shift | | Up |
36 * |-----------------------------------------------------------| ,-------------.
37 * |Ctrl|Gui |Alt | Space |Alt | Fn |App |Ctrl| |Lft| Dn |Rig |
38 * `-----------------------------------------------------------' `-------------'
39 */
40 [_BASE] = LAYOUT_tkl_iso( /* Base Layer */
41 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_SLCK, KC_PAUS,
42 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,
43 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_ENT, KC_DEL, KC_END, KC_PGDN,
44 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,
45 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,
46 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FUNC),KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
47 ),
48 /* Keymap _FUNC: Function Layer
49 * ,-----------------------------------------------------------. ,--------------.
50 * | |Play|Stop|Prev|Next| |Mute|Vol+|Vol-| | | | | | | | | | |
51 * |-----------------------------------------------------------| |--------------|
52 * | | | | | | | | | | | | | | | | | | |
53 * |-----------------------------------------------------------| |--------------|
54 * | | | | | | | | | | | | | | | | | | |
55 * |------------------------------------------------------- | `--------------'
56 * | | | | | | | | | | | | | | |
57 * |-----------------------------------------------------------| ,----.
58 * | | | | | | | | | | | | | | | |
59 * |-----------------------------------------------------------| ,-------------.
60 * | | | | | |Func | | | | | | |
61 * `-----------------------------------------------------------' `-------------'
62 */
63 [_FUNC] = LAYOUT_tkl_iso( /* Function Layer */
64 _______, KC_MPLY, KC_MSTP, KC_MRWD, KC_MFFD, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______,
65 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
66 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
67 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
68 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
69 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
70 )
71};
72
diff --git a/keyboards/durgod/k320/keymaps/default_iso/readme.md b/keyboards/durgod/k320/keymaps/default_iso/readme.md
deleted file mode 100644
index a7d1d5f1d..000000000
--- a/keyboards/durgod/k320/keymaps/default_iso/readme.md
+++ /dev/null
@@ -1,7 +0,0 @@
1# The ISO keymap for Durgod Taurus K320.
2
3Layer 0 : Standard ISO 88 Keys TKL layout (Windows)
4
5Layer 1 : Media control and Windows lock key
6- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7
7
diff --git a/keyboards/durgod/k320/keymaps/default_iso_mac/keymap.c b/keyboards/durgod/k320/keymaps/default_iso_mac/keymap.c
deleted file mode 100644
index 783fc45f1..000000000
--- a/keyboards/durgod/k320/keymaps/default_iso_mac/keymap.c
+++ /dev/null
@@ -1,71 +0,0 @@
1/* Copyright 2021 kuenhlee and Don Kjer
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17
18// Layer shorthand
19enum _layer {
20 _BASE,
21 _FUNC
22};
23
24const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
25 /* Keymap _BASE: Base Layer (Default Layer)
26 * ,-----------------------------------------------------------. ,--------------.
27 * |Esc |f1| f2| f3| f4| | f5| f6| f7| f8| | f9|f10|f11|f12| |Prnt|ScLk|Paus|
28 * |-----------------------------------------------------------| |--------------|
29 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0| - | = |Backsp | | Ins|Home|PgUp|
30 * |-----------------------------------------------------------| |--------------|
31 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | Del| End|PgDn|
32 * |------------------------------------------------------ Ret | `--------------'
33 * |CAPS | A| S| D| F| G| H| J| K| L| ;| '| #| |
34 * |-----------------------------------------------------------| ,----.
35 * |Shift| \| Z| X| C| V| B| N| M| ,| .| /|Shift | | Up |
36 * |-----------------------------------------------------------| ,-------------.
37 * |Ctrl|Alt |Gui | Space |Alt | Fn |App |Ctrl| |Lft| Dn |Rig |
38 * `-----------------------------------------------------------' `-------------'
39 */
40 [_BASE] = LAYOUT_tkl_iso( /* Base Layer */
41 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_SLCK, KC_PAUS,
42 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,
43 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_ENT, KC_DEL, KC_END, KC_PGDN,
44 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,
45 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,
46 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(_FUNC),KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
47 ),
48 /* Keymap _FUNC: Function Layer
49 * ,-----------------------------------------------------------. ,--------------.
50 * | |Play|Stop|Prev|Next| |Mute|Vol+|Vol-| | | | | | | | | | |
51 * |-----------------------------------------------------------| |--------------|
52 * | | | | | | | | | | | | | | | | | | |
53 * |-----------------------------------------------------------| |--------------|
54 * | | | | | | | | | | | | | | | | | | |
55 * |------------------------------------------------------- | `--------------'
56 * | | | | | | | | | | | | | | |
57 * |-----------------------------------------------------------| ,----.
58 * | | | | | | | | | | | | | | | |
59 * |-----------------------------------------------------------| ,-------------.
60 * | | | | | |Func | | | | | | |
61 * `-----------------------------------------------------------' `-------------'
62 */
63 [_FUNC] = LAYOUT_tkl_iso( /* Function Layer */
64 _______, KC_MPLY, KC_MSTP, KC_MRWD, KC_MFFD, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______,
65 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
66 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
67 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
68 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
69 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
70 )
71};
diff --git a/keyboards/durgod/k320/keymaps/default_iso_mac/readme.md b/keyboards/durgod/k320/keymaps/default_iso_mac/readme.md
deleted file mode 100644
index 354f7b4cb..000000000
--- a/keyboards/durgod/k320/keymaps/default_iso_mac/readme.md
+++ /dev/null
@@ -1,6 +0,0 @@
1# The ISO (Mac) keymap for Durgod Taurus K320.
2
3Layer 0 : Standard ISO 88 Keys TKL layout (Mac)
4
5Layer 1 : Media control
6- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7
diff --git a/keyboards/durgod/k320/keymaps/default_mac/keymap.json b/keyboards/durgod/k320/keymaps/default_mac/keymap.json
new file mode 100644
index 000000000..dc5d3d3fd
--- /dev/null
+++ b/keyboards/durgod/k320/keymaps/default_mac/keymap.json
@@ -0,0 +1,26 @@
1{
2 "keyboard": "durgod/k320",
3 "keymap": "default_mac",
4 "layout": "LAYOUT_all",
5 "layers": [
6 [
7 "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_F13", "KC_F14", "KC_F15",
8 "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",
9 "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",
10 "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",
11 "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",
12 "KC_LCTL", "KC_LALT", "KC_LGUI", "KC_SPC", "KC_RGUI", "KC_RALT", "MO(1)", "KC_RCTL", "KC_LEFT", "KC_DOWN", "KC_RGHT"
13 ],
14 [
15 "KC_TRNS", "KC_MPLY", "KC_MSTP", "KC_MPRV", "KC_MNXT", "KC_MUTE", "KC_VOLD", "KC_VOLU", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS",
16 "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",
17 "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",
18 "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",
19 "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",
20 "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"
21 ]
22 ],
23 "author":"AlCutter",
24 "notes":"",
25 "version":1
26}
diff --git a/keyboards/durgod/k320/keymaps/default_mac/readme.md b/keyboards/durgod/k320/keymaps/default_mac/readme.md
new file mode 100644
index 000000000..2765f14f9
--- /dev/null
+++ b/keyboards/durgod/k320/keymaps/default_mac/readme.md
@@ -0,0 +1,8 @@
1# The default (Mac) keymap for Durgod Taurus K320.
2
3Supports both ANSI and ISO layouts.
4
5Layer 0 : Standard 87/88 keys TKL layout (Mac)
6
7Layer 1 : Media control
8- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7
diff --git a/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/keymap.c b/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/keymap.c
index 834d2ca55..8494fbe03 100644
--- a/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/keymap.c
+++ b/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/keymap.c
@@ -59,20 +59,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
59 * |-----------------------------------------------------------| |--------------| 59 * |-----------------------------------------------------------| |--------------|
60 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | Del| End|PgDn| 60 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | Del| End|PgDn|
61 * |-----------------------------------------------------------| `--------------' 61 * |-----------------------------------------------------------| `--------------'
62 * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | 62 * |CAPS | A| S| D| F| G| H| J| K| L| ;| '| #|Ret |
63 * |-----------------------------------------------------------| ,----. 63 * |-----------------------------------------------------------| ,----.
64 * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | | Up | 64 * |Shift| \| Z| X| C| V| B| N| M| ,| .| /|Shift | | Up |
65 * |-----------------------------------------------------------| ,-------------. 65 * |-----------------------------------------------------------| ,-------------.
66 * |Ctrl|Gui |Alt | Space |Alt |Func |App|Ctrl | |Lft| Dn |Rig | 66 * |Ctrl|Gui |Alt | Space |Alt |Func |App|Ctrl | |Lft| Dn |Rig |
67 * `-----------------------------------------------------------' `-------------' 67 * `-----------------------------------------------------------' `-------------'
68 */ 68 */
69 [_WBL] = LAYOUT_tkl_ansi( /* Windows Base Layer */ 69 [_WBL] = LAYOUT_all( /* Windows Base Layer */
70 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_SLCK, KC_PAUS, 70 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_SLCK, KC_PAUS,
71 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, 71 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,
72 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, 72 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,
73 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, 73 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,
74 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, 74 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,
75 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_WFN, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT 75 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_WFN, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
76 ), 76 ),
77 /* Keymap _WFL: Windows Function Layer 77 /* Keymap _WFL: Windows Function Layer
78 * ,-----------------------------------------------------------. ,--------------. 78 * ,-----------------------------------------------------------. ,--------------.
@@ -82,20 +82,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
82 * |-----------------------------------------------------------| |--------------| 82 * |-----------------------------------------------------------| |--------------|
83 * | | | | | | | | | | | | | | | | | | | 83 * | | | | | | | | | | | | | | | | | | |
84 * |-----------------------------------------------------------| `--------------' 84 * |-----------------------------------------------------------| `--------------'
85 * | | | | | | | | | | | | | | 85 * | | | | | | | | | | | | | | |
86 * |-----------------------------------------------------------| ,----. 86 * |-----------------------------------------------------------| ,----.
87 * | | | | | | | | | | | | | | | 87 * | | | | | | | | | | | | | | | |
88 * |-----------------------------------------------------------| ,-------------. 88 * |-----------------------------------------------------------| ,-------------.
89 * | |Lock| | | |Func |Sys| | | | | | 89 * | |Lock| | | |Func |Sys| | | | | |
90 * `-----------------------------------------------------------' `-------------' 90 * `-----------------------------------------------------------' `-------------'
91 */ 91 */
92 [_WFL] = LAYOUT_tkl_ansi( /* Windows First Layer */ 92 [_WFL] = LAYOUT_all( /* Windows First Layer */
93 _______, KC_MPLY, KC_MSTP, KC_MRWD, KC_MFFD, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______, 93 _______, KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______,
94 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 94 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
95 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 95 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
96 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 96 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
97 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 97 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
98 _______, KC_TGUI, _______, _______, _______, _______, MO_WSL, _______, _______, _______, _______ 98 _______, KC_TGUI, _______, _______, _______, _______, MO_WSL, _______, _______, _______, _______
99 ), 99 ),
100 /* Keymap _WSL: Windows System Layer 100 /* Keymap _WSL: Windows System Layer
101 * ,-----------------------------------------------------------. ,--------------. 101 * ,-----------------------------------------------------------. ,--------------.
@@ -105,20 +105,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
105 * |-----------------------------------------------------------| |--------------| 105 * |-----------------------------------------------------------| |--------------|
106 * | | | | | | | | | | | | | | | | | | | 106 * | | | | | | | | | | | | | | | | | | |
107 * |-----------------------------------------------------------| `--------------' 107 * |-----------------------------------------------------------| `--------------'
108 * | | | | | | | | | | | | | | 108 * | | | | | | | | | | | | | | |
109 * |-----------------------------------------------------------| ,----. 109 * |-----------------------------------------------------------| ,----.
110 * | | | | | | | | | | | | | | | 110 * | | | | | | | | | | | | | | | |
111 * |-----------------------------------------------------------| ,-------------. 111 * |-----------------------------------------------------------| ,-------------.
112 * | | | | | |Func |Sys| | | | | | 112 * | | | | | |Func |Sys| | | | | |
113 * `-----------------------------------------------------------' `-------------' 113 * `-----------------------------------------------------------' `-------------'
114 */ 114 */
115 [_WSL] = LAYOUT_tkl_ansi( /* Windows Second / System Layer */ 115 [_WSL] = LAYOUT_all( /* Windows Second / System Layer */
116 RESET, KC_SLEP, XXXXXXX, XXXXXXX, KC_PWR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DF_W2MBL, XXXXXXX, XXXXXXX, XXXXXXX, 116 RESET, KC_SLEP, XXXXXXX, XXXXXXX, KC_PWR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DF_W2MBL, XXXXXXX, XXXXXXX, XXXXXXX,
117 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, 117 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
118 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, 118 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
119 XXXXXXX, XXXXXXX, XXXXXXX, DEBUG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, 119 XXXXXXX, XXXXXXX, XXXXXXX, DEBUG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
120 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, 120 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
121 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX 121 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
122 ), 122 ),
123 123
124 /* Keymap _MBL: Mac Base Layer (Alternate Layout) 124 /* Keymap _MBL: Mac Base Layer (Alternate Layout)
@@ -129,20 +129,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
129 * |-----------------------------------------------------------| |--------------| 129 * |-----------------------------------------------------------| |--------------|
130 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | Del| End|PgDn| 130 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | Del| End|PgDn|
131 * |-----------------------------------------------------------| `--------------' 131 * |-----------------------------------------------------------| `--------------'
132 * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | 132 * |CAPS | A| S| D| F| G| H| J| K| L| ;| '| #|Ret |
133 * |-----------------------------------------------------------| ,----. 133 * |-----------------------------------------------------------| ,----.
134 * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | | Up | 134 * |Shift| \| Z| X| C| V| B| N| M| ,| .| /|Shift | | Up |
135 * |-----------------------------------------------------------| ,-------------. 135 * |-----------------------------------------------------------| ,-------------.
136 * |Ctrl|Alt |Gui | Space |Gui |Alt|Func |Ctrl | |Lft| Dn |Rig | 136 * |Ctrl|Alt |Gui | Space |Gui |Alt|Func |Ctrl | |Lft| Dn |Rig |
137 * `-----------------------------------------------------------' `-------------' 137 * `-----------------------------------------------------------' `-------------'
138 */ 138 */
139 [_MBL] = LAYOUT_tkl_ansi( /* Mac Base Layer */ 139 [_MBL] = LAYOUT_all( /* Mac Base Layer */
140 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_F13, KC_F14, KC_F15, 140 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_F13, KC_F14, KC_F15,
141 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, 141 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,
142 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, 142 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,
143 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, 143 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,
144 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, 144 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,
145 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, KC_MFN, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT 145 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, KC_MFN, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
146 ), 146 ),
147 /* Keymap _MFL: Mac Function Layer 147 /* Keymap _MFL: Mac Function Layer
148 * ,-----------------------------------------------------------. ,--------------. 148 * ,-----------------------------------------------------------. ,--------------.
@@ -152,20 +152,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
152 * |-----------------------------------------------------------| |--------------| 152 * |-----------------------------------------------------------| |--------------|
153 * | | | | | | | | | | | | | | | | | | | 153 * | | | | | | | | | | | | | | | | | | |
154 * |-----------------------------------------------------------| `--------------' 154 * |-----------------------------------------------------------| `--------------'
155 * | | | | | | | | | | | | | | 155 * | | | | | | | | | | | | | | |
156 * |-----------------------------------------------------------| ,----. 156 * |-----------------------------------------------------------| ,----.
157 * | | | | | | | | | | | | | | | 157 * | | | | | | | | | | | | | | | |
158 * |-----------------------------------------------------------| ,-------------. 158 * |-----------------------------------------------------------| ,-------------.
159 * | | | | | |Sys|Func | | | | | | 159 * | | | | | |Sys|Func | | | | | |
160 * `-----------------------------------------------------------' `-------------' 160 * `-----------------------------------------------------------' `-------------'
161 */ 161 */
162 [_MFL] = LAYOUT_tkl_ansi( /* Mac First Layer */ 162 [_MFL] = LAYOUT_all( /* Mac First Layer */
163 _______, KC_BRID, KC_BRIU, _______, _______, _______, _______, KC_MRWD, KC_MPLY, KC_MFFD, KC_MUTE, KC_VOLD, KC_VOLU, KC_TMED, _______, _______, 163 _______, KC_BRID, KC_BRIU, _______, _______, _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TMED, _______, _______,
164 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 164 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
165 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 165 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
166 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 166 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
167 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 167 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
168 _______, _______, _______, _______, _______, MO_MSL, _______, _______, _______, _______, _______ 168 _______, _______, _______, _______, _______, MO_MSL, _______, _______, _______, _______, _______
169 ), 169 ),
170 /* Keymap _MSL: Mac System Layer 170 /* Keymap _MSL: Mac System Layer
171 * ,-----------------------------------------------------------. ,--------------. 171 * ,-----------------------------------------------------------. ,--------------.
@@ -175,20 +175,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
175 * |-----------------------------------------------------------| |--------------| 175 * |-----------------------------------------------------------| |--------------|
176 * | | | | | | | | | | | | | | | | | | | 176 * | | | | | | | | | | | | | | | | | | |
177 * |-----------------------------------------------------------| `--------------' 177 * |-----------------------------------------------------------| `--------------'
178 * | | | | | | | | | | | | | | 178 * | | | | | | | | | | | | | | |
179 * |-----------------------------------------------------------| ,----. 179 * |-----------------------------------------------------------| ,----.
180 * | | | | | | | | | | | | | | | 180 * | | | | | | | | | | | | | | | |
181 * |-----------------------------------------------------------| ,-------------. 181 * |-----------------------------------------------------------| ,-------------.
182 * | | | | | |Sys|Func | | | | | | 182 * | | | | | |Sys|Func | | | | | |
183 * `-----------------------------------------------------------' `-------------' 183 * `-----------------------------------------------------------' `-------------'
184 */ 184 */
185 [_MSL] = LAYOUT_tkl_ansi( /* Mac Second / System Layer */ 185 [_MSL] = LAYOUT_all( /* Mac Second / System Layer */
186 RESET, XXXXXXX, XXXXXXX, XXXXXXX, KC_SLEP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DF_M2WBL, XXXXXXX, XXXXXXX, XXXXXXX, 186 RESET, XXXXXXX, XXXXXXX, XXXXXXX, KC_SLEP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DF_M2WBL, XXXXXXX, XXXXXXX, XXXXXXX,
187 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, 187 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
188 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, 188 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
189 XXXXXXX, XXXXXXX, XXXXXXX, DEBUG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, 189 XXXXXXX, XXXXXXX, XXXXXXX, DEBUG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
190 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, 190 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
191 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX 191 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
192 ) 192 )
193}; 193};
194 194
diff --git a/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/readme.md b/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/readme.md
index 821c8b26a..0eef77fd4 100644
--- a/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/readme.md
+++ b/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/readme.md
@@ -1,6 +1,8 @@
1# A keymap for Durgod Taurus K320 that supports toggling between Mac and Windows 1# A keymap for Durgod Taurus K320 that supports toggling between Mac and Windows
2 2
3Layer 0 : Standard ANSI 87 Keys TKL layout (Windows) 3Supports both ANSI and ISO layouts.
4
5Layer 0 : Standard 87/88 keys TKL layout (Windows)
4 6
5Layer 1 : Media control and Windows lock key (Windows) 7Layer 1 : Media control and Windows lock key (Windows)
6- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7 8- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7
@@ -12,7 +14,7 @@ Layer 2 : System layer (Windows)
12- Fn + Menu + F4 : Turning Off System 14- Fn + Menu + F4 : Turning Off System
13- Fn + Menu + F12 : Switch to Mac layout 15- Fn + Menu + F12 : Switch to Mac layout
14 16
15Layer 3 : Mac 87 Keys TKL layout 17Layer 3 : Mac 87/88 keys TKL layout
16 18
17Layer 4 : Media control and Media lock key (Mac) 19Layer 4 : Media control and Media lock key (Mac)
18 - Standard Mac Media keys for Fn + F1 ~ Fn + F12. 20 - Standard Mac Media keys for Fn + F1 ~ Fn + F12.
@@ -61,4 +63,3 @@ For repeating Flashing you have two options with this keymap:
612. Use key combination if using default keymap 632. Use key combination if using default keymap
62- Hold down Fn + Menu (Windows Layout) or Fn + Right-Alt (Mac layout) (These are the same physical keys) 64- Hold down Fn + Menu (Windows Layout) or Fn + Right-Alt (Mac layout) (These are the same physical keys)
63- Press Esc. Keyboard should go into booloader state. 65- Press Esc. Keyboard should go into booloader state.
64
diff --git a/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/rules.mk b/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/rules.mk
new file mode 100644
index 000000000..19843e8a2
--- /dev/null
+++ b/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/rules.mk
@@ -0,0 +1 @@
OPT_DEFS += -DWINLOCK_DISABLED
diff --git a/keyboards/durgod/k320/keymaps/kuenhlee/keymap.c b/keyboards/durgod/k320/keymaps/kuenhlee/keymap.c
index bf79f24db..866e522fc 100644
--- a/keyboards/durgod/k320/keymaps/kuenhlee/keymap.c
+++ b/keyboards/durgod/k320/keymaps/kuenhlee/keymap.c
@@ -35,11 +35,6 @@
35#define KC_STOP LCTL(LSFT(KC_HOME)) // Select from Cursor to Home 35#define KC_STOP LCTL(LSFT(KC_HOME)) // Select from Cursor to Home
36#define KC_SEND LCTL(LSFT(KC_END)) // Select from Cursor to End 36#define KC_SEND LCTL(LSFT(KC_END)) // Select from Cursor to End
37 37
38// Defines the keycodes used by our macros in process_record_user
39enum custom_keycodes {
40 KC_TGUI = SAFE_RANGE // Toggle between GUI Lock or Unlock
41};
42
43// °±²³µ©ΩθΩ√∞∆≈≠→↓←↑≡■□●○∴«»÷≤≥Σ 38// °±²³µ©ΩθΩ√∞∆≈≠→↓←↑≡■□●○∴«»÷≤≥Σ
44// Defines the Enumeration for Unicode Map 39// Defines the Enumeration for Unicode Map
45enum unicode_names { 40enum unicode_names {
diff --git a/keyboards/durgod/k320/keymaps/via/keymap.c b/keyboards/durgod/k320/keymaps/via/keymap.c
index 9a4d9ff38..fc46e3860 100644
--- a/keyboards/durgod/k320/keymaps/via/keymap.c
+++ b/keyboards/durgod/k320/keymaps/via/keymap.c
@@ -1,4 +1,4 @@
1/* Copyright 2021 kuenhlee and Don Kjer 1/* Copyright 2021 Maxime Coirault
2 * 2 *
3 * This program is free software: you can redistribute it and/or modify 3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by 4 * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,8 @@
19enum _layer { 19enum _layer {
20 _BASE, 20 _BASE,
21 _FUNC, 21 _FUNC,
22 _LAYER3 22 _LAYER3,
23 _LAYER4
23}; 24};
24 25
25const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 26const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -39,12 +40,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 * `-----------------------------------------------------------' `-------------' 40 * `-----------------------------------------------------------' `-------------'
40 */ 41 */
41 [_BASE] = LAYOUT_all( /* Base Layer */ 42 [_BASE] = LAYOUT_all( /* Base Layer */
42 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_SLCK, KC_PAUS, 43 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_SLCK, KC_PAUS,
43 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, 44 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,
44 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, 45 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,
45 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, 46 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,
46 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, 47 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,
47 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FUNC),KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT 48 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FUNC),KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
48 ), 49 ),
49 /* Keymap _FUNC: Function Layer 50 /* Keymap _FUNC: Function Layer
50 * ,-----------------------------------------------------------. ,--------------. 51 * ,-----------------------------------------------------------. ,--------------.
@@ -62,20 +63,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
62 * `-----------------------------------------------------------' `-------------' 63 * `-----------------------------------------------------------' `-------------'
63 */ 64 */
64 [_FUNC] = LAYOUT_all( /* Function Layer */ 65 [_FUNC] = LAYOUT_all( /* Function Layer */
65 _______, KC_MPLY, KC_MSTP, KC_MRWD, KC_MFFD, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______, 66 _______, KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______,
66 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 67 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
67 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 68 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
68 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 69 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
69 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 70 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
70 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ 71 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
71 ), 72 ),
72 [_LAYER3] = LAYOUT_all( /* Function Layer */ 73 [_LAYER3] = LAYOUT_all( /* Layer 3 */
73 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 74 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
74 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 75 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
75 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 76 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
76 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 77 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
77 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 78 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
78 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ 79 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
79 ), 80 ),
81 [_LAYER4] = LAYOUT_all( /* Layer 4 */
82 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
83 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
84 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
85 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
86 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
87 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
88 )
80}; 89};
81 90
diff --git a/keyboards/durgod/k320/keymaps/via/readme.md b/keyboards/durgod/k320/keymaps/via/readme.md
index 1ed99238c..d1b2ac191 100644
--- a/keyboards/durgod/k320/keymaps/via/readme.md
+++ b/keyboards/durgod/k320/keymaps/via/readme.md
@@ -1,6 +1,6 @@
1# The default keymap for Durgod Taurus K320. 1# The default keymap for Durgod Taurus K320.
2 2
3Layer 0 : Standard Keys TKL layout 3Layer 0 : Standard 87/88 keys TKL layout
4 4
5Layer 1 : Media control 5Layer 1 : Media control
6- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7 6- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7
diff --git a/keyboards/durgod/k320/keymaps/via/rules.mk b/keyboards/durgod/k320/keymaps/via/rules.mk
index 36b7ba9cb..8815b6a0a 100644
--- a/keyboards/durgod/k320/keymaps/via/rules.mk
+++ b/keyboards/durgod/k320/keymaps/via/rules.mk
@@ -1,2 +1,4 @@
1OPT_DEFS += -DWINLOCK_DISABLED
2
1VIA_ENABLE = yes 3VIA_ENABLE = yes
2LTO_ENABLE = yes 4LTO_ENABLE = yes
diff --git a/keyboards/durgod/k320/readme.md b/keyboards/durgod/k320/readme.md
index 115029435..551a29282 100644
--- a/keyboards/durgod/k320/readme.md
+++ b/keyboards/durgod/k320/readme.md
@@ -1,6 +1,6 @@
1# K320 1# K320
2 2
3This is a standard fixed ANSI TKL from off the shelf Durgod Taurus K320 without Backlight. 3This is a standard off-the-shelf Durgod Taurus K320 TKL (87/88-key) keyboard without backlight.
4 4
5* Keyboard Maintainer: [dkjer](https://github.com/dkjer) 5* Keyboard Maintainer: [dkjer](https://github.com/dkjer)
6* Hardware Supported: Durgod Taurus K320 board with STM32F070RBT6 6* Hardware Supported: Durgod Taurus K320 board with STM32F070RBT6
@@ -30,7 +30,7 @@ For first Flashing from initial Stock's Firmware
30- Plug In USB 30- Plug In USB
31- Make a Flash Image's Backup in case you wanted to restore the Keyboard to Stock's Image: 31- Make a Flash Image's Backup in case you wanted to restore the Keyboard to Stock's Image:
32 - Using DFUseDemo.exe from ST's STSW-STM32080: https://www.st.com/en/development-tools/stsw-stm32080.html 32 - Using DFUseDemo.exe from ST's STSW-STM32080: https://www.st.com/en/development-tools/stsw-stm32080.html
33 - Using dfu-util (thanks to [tylert](https://github.com/tylert) for instructions!): 33 - Using dfu-util:
34 34
35 dfu-util --list 35 dfu-util --list
36 dfu-util --alt 0 --dfuse-address 0x08000000 --upload ${OLD_STOCK_BIN} 36 dfu-util --alt 0 --dfuse-address 0x08000000 --upload ${OLD_STOCK_BIN}
@@ -55,4 +55,3 @@ For repeating Flashing you can use BootMagic:
55- Unplug USB Cable 55- Unplug USB Cable
56- Holding Esc Button 56- Holding Esc Button
57- Plug in USB Cable, Keyboard should be in ST-Bootloader state 57- Plug in USB Cable, Keyboard should be in ST-Bootloader state
58
diff --git a/keyboards/durgod/k320/rules.mk b/keyboards/durgod/k320/rules.mk
index 040ea2dc8..7e910174f 100644
--- a/keyboards/durgod/k320/rules.mk
+++ b/keyboards/durgod/k320/rules.mk
@@ -2,7 +2,7 @@
2# Actually F070, but close enough 2# Actually F070, but close enough
3MCU = STM32F072 3MCU = STM32F072
4 4
5BOARD = ST_NUCLEO64_F070RB 5BOARD = DURGOD_STM32_F070
6 6
7# Do not put the microcontroller into power saving mode 7# Do not put the microcontroller into power saving mode
8OPT_DEFS += -DNO_SUSPEND_POWER_DOWN 8OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
diff --git a/keyboards/handwired/ck4x4/rules.mk b/keyboards/handwired/ck4x4/rules.mk
index 0709f341b..e5785270b 100644
--- a/keyboards/handwired/ck4x4/rules.mk
+++ b/keyboards/handwired/ck4x4/rules.mk
@@ -10,7 +10,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys
10EXTRAKEY_ENABLE = yes # Audio control and System control 10EXTRAKEY_ENABLE = yes # Audio control and System control
11CONSOLE_ENABLE = yes # Console for debug 11CONSOLE_ENABLE = yes # Console for debug
12COMMAND_ENABLE = yes # Commands for debug and configuration 12COMMAND_ENABLE = yes # Commands for debug and configuration
13SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 13SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
14NKRO_ENABLE = yes # USB Nkey Rollover 14NKRO_ENABLE = yes # USB Nkey Rollover
15CUSTOM_MATRIX = no # Custom matrix file 15CUSTOM_MATRIX = no # Custom matrix file
16 16
diff --git a/keyboards/handwired/onekey/rules.mk b/keyboards/handwired/onekey/rules.mk
index 259050d55..df2ec1ecf 100644
--- a/keyboards/handwired/onekey/rules.mk
+++ b/keyboards/handwired/onekey/rules.mk
@@ -7,9 +7,9 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
7CONSOLE_ENABLE = yes # Console for debug(+400) 7CONSOLE_ENABLE = yes # Console for debug(+400)
8COMMAND_ENABLE = no # Commands for debug and configuration 8COMMAND_ENABLE = no # Commands for debug and configuration
9# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 9# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
10SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 10SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
11# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 11# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
12NKRO_ENABLE = yes # USB Nkey Rollover 12NKRO_ENABLE = yes # USB Nkey Rollover
13BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default 13BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
14RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow 14RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
15MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) 15MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
diff --git a/keyboards/projectkb/alice/config.h b/keyboards/projectkb/alice/config.h
new file mode 100644
index 000000000..95fb682e1
--- /dev/null
+++ b/keyboards/projectkb/alice/config.h
@@ -0,0 +1,3 @@
1#pragma once
2
3#define SLEEP_LED_GPT_DRIVER GPTD1
diff --git a/keyboards/projectkb/alice/halconf.h b/keyboards/projectkb/alice/halconf.h
index b17808ffe..0016e53ba 100644
--- a/keyboards/projectkb/alice/halconf.h
+++ b/keyboards/projectkb/alice/halconf.h
@@ -27,5 +27,7 @@
27 27
28#define HAL_USE_SPI TRUE 28#define HAL_USE_SPI TRUE
29 29
30#define HAL_USE_GPT TRUE
31
30#include_next <halconf.h> 32#include_next <halconf.h>
31 33
diff --git a/keyboards/projectkb/alice/mcuconf.h b/keyboards/projectkb/alice/mcuconf.h
index 4bfc7f946..6e0f1a50d 100644
--- a/keyboards/projectkb/alice/mcuconf.h
+++ b/keyboards/projectkb/alice/mcuconf.h
@@ -32,3 +32,5 @@
32#undef STM32_SPI_USE_SPI2 32#undef STM32_SPI_USE_SPI2
33#define STM32_SPI_USE_SPI2 TRUE 33#define STM32_SPI_USE_SPI2 TRUE
34 34
35#undef STM32_GPT_USE_TIM1
36#define STM32_GPT_USE_TIM1 TRUE
diff --git a/keyboards/projectkb/signature87/rules.mk b/keyboards/projectkb/signature87/rules.mk
index fe0d976d1..caad4c83c 100644
--- a/keyboards/projectkb/signature87/rules.mk
+++ b/keyboards/projectkb/signature87/rules.mk
@@ -9,7 +9,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys
9EXTRAKEY_ENABLE = yes # Audio control and System control 9EXTRAKEY_ENABLE = yes # Audio control and System control
10CONSOLE_ENABLE = yes # Console for debug 10CONSOLE_ENABLE = yes # Console for debug
11COMMAND_ENABLE = yes # Commands for debug and configuration 11COMMAND_ENABLE = yes # Commands for debug and configuration
12SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 12SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
13NKRO_ENABLE = yes # USB Nkey Rollover 13NKRO_ENABLE = yes # USB Nkey Rollover
14BACKLIGHT_ENABLE = no 14BACKLIGHT_ENABLE = no
15 15
diff --git a/keyboards/ramonimbao/wete/config.h b/keyboards/ramonimbao/wete/config.h
index 5d68a7efd..3d8955009 100644
--- a/keyboards/ramonimbao/wete/config.h
+++ b/keyboards/ramonimbao/wete/config.h
@@ -46,6 +46,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
46#define RGBLED_NUM 24 46#define RGBLED_NUM 24
47#define RGBLIGHT_ANIMATIONS 47#define RGBLIGHT_ANIMATIONS
48 48
49#define SLEEP_LED_GPT_DRIVER GPTD1
50
49/* define if matrix has ghost */ 51/* define if matrix has ghost */
50//#define MATRIX_HAS_GHOST 52//#define MATRIX_HAS_GHOST
51 53
diff --git a/keyboards/ramonimbao/wete/halconf.h b/keyboards/ramonimbao/wete/halconf.h
index c43440a45..b3de873be 100644
--- a/keyboards/ramonimbao/wete/halconf.h
+++ b/keyboards/ramonimbao/wete/halconf.h
@@ -23,5 +23,7 @@
23 23
24#define HAL_USE_PWM TRUE 24#define HAL_USE_PWM TRUE
25 25
26#define HAL_USE_GPT TRUE
27
26#include_next <halconf.h> 28#include_next <halconf.h>
27 29
diff --git a/keyboards/ramonimbao/wete/mcuconf.h b/keyboards/ramonimbao/wete/mcuconf.h
index b7f2c481c..7a2e87776 100644
--- a/keyboards/ramonimbao/wete/mcuconf.h
+++ b/keyboards/ramonimbao/wete/mcuconf.h
@@ -35,3 +35,5 @@
35#undef STM32_SPI_USE_SPI2 35#undef STM32_SPI_USE_SPI2
36#define STM32_SPI_USE_SPI2 TRUE 36#define STM32_SPI_USE_SPI2 TRUE
37 37
38#undef STM32_GPT_USE_TIM1
39#define STM32_GPT_USE_TIM1 TRUE
diff --git a/keyboards/readme.md b/keyboards/readme.md
index 6b7b92e0c..a23d0845b 100644
--- a/keyboards/readme.md
+++ b/keyboards/readme.md
@@ -63,4 +63,4 @@ These keyboards are part of the QMK repository, but their manufacturers are not
63* [Vision Division](/keyboards/vision_division) &mdash; Full Size / Split Linear Keyboard by IBNobody. 63* [Vision Division](/keyboards/vision_division) &mdash; Full Size / Split Linear Keyboard by IBNobody.
64* [XD004](/keyboards/xd004) &mdash; 1x4 macro keyboard sold by KPrepublic. 64* [XD004](/keyboards/xd004) &mdash; 1x4 macro keyboard sold by KPrepublic.
65* [XD75](/keyboards/xd75) &mdash; 15x5 ortholinear keyboard by XIUDI. 65* [XD75](/keyboards/xd75) &mdash; 15x5 ortholinear keyboard by XIUDI.
66* [YMDK NP21](/keyboards/ymdk_np21) &mdash; ps2avrGB based number pad (numpad) sold by YMDK on Aliexpress. 66* [YMDK NP21](/keyboards/ymdk_np21) &mdash; ps2avrGB based number pad (numpad) sold by YMDK on Aliexpress.
diff --git a/keyboards/rgbkb/zygomorph/keymaps/xulkal/rules.mk b/keyboards/rgbkb/zygomorph/keymaps/xulkal/rules.mk
index 78969ad7a..d7d50e137 100644
--- a/keyboards/rgbkb/zygomorph/keymaps/xulkal/rules.mk
+++ b/keyboards/rgbkb/zygomorph/keymaps/xulkal/rules.mk
@@ -8,11 +8,13 @@ EXTRAKEY_ENABLE = yes # Audio control and System control
8CONSOLE_ENABLE = no # Console for debug 8CONSOLE_ENABLE = no # Console for debug
9COMMAND_ENABLE = no # Commands for debug and configuration 9COMMAND_ENABLE = no # Commands for debug and configuration
10NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 10NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
11RGBLIGHT_ENABLE = yes # Enable global lighting effects. Do not enable with RGB Matrix 11RGBLIGHT_ENABLE = no # Enable global lighting effects. Do not enable with RGB Matrix
12RGBLIGHT_ANIMATIONS = yes # LED animations 12RGBLIGHT_ANIMATIONS = no # LED animations
13RGBLIGHT_SPLIT_ENABLE = yes # Split RGBLight Support 13RGBLIGHT_SPLIT_ENABLE = no # Split RGBLight Support
14RGB_MATRIX_ENABLE = no # Enable per-key coordinate based RGB effects. Do not enable with RGBlight 14RGB_MATRIX_ENABLE = yes # Enable per-key coordinate based RGB effects. Do not enable with RGBlight
15RGB_MATRIX_DRIVER = WS2812
15RGB_MATRIX_KEYPRESSES = no # Enable reactive per-key effects. 16RGB_MATRIX_KEYPRESSES = no # Enable reactive per-key effects.
17SPLIT_RGB_MATRIX_ENABLE = yes # For split RGB Matrix support
16RGBLIGHT_FULL_POWER = yes # Allow maximum RGB brightness. Otherwise, limited to a safe level for a normal USB-A port 18RGBLIGHT_FULL_POWER = yes # Allow maximum RGB brightness. Otherwise, limited to a safe level for a normal USB-A port
17UNICODE_ENABLE = no # Unicode 19UNICODE_ENABLE = no # Unicode
18SWAP_HANDS_ENABLE = no # Enable one-hand typing 20SWAP_HANDS_ENABLE = no # Enable one-hand typing
@@ -40,3 +42,7 @@ endif
40ifeq ($(strip $(RGBLIGHT_SPLIT_ENABLE)), yes) 42ifeq ($(strip $(RGBLIGHT_SPLIT_ENABLE)), yes)
41 OPT_DEFS += -DRGBLIGHT_SPLIT_ENABLE 43 OPT_DEFS += -DRGBLIGHT_SPLIT_ENABLE
42endif 44endif
45
46ifeq ($(strip $(SPLIT_RGB_MATRIX_ENABLE)), yes)
47 OPT_DEFS += -DSPLIT_TRANSPORT_MIRROR
48endif
diff --git a/keyboards/rgbkb/zygomorph/rev1/config.h b/keyboards/rgbkb/zygomorph/rev1/config.h
index 667b68f73..190a8bbe3 100644
--- a/keyboards/rgbkb/zygomorph/rev1/config.h
+++ b/keyboards/rgbkb/zygomorph/rev1/config.h
@@ -55,7 +55,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
55 #define RGBLED_NUM 60 55 #define RGBLED_NUM 60
56 #define RGBLED_SPLIT { 30, 30 } 56 #define RGBLED_SPLIT { 30, 30 }
57#endif 57#endif
58#define DRIVER_LED_TOTAL 30 58
59#define DRIVER_LED_TOTAL 60
60#define RGB_MATRIX_SPLIT { 30, 30 }
59 61
60#ifdef IOS_DEVICE_ENABLE 62#ifdef IOS_DEVICE_ENABLE
61 #define RGBLIGHT_LIMIT_VAL 40 63 #define RGBLIGHT_LIMIT_VAL 40
diff --git a/keyboards/rgbkb/zygomorph/rev1/rev1.c b/keyboards/rgbkb/zygomorph/rev1/rev1.c
index 3edf48c5d..1fb1716a0 100644
--- a/keyboards/rgbkb/zygomorph/rev1/rev1.c
+++ b/keyboards/rgbkb/zygomorph/rev1/rev1.c
@@ -2,72 +2,42 @@
2 2
3 3
4#ifdef RGB_MATRIX_ENABLE 4#ifdef RGB_MATRIX_ENABLE
5#define RGB_LEFT_HAND { { 0 | ( 5 << 4) }, { 102, 0 }, 4}, \ 5led_config_t g_led_config = { {
6 { { 0 | ( 4 << 4) }, { 81, 0 }, 4}, \ 6 { 5, 4, 3, 2, 1, 0 },
7 { { 0 | ( 3 << 4) }, { 61, 0 }, 4}, \ 7 { 11, 10, 9, 8, 7, 6 },
8 { { 0 | ( 2 << 4) }, { 41, 0 }, 4}, \ 8 { 17, 16, 15, 14, 13, 12 },
9 { { 0 | ( 1 << 4) }, { 20, 0 }, 4}, \ 9 { 23, 22, 21, 20, 19, 18 },
10 { { 0 | ( 0 << 4) }, { 0, 0 }, 1}, \ 10 { 29, 28, 27, 26, 25, 24 },
11 { { 1 | ( 5 << 4) }, { 102, 16 }, 4}, \ 11 { 35, 34, 33, 32, 31, 30 },
12 { { 1 | ( 4 << 4) }, { 81, 16 }, 4}, \ 12 { 41, 40, 39, 38, 37, 36 },
13 { { 1 | ( 3 << 4) }, { 61, 16 }, 4}, \ 13 { 47, 46, 45, 44, 43, 42 },
14 { { 1 | ( 2 << 4) }, { 41, 16 }, 4}, \ 14 { 53, 52, 51, 50, 49, 48 },
15 { { 1 | ( 1 << 4) }, { 20, 16 }, 4}, \ 15 { 59, 58, 57, 56, 55, 54 }
16 { { 1 | ( 0 << 4) }, { 0, 16 }, 1}, \ 16}, {
17 { { 2 | ( 5 << 4) }, { 102, 32 }, 4}, \ 17// Left Hand
18 { { 2 | ( 4 << 4) }, { 81, 32 }, 4}, \ 18 { 102, 0 }, { 81, 0 }, { 61, 0 }, { 41, 0 }, { 20, 0 }, { 0, 0 },
19 { { 2 | ( 3 << 4) }, { 61, 32 }, 4}, \ 19 { 102, 16 }, { 81, 16 }, { 61, 16 }, { 41, 16 }, { 20, 16 }, { 0, 16 },
20 { { 2 | ( 2 << 4) }, { 41, 32 }, 4}, \ 20 { 102, 32 }, { 81, 32 }, { 61, 32 }, { 41, 32 }, { 20, 32 }, { 0, 32 },
21 { { 2 | ( 1 << 4) }, { 20, 32 }, 4}, \ 21 { 102, 48 }, { 81, 48 }, { 61, 48 }, { 41, 48 }, { 20, 48 }, { 0, 48 },
22 { { 2 | ( 0 << 4) }, { 0, 32 }, 1}, \ 22 { 102, 64 }, { 81, 64 }, { 61, 64 }, { 41, 64 }, { 20, 64 }, { 0, 64 },
23 { { 3 | ( 5 << 4) }, { 102, 48 }, 4}, \ 23// Right Hand
24 { { 3 | ( 4 << 4) }, { 81, 48 }, 4}, \ 24 { 224, 0 }, { 204, 0 }, { 183, 0 }, { 163, 0 }, { 143, 0 }, { 122, 0 },
25 { { 3 | ( 3 << 4) }, { 61, 48 }, 4}, \ 25 { 224, 16 }, { 204, 16 }, { 183, 16 }, { 163, 16 }, { 143, 16 }, { 122, 16 },
26 { { 3 | ( 2 << 4) }, { 41, 48 }, 4}, \ 26 { 224, 32 }, { 204, 32 }, { 183, 32 }, { 163, 32 }, { 143, 32 }, { 122, 32 },
27 { { 3 | ( 1 << 4) }, { 20, 48 }, 4}, \ 27 { 224, 48 }, { 204, 48 }, { 183, 48 }, { 163, 48 }, { 143, 48 }, { 122, 48 },
28 { { 3 | ( 0 << 4) }, { 0, 48 }, 1}, \ 28 { 224, 64 }, { 204, 64 }, { 183, 64 }, { 163, 64 }, { 143, 64 }, { 122, 64 }
29 { { 4 | ( 5 << 4) }, { 102, 64 }, 1}, \ 29}, {
30 { { 4 | ( 4 << 4) }, { 81, 64 }, 1}, \
31 { { 4 | ( 3 << 4) }, { 61, 64 }, 1}, \
32 { { 4 | ( 2 << 4) }, { 41, 64 }, 1}, \
33 { { 4 | ( 1 << 4) }, { 20, 64 }, 1}, \
34 { { 4 | ( 0 << 4) }, { 0, 64 }, 1}
35
36#define RGB_RIGHT_HAND { { 0 | (11 << 4) }, { 224, 0 }, 1}, \
37 { { 0 | (10 << 4) }, { 204, 0 }, 4}, \
38 { { 0 | ( 9 << 4) }, { 183, 0 }, 4}, \
39 { { 0 | ( 8 << 4) }, { 163, 0 }, 4}, \
40 { { 0 | ( 7 << 4) }, { 143, 0 }, 4}, \
41 { { 0 | ( 6 << 4) }, { 122, 0 }, 4}, \
42 { { 1 | (11 << 4) }, { 224, 16 }, 1}, \
43 { { 1 | (10 << 4) }, { 204, 16 }, 4}, \
44 { { 1 | ( 9 << 4) }, { 183, 16 }, 4}, \
45 { { 1 | ( 8 << 4) }, { 163, 16 }, 4}, \
46 { { 1 | ( 7 << 4) }, { 143, 16 }, 4}, \
47 { { 1 | ( 6 << 4) }, { 122, 16 }, 4}, \
48 { { 2 | (11 << 4) }, { 224, 32 }, 1}, \
49 { { 2 | (10 << 4) }, { 204, 32 }, 4}, \
50 { { 2 | ( 9 << 4) }, { 183, 32 }, 4}, \
51 { { 2 | ( 8 << 4) }, { 163, 32 }, 4}, \
52 { { 2 | ( 7 << 4) }, { 143, 32 }, 4}, \
53 { { 2 | ( 6 << 4) }, { 122, 32 }, 4}, \
54 { { 3 | (11 << 4) }, { 224, 48 }, 1}, \
55 { { 3 | (10 << 4) }, { 204, 48 }, 4}, \
56 { { 3 | ( 9 << 4) }, { 183, 48 }, 4}, \
57 { { 3 | ( 8 << 4) }, { 163, 48 }, 4}, \
58 { { 3 | ( 7 << 4) }, { 143, 48 }, 4}, \
59 { { 3 | ( 6 << 4) }, { 122, 48 }, 4}, \
60 { { 4 | (11 << 4) }, { 224, 64 }, 1}, \
61 { { 4 | (10 << 4) }, { 204, 64 }, 1}, \
62 { { 4 | ( 9 << 4) }, { 183, 64 }, 1}, \
63 { { 4 | ( 8 << 4) }, { 163, 64 }, 1}, \
64 { { 4 | ( 7 << 4) }, { 143, 64 }, 1}, \
65 { { 4 | ( 6 << 4) }, { 122, 64 }, 1}
66
67rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
68// Left Hand 30// Left Hand
69RGB_LEFT_HAND 31 4, 4, 4, 4, 4, 1,
32 4, 4, 4, 4, 4, 1,
33 4, 4, 4, 4, 4, 1,
34 4, 4, 4, 4, 4, 1,
35 1, 1, 1, 1, 1, 1,
70// Right Hand 36// Right Hand
71//RGB_RIGHT_HAND 37 4, 4, 4, 4, 4, 4,
72}; 38 1, 4, 4, 4, 4, 4,
39 1, 4, 4, 4, 4, 4,
40 1, 4, 4, 4, 4, 4,
41 1, 1, 1, 1, 1, 1
42} };
73#endif 43#endif
diff --git a/keyboards/terrazzo/terrazzo.c b/keyboards/terrazzo/terrazzo.c
index f079ded4d..2afda085b 100644
--- a/keyboards/terrazzo/terrazzo.c
+++ b/keyboards/terrazzo/terrazzo.c
@@ -17,7 +17,6 @@
17#include "terrazzo.h" 17#include "terrazzo.h"
18 18
19#ifdef LED_MATRIX_ENABLE 19#ifdef LED_MATRIX_ENABLE
20 #include "is31fl3731-simple.h"
21 #include <math.h> 20 #include <math.h>
22 #include "print.h" 21 #include "print.h"
23 #include "quantum.h" 22 #include "quantum.h"
diff --git a/keyboards/westfoxtrot/prophet/config.h b/keyboards/westfoxtrot/prophet/config.h
index 4f447e4ca..0f2ddc1dc 100644
--- a/keyboards/westfoxtrot/prophet/config.h
+++ b/keyboards/westfoxtrot/prophet/config.h
@@ -30,3 +30,5 @@
30#define LOCKING_SUPPORT_ENABLE 30#define LOCKING_SUPPORT_ENABLE
31/* Locking resynchronize hack */ 31/* Locking resynchronize hack */
32#define LOCKING_RESYNC_ENABLE 32#define LOCKING_RESYNC_ENABLE
33
34#define SLEEP_LED_GPT_DRIVER GPTD1
diff --git a/keyboards/westfoxtrot/prophet/halconf.h b/keyboards/westfoxtrot/prophet/halconf.h
new file mode 100644
index 000000000..cbfd1307f
--- /dev/null
+++ b/keyboards/westfoxtrot/prophet/halconf.h
@@ -0,0 +1,27 @@
1/* Copyright 2020 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/projectkb/alice/halconf.h -r platforms/chibios/common/configs/halconf.h`
20 */
21
22#pragma once
23
24#define HAL_USE_GPT TRUE
25
26#include_next <halconf.h>
27
diff --git a/keyboards/westfoxtrot/prophet/mcuconf.h b/keyboards/westfoxtrot/prophet/mcuconf.h
index 2665f9c9e..550141af6 100644
--- a/keyboards/westfoxtrot/prophet/mcuconf.h
+++ b/keyboards/westfoxtrot/prophet/mcuconf.h
@@ -23,6 +23,5 @@
23 23
24#include_next <mcuconf.h> 24#include_next <mcuconf.h>
25 25
26#undef STM32_PWM_USE_TIM3 26#undef STM32_GPT_USE_TIM1
27#define STM32_PWM_USE_TIM3 TRUE 27#define STM32_GPT_USE_TIM1 TRUE
28
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py
index d742f6756..510abffdc 100644
--- a/lib/python/qmk/commands.py
+++ b/lib/python/qmk/commands.py
@@ -181,6 +181,7 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_va
181 f'VERBOSE={verbose}', 181 f'VERBOSE={verbose}',
182 f'COLOR={color}', 182 f'COLOR={color}',
183 'SILENT=false', 183 'SILENT=false',
184 f'QMK_BIN={"bin/qmk" if "DEPRECATED_BIN_QMK" in os.environ else "qmk"}',
184 ]) 185 ])
185 186
186 return make_command 187 return make_command
diff --git a/lib/python/qmk/constants.py b/lib/python/qmk/constants.py
index 3ed69f3bf..b5cdaf6a6 100644
--- a/lib/python/qmk/constants.py
+++ b/lib/python/qmk/constants.py
@@ -10,7 +10,7 @@ QMK_FIRMWARE = Path.cwd()
10MAX_KEYBOARD_SUBFOLDERS = 5 10MAX_KEYBOARD_SUBFOLDERS = 5
11 11
12# Supported processor types 12# Supported processor types
13CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F411', 'STM32G431', 'STM32G474' 13CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66F18', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F411', 'STM32G431', 'STM32G474'
14LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None 14LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None
15VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85' 15VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85'
16 16
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py
index a97472e6b..b16777e54 100644
--- a/lib/python/qmk/tests/test_cli_commands.py
+++ b/lib/python/qmk/tests/test_cli_commands.py
@@ -8,7 +8,7 @@ is_windows = 'windows' in platform.platform().lower()
8 8
9 9
10def check_subcommand(command, *args): 10def check_subcommand(command, *args):
11 cmd = ['bin/qmk', command, *args] 11 cmd = ['qmk', command, *args]
12 result = run(cmd, stdout=PIPE, stderr=STDOUT, universal_newlines=True) 12 result = run(cmd, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
13 return result 13 return result
14 14
@@ -17,7 +17,7 @@ def check_subcommand_stdin(file_to_read, command, *args):
17 """Pipe content of a file to a command and return output. 17 """Pipe content of a file to a command and return output.
18 """ 18 """
19 with open(file_to_read, encoding='utf-8') as my_file: 19 with open(file_to_read, encoding='utf-8') as my_file:
20 cmd = ['bin/qmk', command, *args] 20 cmd = ['qmk', command, *args]
21 result = run(cmd, stdin=my_file, stdout=PIPE, stderr=STDOUT, universal_newlines=True) 21 result = run(cmd, stdin=my_file, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
22 return result 22 return result
23 23
diff --git a/quantum/bootmagic/bootmagic.h b/quantum/bootmagic/bootmagic.h
new file mode 100644
index 000000000..959750178
--- /dev/null
+++ b/quantum/bootmagic/bootmagic.h
@@ -0,0 +1,24 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#if defined(BOOTMAGIC_ENABLE)
19# include "bootmagic_full.h"
20#elif defined(BOOTMAGIC_LITE)
21# include "bootmagic_lite.h"
22#endif
23
24void bootmagic(void);
diff --git a/tmk_core/common/bootmagic.c b/quantum/bootmagic/bootmagic_full.c
index c1b3adf94..a7a0dcfcb 100644
--- a/tmk_core/common/bootmagic.c
+++ b/quantum/bootmagic/bootmagic_full.c
@@ -1,3 +1,18 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include <stdint.h> 16#include <stdint.h>
2#include <stdbool.h> 17#include <stdbool.h>
3#include "wait.h" 18#include "wait.h"
@@ -10,18 +25,35 @@
10#include "eeconfig.h" 25#include "eeconfig.h"
11#include "bootmagic.h" 26#include "bootmagic.h"
12 27
13keymap_config_t keymap_config; 28/** \brief Scan Keycode
14
15/** \brief Bootmagic
16 * 29 *
17 * FIXME: needs doc 30 * FIXME: needs doc
18 */ 31 */
19void bootmagic(void) { 32static bool scan_keycode(uint8_t keycode) {
20 /* check signature */ 33 for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
21 if (!eeconfig_is_enabled()) { 34 matrix_row_t matrix_row = matrix_get_row(r);
22 eeconfig_init(); 35 for (uint8_t c = 0; c < MATRIX_COLS; c++) {
36 if (matrix_row & ((matrix_row_t)1 << c)) {
37 if (keycode == keymap_key_to_keycode(0, (keypos_t){.row = r, .col = c})) {
38 return true;
39 }
40 }
41 }
23 } 42 }
43 return false;
44}
45
46/** \brief Bootmagic Scan Keycode
47 *
48 * FIXME: needs doc
49 */
50static bool bootmagic_scan_keycode(uint8_t keycode) {
51 if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false;
52
53 return scan_keycode(keycode);
54}
24 55
56void bootmagic(void) {
25 /* do scans in case of bounce */ 57 /* do scans in case of bounce */
26 print("bootmagic scan: ... "); 58 print("bootmagic scan: ... ");
27 uint8_t scan = 100; 59 uint8_t scan = 100;
@@ -46,8 +78,6 @@ void bootmagic(void) {
46 bootloader_jump(); 78 bootloader_jump();
47 } 79 }
48 80
49 /* debug enable */
50 debug_config.raw = eeconfig_read_debug();
51 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_ENABLE)) { 81 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_ENABLE)) {
52 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MATRIX)) { 82 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MATRIX)) {
53 debug_config.matrix = !debug_config.matrix; 83 debug_config.matrix = !debug_config.matrix;
@@ -61,8 +91,6 @@ void bootmagic(void) {
61 } 91 }
62 eeconfig_update_debug(debug_config.raw); 92 eeconfig_update_debug(debug_config.raw);
63 93
64 /* keymap config */
65 keymap_config.raw = eeconfig_read_keymap();
66 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) { 94 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) {
67 keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock; 95 keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock;
68 } 96 }
@@ -93,71 +121,27 @@ void bootmagic(void) {
93 uint8_t default_layer = 0; 121 uint8_t default_layer = 0;
94 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { 122 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) {
95 default_layer |= (1 << 0); 123 default_layer |= (1 << 0);
96 } 124 } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) {
97 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) {
98 default_layer |= (1 << 1); 125 default_layer |= (1 << 1);
99 } 126 } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) {
100 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) {
101 default_layer |= (1 << 2); 127 default_layer |= (1 << 2);
102 } 128 } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) {
103 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) {
104 default_layer |= (1 << 3); 129 default_layer |= (1 << 3);
105 } 130 } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) {
106 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) {
107 default_layer |= (1 << 4); 131 default_layer |= (1 << 4);
108 } 132 } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) {
109 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) {
110 default_layer |= (1 << 5); 133 default_layer |= (1 << 5);
111 } 134 } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) {
112 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) {
113 default_layer |= (1 << 6); 135 default_layer |= (1 << 6);
114 } 136 } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) {
115 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) {
116 default_layer |= (1 << 7); 137 default_layer |= (1 << 7);
117 } 138 }
118 if (default_layer) { 139 eeconfig_update_default_layer(default_layer);
119 eeconfig_update_default_layer(default_layer);
120 default_layer_set((layer_state_t)default_layer);
121 } else {
122 default_layer = eeconfig_read_default_layer();
123 default_layer_set((layer_state_t)default_layer);
124 }
125 /* Also initialize layer state to trigger callback functions for layer_state */
126 layer_state_set_kb((layer_state_t)layer_state);
127 140
128 /* EE_HANDS handedness */ 141 /* EE_HANDS handedness */
129 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_LEFT)) { 142 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_LEFT)) {
130 eeconfig_update_handedness(true); 143 eeconfig_update_handedness(true);
131 } 144 } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_RIGHT)) {
132 if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_RIGHT)) {
133 eeconfig_update_handedness(false); 145 eeconfig_update_handedness(false);
134 } 146 }
135} 147}
136
137/** \brief Scan Keycode
138 *
139 * FIXME: needs doc
140 */
141static bool scan_keycode(uint8_t keycode) {
142 for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
143 matrix_row_t matrix_row = matrix_get_row(r);
144 for (uint8_t c = 0; c < MATRIX_COLS; c++) {
145 if (matrix_row & ((matrix_row_t)1 << c)) {
146 if (keycode == keymap_key_to_keycode(0, (keypos_t){.row = r, .col = c})) {
147 return true;
148 }
149 }
150 }
151 }
152 return false;
153}
154
155/** \brief Bootmagic Scan Keycode
156 *
157 * FIXME: needs doc
158 */
159bool bootmagic_scan_keycode(uint8_t keycode) {
160 if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false;
161
162 return scan_keycode(keycode);
163}
diff --git a/tmk_core/common/bootmagic.h b/quantum/bootmagic/bootmagic_full.h
index 8209d0194..28f914c1b 100644
--- a/tmk_core/common/bootmagic.h
+++ b/quantum/bootmagic/bootmagic_full.h
@@ -1,3 +1,19 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#pragma once 17#pragma once
2 18
3/* FIXME: Add special doxygen comments for defines here. */ 19/* FIXME: Add special doxygen comments for defines here. */
@@ -96,7 +112,4 @@
96#endif 112#endif
97#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_7 113#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_7
98# define BOOTMAGIC_KEY_DEFAULT_LAYER_7 KC_7 114# define BOOTMAGIC_KEY_DEFAULT_LAYER_7 KC_7
99#endif 115#endif \ No newline at end of file
100
101void bootmagic(void);
102bool bootmagic_scan_keycode(uint8_t keycode);
diff --git a/tmk_core/common/bootmagic_lite.c b/quantum/bootmagic/bootmagic_lite.c
index cbf756a17..9cbdcb0bb 100644
--- a/tmk_core/common/bootmagic_lite.c
+++ b/quantum/bootmagic/bootmagic_lite.c
@@ -1,3 +1,18 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include "quantum.h" 16#include "quantum.h"
2 17
3/** \brief Reset eeprom 18/** \brief Reset eeprom
@@ -47,3 +62,5 @@ __attribute__((weak)) void bootmagic_lite(void) {
47 bootloader_jump(); 62 bootloader_jump();
48 } 63 }
49} 64}
65
66void bootmagic(void) { bootmagic_lite(); }
diff --git a/quantum/bootmagic/bootmagic_lite.h b/quantum/bootmagic/bootmagic_lite.h
new file mode 100644
index 000000000..17777e6b4
--- /dev/null
+++ b/quantum/bootmagic/bootmagic_lite.h
@@ -0,0 +1,25 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#ifndef BOOTMAGIC_LITE_COLUMN
19# define BOOTMAGIC_LITE_COLUMN 0
20#endif
21#ifndef BOOTMAGIC_LITE_ROW
22# define BOOTMAGIC_LITE_ROW 0
23#endif
24
25void bootmagic_lite(void);
diff --git a/quantum/bootmagic/magic.c b/quantum/bootmagic/magic.c
new file mode 100644
index 000000000..f1cb11c39
--- /dev/null
+++ b/quantum/bootmagic/magic.c
@@ -0,0 +1,54 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include <stdint.h>
17#include <stdbool.h>
18#include "wait.h"
19#include "matrix.h"
20#include "bootloader.h"
21#include "debug.h"
22#include "keymap.h"
23#include "host.h"
24#include "action_layer.h"
25#include "eeconfig.h"
26#include "bootmagic.h"
27
28keymap_config_t keymap_config;
29
30__attribute__((weak)) void bootmagic(void) {}
31
32/** \brief Magic
33 *
34 * FIXME: Needs doc
35 */
36void magic(void) {
37 /* check signature */
38 if (!eeconfig_is_enabled()) {
39 eeconfig_init();
40 }
41
42 /* init globals */
43 debug_config.raw = eeconfig_read_debug();
44 keymap_config.raw = eeconfig_read_keymap();
45
46 bootmagic();
47
48 /* read here just incase bootmagic process changed its value */
49 layer_state_t default_layer = (layer_state_t)eeconfig_read_default_layer();
50 default_layer_set(default_layer);
51
52 /* Also initialize layer state to trigger callback functions for layer_state */
53 layer_state_set_kb((layer_state_t)layer_state);
54}
diff --git a/keyboards/durgod/k320/keymaps/via/config.h b/quantum/bootmagic/magic.h
index 2ae6fca9d..2c3969b85 100644
--- a/keyboards/durgod/k320/keymaps/via/config.h
+++ b/quantum/bootmagic/magic.h
@@ -1,9 +1,8 @@
1/* 1/* Copyright 2021 QMK
2 * Copyright 2021 Maxime Coirault
3 * 2 *
4 * This program is free software: you can redistribute it and/or modify 3 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 4 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or 5 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version. 6 * (at your option) any later version.
8 * 7 *
9 * This program is distributed in the hope that it will be useful, 8 * This program is distributed in the hope that it will be useful,
@@ -14,7 +13,6 @@
14 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 15 */
17
18#pragma once 16#pragma once
19 17
20#define DYNAMIC_KEYMAP_LAYER_COUNT 3 18void magic(void);
diff --git a/quantum/keycode_config.h b/quantum/keycode_config.h
index f878168c5..d7e334fdc 100644
--- a/quantum/keycode_config.h
+++ b/quantum/keycode_config.h
@@ -37,6 +37,7 @@ typedef union {
37 bool nkro : 1; 37 bool nkro : 1;
38 bool swap_lctl_lgui : 1; 38 bool swap_lctl_lgui : 1;
39 bool swap_rctl_rgui : 1; 39 bool swap_rctl_rgui : 1;
40 bool oneshot_disable : 1;
40 }; 41 };
41} keymap_config_t; 42} keymap_config_t;
42 43
diff --git a/quantum/led_matrix.c b/quantum/led_matrix.c
index 4f1f06c7a..ceb236809 100644
--- a/quantum/led_matrix.c
+++ b/quantum/led_matrix.c
@@ -17,9 +17,6 @@
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <stdint.h>
21#include <stdbool.h>
22#include "quantum.h"
23#include "led_matrix.h" 20#include "led_matrix.h"
24#include "progmem.h" 21#include "progmem.h"
25#include "config.h" 22#include "config.h"
@@ -37,20 +34,41 @@ led_eeconfig_t led_matrix_eeconfig;
37# define MIN(a, b) ((a) < (b) ? (a) : (b)) 34# define MIN(a, b) ((a) < (b) ? (a) : (b))
38#endif 35#endif
39 36
40#ifndef LED_DISABLE_AFTER_TIMEOUT 37#if defined(LED_DISABLE_AFTER_TIMEOUT) && !defined(LED_DISABLE_TIMEOUT)
41# define LED_DISABLE_AFTER_TIMEOUT 0 38# define LED_DISABLE_TIMEOUT (LED_DISABLE_AFTER_TIMEOUT * 1200UL)
39#endif
40
41#ifndef LED_DISABLE_TIMEOUT
42# define LED_DISABLE_TIMEOUT 0
42#endif 43#endif
43 44
44#ifndef LED_DISABLE_WHEN_USB_SUSPENDED 45#ifndef LED_DISABLE_WHEN_USB_SUSPENDED
45# define LED_DISABLE_WHEN_USB_SUSPENDED false 46# define LED_DISABLE_WHEN_USB_SUSPENDED false
46#endif 47#endif
47 48
48#ifndef EECONFIG_LED_MATRIX 49#if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX
49# define EECONFIG_LED_MATRIX EECONFIG_RGBLIGHT 50# undef LED_MATRIX_MAXIMUM_BRIGHTNESS
51# define LED_MATRIX_MAXIMUM_BRIGHTNESS UINT8_MAX
52#endif
53
54#if !defined(LED_MATRIX_VAL_STEP)
55# define LED_MATRIX_VAL_STEP 8
56#endif
57
58#if !defined(LED_MATRIX_SPD_STEP)
59# define LED_MATRIX_SPD_STEP 16
50#endif 60#endif
51 61
52#if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > 255 62#if !defined(LED_MATRIX_STARTUP_MODE)
53# define LED_MATRIX_MAXIMUM_BRIGHTNESS 255 63# define LED_MATRIX_STARTUP_MODE LED_MATRIX_UNIFORM_BRIGHTNESS
64#endif
65
66#if !defined(LED_MATRIX_STARTUP_VAL)
67# define LED_MATRIX_STARTUP_VAL LED_MATRIX_MAXIMUM_BRIGHTNESS
68#endif
69
70#if !defined(LED_MATRIX_STARTUP_SPD)
71# define LED_MATRIX_STARTUP_SPD UINT8_MAX / 2
54#endif 72#endif
55 73
56bool g_suspend_state = false; 74bool g_suspend_state = false;
@@ -64,21 +82,21 @@ uint8_t g_key_hit[DRIVER_LED_TOTAL];
64// Ticks since any key was last hit. 82// Ticks since any key was last hit.
65uint32_t g_any_key_hit = 0; 83uint32_t g_any_key_hit = 0;
66 84
67uint32_t eeconfig_read_led_matrix(void) { return eeprom_read_dword(EECONFIG_LED_MATRIX); } 85void eeconfig_read_led_matrix(void) { eeprom_read_block(&led_matrix_eeconfig, EECONFIG_LED_MATRIX, sizeof(led_matrix_eeconfig)); }
68 86
69void eeconfig_update_led_matrix(uint32_t config_value) { eeprom_update_dword(EECONFIG_LED_MATRIX, config_value); } 87void eeconfig_update_led_matrix(void) { eeprom_update_block(&led_matrix_eeconfig, EECONFIG_LED_MATRIX, sizeof(led_matrix_eeconfig)); }
70 88
71void eeconfig_update_led_matrix_default(void) { 89void eeconfig_update_led_matrix_default(void) {
72 dprintf("eeconfig_update_led_matrix_default\n"); 90 dprintf("eeconfig_update_led_matrix_default\n");
73 led_matrix_eeconfig.enable = 1; 91 led_matrix_eeconfig.enable = 1;
74 led_matrix_eeconfig.mode = LED_MATRIX_UNIFORM_BRIGHTNESS; 92 led_matrix_eeconfig.mode = LED_MATRIX_STARTUP_MODE;
75 led_matrix_eeconfig.val = 128; 93 led_matrix_eeconfig.val = LED_MATRIX_STARTUP_VAL;
76 led_matrix_eeconfig.speed = 0; 94 led_matrix_eeconfig.speed = LED_MATRIX_STARTUP_SPD;
77 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); 95 eeconfig_update_led_matrix();
78} 96}
79 97
80void eeconfig_debug_led_matrix(void) { 98void eeconfig_debug_led_matrix(void) {
81 dprintf("led_matrix_eeconfig eeprom\n"); 99 dprintf("led_matrix_eeconfig EEPROM\n");
82 dprintf("led_matrix_eeconfig.enable = %d\n", led_matrix_eeconfig.enable); 100 dprintf("led_matrix_eeconfig.enable = %d\n", led_matrix_eeconfig.enable);
83 dprintf("led_matrix_eeconfig.mode = %d\n", led_matrix_eeconfig.mode); 101 dprintf("led_matrix_eeconfig.mode = %d\n", led_matrix_eeconfig.mode);
84 dprintf("led_matrix_eeconfig.val = %d\n", led_matrix_eeconfig.val); 102 dprintf("led_matrix_eeconfig.val = %d\n", led_matrix_eeconfig.val);
@@ -135,7 +153,7 @@ void led_matrix_set_suspend_state(bool state) { g_suspend_state = state; }
135void led_matrix_all_off(void) { led_matrix_set_index_value_all(0); } 153void led_matrix_all_off(void) { led_matrix_set_index_value_all(0); }
136 154
137// Uniform brightness 155// Uniform brightness
138void led_matrix_uniform_brightness(void) { led_matrix_set_index_value_all(LED_MATRIX_MAXIMUM_BRIGHTNESS / BACKLIGHT_LEVELS * led_matrix_eeconfig.val); } 156void led_matrix_uniform_brightness(void) { led_matrix_set_index_value_all(led_matrix_eeconfig.val); }
139 157
140void led_matrix_custom(void) {} 158void led_matrix_custom(void) {}
141 159
@@ -161,7 +179,7 @@ void led_matrix_task(void) {
161 179
162 // Ideally we would also stop sending zeros to the LED driver PWM buffers 180 // Ideally we would also stop sending zeros to the LED driver PWM buffers
163 // while suspended and just do a software shutdown. This is a cheap hack for now. 181 // while suspended and just do a software shutdown. This is a cheap hack for now.
164 bool suspend_backlight = ((g_suspend_state && LED_DISABLE_WHEN_USB_SUSPENDED) || (LED_DISABLE_AFTER_TIMEOUT > 0 && g_any_key_hit > LED_DISABLE_AFTER_TIMEOUT * 60 * 20)); 182 bool suspend_backlight = ((g_suspend_state && LED_DISABLE_WHEN_USB_SUSPENDED) || (LED_DISABLE_TIMEOUT > 0 && g_any_key_hit > LED_DISABLE_TIMEOUT));
165 uint8_t effect = suspend_backlight ? 0 : led_matrix_eeconfig.mode; 183 uint8_t effect = suspend_backlight ? 0 : led_matrix_eeconfig.mode;
166 184
167 // this gets ticked at 20 Hz. 185 // this gets ticked at 20 Hz.
@@ -227,12 +245,10 @@ void led_matrix_init(void) {
227 eeconfig_update_led_matrix_default(); 245 eeconfig_update_led_matrix_default();
228 } 246 }
229 247
230 led_matrix_eeconfig.raw = eeconfig_read_led_matrix(); 248 eeconfig_read_led_matrix();
231
232 if (!led_matrix_eeconfig.mode) { 249 if (!led_matrix_eeconfig.mode) {
233 dprintf("led_matrix_init_drivers led_matrix_eeconfig.mode = 0. Write default values to EEPROM.\n"); 250 dprintf("led_matrix_init_drivers led_matrix_eeconfig.mode = 0. Write default values to EEPROM.\n");
234 eeconfig_update_led_matrix_default(); 251 eeconfig_update_led_matrix_default();
235 led_matrix_eeconfig.raw = eeconfig_read_led_matrix();
236 } 252 }
237 253
238 eeconfig_debug_led_matrix(); // display current eeprom values 254 eeconfig_debug_led_matrix(); // display current eeprom values
@@ -276,19 +292,19 @@ uint32_t led_matrix_get_tick(void) { return g_tick; }
276 292
277void led_matrix_toggle(void) { 293void led_matrix_toggle(void) {
278 led_matrix_eeconfig.enable ^= 1; 294 led_matrix_eeconfig.enable ^= 1;
279 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); 295 eeconfig_update_led_matrix();
280} 296}
281 297
282void led_matrix_enable(void) { 298void led_matrix_enable(void) {
283 led_matrix_eeconfig.enable = 1; 299 led_matrix_eeconfig.enable = 1;
284 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); 300 eeconfig_update_led_matrix();
285} 301}
286 302
287void led_matrix_enable_noeeprom(void) { led_matrix_eeconfig.enable = 1; } 303void led_matrix_enable_noeeprom(void) { led_matrix_eeconfig.enable = 1; }
288 304
289void led_matrix_disable(void) { 305void led_matrix_disable(void) {
290 led_matrix_eeconfig.enable = 0; 306 led_matrix_eeconfig.enable = 0;
291 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); 307 eeconfig_update_led_matrix();
292} 308}
293 309
294void led_matrix_disable_noeeprom(void) { led_matrix_eeconfig.enable = 0; } 310void led_matrix_disable_noeeprom(void) { led_matrix_eeconfig.enable = 0; }
@@ -298,7 +314,7 @@ void led_matrix_step(void) {
298 if (led_matrix_eeconfig.mode >= LED_MATRIX_EFFECT_MAX) { 314 if (led_matrix_eeconfig.mode >= LED_MATRIX_EFFECT_MAX) {
299 led_matrix_eeconfig.mode = 1; 315 led_matrix_eeconfig.mode = 1;
300 } 316 }
301 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); 317 eeconfig_update_led_matrix();
302} 318}
303 319
304void led_matrix_step_reverse(void) { 320void led_matrix_step_reverse(void) {
@@ -306,33 +322,33 @@ void led_matrix_step_reverse(void) {
306 if (led_matrix_eeconfig.mode < 1) { 322 if (led_matrix_eeconfig.mode < 1) {
307 led_matrix_eeconfig.mode = LED_MATRIX_EFFECT_MAX - 1; 323 led_matrix_eeconfig.mode = LED_MATRIX_EFFECT_MAX - 1;
308 } 324 }
309 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); 325 eeconfig_update_led_matrix();
310} 326}
311 327
312void led_matrix_increase_val(void) { 328void led_matrix_increase_val(void) {
313 led_matrix_eeconfig.val = increment(led_matrix_eeconfig.val, 8, 0, LED_MATRIX_MAXIMUM_BRIGHTNESS); 329 led_matrix_eeconfig.val = increment(led_matrix_eeconfig.val, 8, 0, LED_MATRIX_MAXIMUM_BRIGHTNESS);
314 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); 330 eeconfig_update_led_matrix();
315} 331}
316 332
317void led_matrix_decrease_val(void) { 333void led_matrix_decrease_val(void) {
318 led_matrix_eeconfig.val = decrement(led_matrix_eeconfig.val, 8, 0, LED_MATRIX_MAXIMUM_BRIGHTNESS); 334 led_matrix_eeconfig.val = decrement(led_matrix_eeconfig.val, 8, 0, LED_MATRIX_MAXIMUM_BRIGHTNESS);
319 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); 335 eeconfig_update_led_matrix();
320} 336}
321 337
322void led_matrix_increase_speed(void) { 338void led_matrix_increase_speed(void) {
323 led_matrix_eeconfig.speed = increment(led_matrix_eeconfig.speed, 1, 0, 3); 339 led_matrix_eeconfig.speed = increment(led_matrix_eeconfig.speed, 1, 0, 3);
324 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); // EECONFIG needs to be increased to support this 340 eeconfig_update_led_matrix(); // EECONFIG needs to be increased to support this
325} 341}
326 342
327void led_matrix_decrease_speed(void) { 343void led_matrix_decrease_speed(void) {
328 led_matrix_eeconfig.speed = decrement(led_matrix_eeconfig.speed, 1, 0, 3); 344 led_matrix_eeconfig.speed = decrement(led_matrix_eeconfig.speed, 1, 0, 3);
329 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); // EECONFIG needs to be increased to support this 345 eeconfig_update_led_matrix(); // EECONFIG needs to be increased to support this
330} 346}
331 347
332void led_matrix_mode(uint8_t mode, bool eeprom_write) { 348void led_matrix_mode(uint8_t mode, bool eeprom_write) {
333 led_matrix_eeconfig.mode = mode; 349 led_matrix_eeconfig.mode = mode;
334 if (eeprom_write) { 350 if (eeprom_write) {
335 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); 351 eeconfig_update_led_matrix();
336 } 352 }
337} 353}
338 354
@@ -342,7 +358,5 @@ void led_matrix_set_value_noeeprom(uint8_t val) { led_matrix_eeconfig.val = val;
342 358
343void led_matrix_set_value(uint8_t val) { 359void led_matrix_set_value(uint8_t val) {
344 led_matrix_set_value_noeeprom(val); 360 led_matrix_set_value_noeeprom(val);
345 eeconfig_update_led_matrix(led_matrix_eeconfig.raw); 361 eeconfig_update_led_matrix();
346} 362}
347
348void backlight_set(uint8_t val) { led_matrix_set_value(val); }
diff --git a/quantum/led_matrix.h b/quantum/led_matrix.h
index 85bae43c1..e4322a150 100644
--- a/quantum/led_matrix.h
+++ b/quantum/led_matrix.h
@@ -19,10 +19,13 @@
19 19
20#pragma once 20#pragma once
21 21
22#include <stdint.h>
23#include <stdbool.h>
22#include "led_matrix_types.h" 24#include "led_matrix_types.h"
25#include "quantum.h"
23 26
24#ifndef BACKLIGHT_ENABLE 27#ifdef IS31FL3731
25# error You must define BACKLIGHT_ENABLE with LED_MATRIX_ENABLE 28# include "is31fl3731-simple.h"
26#endif 29#endif
27 30
28enum led_matrix_effects { 31enum led_matrix_effects {
diff --git a/quantum/led_matrix_drivers.c b/quantum/led_matrix_drivers.c
index eddf3f286..370c5e685 100644
--- a/quantum/led_matrix_drivers.c
+++ b/quantum/led_matrix_drivers.c
@@ -15,9 +15,6 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18#include <stdint.h>
19#include <stdbool.h>
20#include "quantum.h"
21#include "led_matrix.h" 18#include "led_matrix.h"
22 19
23/* Each driver needs to define a struct: 20/* Each driver needs to define a struct:
@@ -30,10 +27,6 @@
30 27
31#if defined(IS31FL3731) || defined(IS31FL3733) 28#if defined(IS31FL3731) || defined(IS31FL3733)
32 29
33# if defined(IS31FL3731)
34# include "is31fl3731-simple.h"
35# endif
36
37# include "i2c_master.h" 30# include "i2c_master.h"
38 31
39static void init(void) { 32static void init(void) {
diff --git a/quantum/led_matrix_types.h b/quantum/led_matrix_types.h
index 669b67042..be0e10bb9 100644
--- a/quantum/led_matrix_types.h
+++ b/quantum/led_matrix_types.h
@@ -29,16 +29,43 @@
29# pragma pack(push, 1) 29# pragma pack(push, 1)
30#endif 30#endif
31 31
32#if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES)
33# define LED_MATRIX_KEYREACTIVE_ENABLED
34#endif
35
32// Last led hit 36// Last led hit
33#ifndef LED_HITS_TO_REMEMBER 37#ifndef LED_HITS_TO_REMEMBER
34# define LED_HITS_TO_REMEMBER 8 38# define LED_HITS_TO_REMEMBER 8
35#endif // LED_HITS_TO_REMEMBER 39#endif // LED_HITS_TO_REMEMBER
36 40
41#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
42typedef struct PACKED {
43 uint8_t count;
44 uint8_t x[LED_HITS_TO_REMEMBER];
45 uint8_t y[LED_HITS_TO_REMEMBER];
46 uint8_t index[LED_HITS_TO_REMEMBER];
47 uint16_t tick[LED_HITS_TO_REMEMBER];
48} last_hit_t;
49#endif // LED_MATRIX_KEYREACTIVE_ENABLED
50
51typedef enum led_task_states { STARTING, RENDERING, FLUSHING, SYNCING } led_task_states;
52
53typedef uint8_t led_flags_t;
54
55typedef struct PACKED {
56 uint8_t iter;
57 led_flags_t flags;
58 bool init;
59} effect_params_t;
60
37typedef struct PACKED { 61typedef struct PACKED {
38 uint8_t x; 62 uint8_t x;
39 uint8_t y; 63 uint8_t y;
40} point_t; 64} point_t;
41 65
66#define HAS_FLAGS(bits, flags) ((bits & flags) == flags)
67#define HAS_ANY_FLAGS(bits, flags) ((bits & flags) != 0x00)
68
42#define LED_FLAG_ALL 0xFF 69#define LED_FLAG_ALL 0xFF
43#define LED_FLAG_NONE 0x00 70#define LED_FLAG_NONE 0x00
44#define LED_FLAG_MODIFIER 0x01 71#define LED_FLAG_MODIFIER 0x01
diff --git a/quantum/mcu_selection.mk b/quantum/mcu_selection.mk
index f7329fc4d..53e03a805 100644
--- a/quantum/mcu_selection.mk
+++ b/quantum/mcu_selection.mk
@@ -81,6 +81,33 @@ ifneq ($(findstring MK20DX256, $(MCU)),)
81 BOARD ?= PJRC_TEENSY_3_1 81 BOARD ?= PJRC_TEENSY_3_1
82endif 82endif
83 83
84ifneq ($(findstring MK66F18, $(MCU)),)
85 # Cortex version
86 MCU = cortex-m4
87
88 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
89 ARMV = 7
90
91 ## chip/board settings
92 # - the next two should match the directories in
93 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
94 MCU_FAMILY = KINETIS
95 MCU_SERIES = MK66F18
96
97 # Linker script to use
98 # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
99 # or <keyboard_dir>/ld/
100 MCU_LDSCRIPT ?= MK66FX1M0
101
102 # Startup code to use
103 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
104 MCU_STARTUP ?= MK66F18
105
106 # Board: it should exist either in <chibios>/os/hal/boards/,
107 # <keyboard_dir>/boards/, or drivers/boards/
108 BOARD ?= PJRC_TEENSY_3_6
109endif
110
84ifneq ($(findstring STM32F042, $(MCU)),) 111ifneq ($(findstring STM32F042, $(MCU)),)
85 # Cortex version 112 # Cortex version
86 MCU = cortex-m0 113 MCU = cortex-m0
diff --git a/quantum/process_keycode/process_backlight.c b/quantum/process_keycode/process_backlight.c
index 4d12f6813..8b70339a5 100644
--- a/quantum/process_keycode/process_backlight.c
+++ b/quantum/process_keycode/process_backlight.c
@@ -16,11 +16,35 @@
16 16
17#include "process_backlight.h" 17#include "process_backlight.h"
18 18
19#include "backlight.h" 19#ifdef LED_MATRIX_ENABLE
20# include "led_matrix.h"
21#else
22# include "backlight.h"
23#endif
20 24
21bool process_backlight(uint16_t keycode, keyrecord_t *record) { 25bool process_backlight(uint16_t keycode, keyrecord_t *record) {
22 if (record->event.pressed) { 26 if (record->event.pressed) {
23 switch (keycode) { 27 switch (keycode) {
28#ifdef LED_MATRIX_ENABLE
29 case BL_ON:
30 led_matrix_enable();
31 return false;
32 case BL_OFF:
33 led_matrix_disable();
34 return false;
35 case BL_DEC:
36 led_matrix_decrease_val();
37 return false;
38 case BL_INC:
39 led_matrix_increase_val();
40 return false;
41 case BL_TOGG:
42 led_matrix_toggle();
43 return false;
44 case BL_STEP:
45 led_matrix_step();
46 return false;
47#else
24 case BL_ON: 48 case BL_ON:
25 backlight_level(BACKLIGHT_LEVELS); 49 backlight_level(BACKLIGHT_LEVELS);
26 return false; 50 return false;
@@ -39,10 +63,11 @@ bool process_backlight(uint16_t keycode, keyrecord_t *record) {
39 case BL_STEP: 63 case BL_STEP:
40 backlight_step(); 64 backlight_step();
41 return false; 65 return false;
42#ifdef BACKLIGHT_BREATHING 66# ifdef BACKLIGHT_BREATHING
43 case BL_BRTG: 67 case BL_BRTG:
44 backlight_toggle_breathing(); 68 backlight_toggle_breathing();
45 return false; 69 return false;
70# endif
46#endif 71#endif
47 } 72 }
48 } 73 }
diff --git a/quantum/quantum.c b/quantum/quantum.c
index b40b40544..8ccdb774b 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include "quantum.h" 17#include "quantum.h"
18#include "magic.h"
18 19
19#ifdef BLUETOOTH_ENABLE 20#ifdef BLUETOOTH_ENABLE
20# include "outputselect.h" 21# include "outputselect.h"
@@ -233,7 +234,7 @@ bool process_record_quantum(keyrecord_t *record) {
233#ifdef AUDIO_ENABLE 234#ifdef AUDIO_ENABLE
234 process_audio(keycode, record) && 235 process_audio(keycode, record) &&
235#endif 236#endif
236#ifdef BACKLIGHT_ENABLE 237#if defined(BACKLIGHT_ENABLE) || defined(LED_MATRIX_ENABLE)
237 process_backlight(keycode, record) && 238 process_backlight(keycode, record) &&
238#endif 239#endif
239#ifdef STENO_ENABLE 240#ifdef STENO_ENABLE
@@ -318,6 +319,17 @@ bool process_record_quantum(keyrecord_t *record) {
318 set_output(OUTPUT_BLUETOOTH); 319 set_output(OUTPUT_BLUETOOTH);
319 return false; 320 return false;
320#endif 321#endif
322#ifndef NO_ACTION_ONESHOT
323 case ONESHOT_TOGGLE:
324 oneshot_toggle();
325 break;
326 case ONESHOT_ENABLE:
327 oneshot_enable();
328 break;
329 case ONESHOT_DISABLE:
330 oneshot_disable();
331 break;
332#endif
321 } 333 }
322 } 334 }
323 335
@@ -341,26 +353,20 @@ layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_
341void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { layer_state_set(update_tri_layer_state(layer_state, layer1, layer2, layer3)); } 353void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { layer_state_set(update_tri_layer_state(layer_state, layer1, layer2, layer3)); }
342 354
343void matrix_init_quantum() { 355void matrix_init_quantum() {
344#ifdef BOOTMAGIC_LITE 356 magic();
345 bootmagic_lite();
346#endif
347 if (!eeconfig_is_enabled()) {
348 eeconfig_init();
349 }
350#if defined(LED_NUM_LOCK_PIN) || defined(LED_CAPS_LOCK_PIN) || defined(LED_SCROLL_LOCK_PIN) || defined(LED_COMPOSE_PIN) || defined(LED_KANA_PIN) 357#if defined(LED_NUM_LOCK_PIN) || defined(LED_CAPS_LOCK_PIN) || defined(LED_SCROLL_LOCK_PIN) || defined(LED_COMPOSE_PIN) || defined(LED_KANA_PIN)
351 // TODO: remove calls to led_init_ports from keyboards and remove ifdef 358 // TODO: remove calls to led_init_ports from keyboards and remove ifdef
352 led_init_ports(); 359 led_init_ports();
353#endif 360#endif
354#ifdef BACKLIGHT_ENABLE 361#ifdef BACKLIGHT_ENABLE
355# ifdef LED_MATRIX_ENABLE
356 led_matrix_init();
357# else
358 backlight_init_ports(); 362 backlight_init_ports();
359# endif
360#endif 363#endif
361#ifdef AUDIO_ENABLE 364#ifdef AUDIO_ENABLE
362 audio_init(); 365 audio_init();
363#endif 366#endif
367#ifdef LED_MATRIX_ENABLE
368 led_matrix_init();
369#endif
364#ifdef RGB_MATRIX_ENABLE 370#ifdef RGB_MATRIX_ENABLE
365 rgb_matrix_init(); 371 rgb_matrix_init();
366#endif 372#endif
diff --git a/quantum/quantum.h b/quantum/quantum.h
index e24a4c43a..fe6bf310a 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -30,11 +30,11 @@
30#include "keymap.h" 30#include "keymap.h"
31 31
32#ifdef BACKLIGHT_ENABLE 32#ifdef BACKLIGHT_ENABLE
33# ifdef LED_MATRIX_ENABLE 33# include "backlight.h"
34# include "led_matrix.h" 34#endif
35# else 35
36# include "backlight.h" 36#ifdef LED_MATRIX_ENABLE
37# endif 37# include "led_matrix.h"
38#endif 38#endif
39 39
40#if defined(RGBLIGHT_ENABLE) 40#if defined(RGBLIGHT_ENABLE)
@@ -52,6 +52,7 @@
52#include "action_layer.h" 52#include "action_layer.h"
53#include "eeconfig.h" 53#include "eeconfig.h"
54#include "bootloader.h" 54#include "bootloader.h"
55#include "bootmagic.h"
55#include "timer.h" 56#include "timer.h"
56#include "sync_timer.h" 57#include "sync_timer.h"
57#include "config_common.h" 58#include "config_common.h"
@@ -97,7 +98,7 @@ extern layer_state_t layer_state;
97# include "process_music.h" 98# include "process_music.h"
98#endif 99#endif
99 100
100#ifdef BACKLIGHT_ENABLE 101#if defined(BACKLIGHT_ENABLE) || defined(LED_MATRIX_ENABLE)
101# include "process_backlight.h" 102# include "process_backlight.h"
102#endif 103#endif
103 104
@@ -199,39 +200,6 @@ extern layer_state_t layer_state;
199# include "usbpd.h" 200# include "usbpd.h"
200#endif 201#endif
201 202
202// Function substitutions to ease GPIO manipulation
203#if defined(__AVR__)
204
205/* The AVR series GPIOs have a one clock read delay for changes in the digital input signal.
206 * But here's more margin to make it two clocks. */
207# if !defined(GPIO_INPUT_PIN_DELAY)
208# define GPIO_INPUT_PIN_DELAY 2
209# endif
210# define waitInputPinDelay() wait_cpuclock(GPIO_INPUT_PIN_DELAY)
211
212#elif defined(__ARMEL__) || defined(__ARMEB__)
213
214/* For GPIOs on ARM-based MCUs, the input pins are sampled by the clock of the bus
215 * to which the GPIO is connected.
216 * The connected buses differ depending on the various series of MCUs.
217 * And since the instruction execution clock of the CPU and the bus clock of GPIO are different,
218 * there is a delay of several clocks to read the change of the input signal.
219 *
220 * Define this delay with the GPIO_INPUT_PIN_DELAY macro.
221 * If the GPIO_INPUT_PIN_DELAY macro is not defined, the following default values will be used.
222 * (A fairly large value of 0.25 microseconds is set.)
223 */
224# if !defined(GPIO_INPUT_PIN_DELAY)
225# if defined(STM32_SYSCLK)
226# define GPIO_INPUT_PIN_DELAY (STM32_SYSCLK / 1000000L / 4)
227# elif defined(KINETIS_SYSCLK_FREQUENCY)
228# define GPIO_INPUT_PIN_DELAY (KINETIS_SYSCLK_FREQUENCY / 1000000L / 4)
229# endif
230# endif
231# define waitInputPinDelay() wait_cpuclock(GPIO_INPUT_PIN_DELAY)
232
233#endif
234
235// For tri-layer 203// For tri-layer
236void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); 204void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
237layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3); 205layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3);
@@ -256,15 +224,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record);
256void post_process_record_kb(uint16_t keycode, keyrecord_t *record); 224void post_process_record_kb(uint16_t keycode, keyrecord_t *record);
257void post_process_record_user(uint16_t keycode, keyrecord_t *record); 225void post_process_record_user(uint16_t keycode, keyrecord_t *record);
258 226
259#ifndef BOOTMAGIC_LITE_COLUMN
260# define BOOTMAGIC_LITE_COLUMN 0
261#endif
262#ifndef BOOTMAGIC_LITE_ROW
263# define BOOTMAGIC_LITE_ROW 0
264#endif
265
266void bootmagic_lite(void);
267
268void reset_keyboard(void); 227void reset_keyboard(void);
269 228
270void startup_user(void); 229void startup_user(void);
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index e49f8dcda..0361e4cf9 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -573,6 +573,10 @@ enum quantum_keycodes {
573 573
574#endif 574#endif
575 575
576 ONESHOT_ENABLE,
577 ONESHOT_DISABLE,
578 ONESHOT_TOGGLE,
579
576 // always leave at the end 580 // always leave at the end
577 SAFE_RANGE 581 SAFE_RANGE
578}; 582};
@@ -680,16 +684,13 @@ enum quantum_keycodes {
680 684
681#define KC_DELT KC_DELETE // Del key (four letter code) 685#define KC_DELT KC_DELETE // Del key (four letter code)
682 686
683// Alias for function layers than expand past FN31
684#define FUNC(kc) (QK_FUNCTION | (kc))
685
686// Aliases 687// Aliases
687#define C(kc) LCTL(kc) 688#define C(kc) LCTL(kc)
688#define S(kc) LSFT(kc) 689#define S(kc) LSFT(kc)
689#define A(kc) LALT(kc) 690#define A(kc) LALT(kc)
690#define G(kc) LGUI(kc) 691#define G(kc) LGUI(kc)
691 692
692#define F(kc) FUNC(kc) 693#define F(kc) (QK_FUNCTION | (kc))
693#define M(kc) (QK_MACRO | (kc)) 694#define M(kc) (QK_MACRO | (kc))
694 695
695#define MACROTAP(kc) (QK_MACRO | (FUNC_TAP << 8) | (kc)) 696#define MACROTAP(kc) (QK_MACRO | (FUNC_TAP << 8) | (kc))
@@ -874,3 +875,8 @@ enum quantum_keycodes {
874#define DM_RSTP DYN_REC_STOP 875#define DM_RSTP DYN_REC_STOP
875#define DM_PLY1 DYN_MACRO_PLAY1 876#define DM_PLY1 DYN_MACRO_PLAY1
876#define DM_PLY2 DYN_MACRO_PLAY2 877#define DM_PLY2 DYN_MACRO_PLAY2
878
879// One Shot toggle
880#define OS_TOGG ONESHOT_TOGGLE
881#define OS_ON ONESHOT_ENABLE
882#define OS_OFF ONESHOT_DISABLE
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index ec17b4d72..8aae48603 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -131,7 +131,7 @@ last_hit_t g_last_hit_tracker;
131// internals 131// internals
132static uint8_t rgb_last_enable = UINT8_MAX; 132static uint8_t rgb_last_enable = UINT8_MAX;
133static uint8_t rgb_last_effect = UINT8_MAX; 133static uint8_t rgb_last_effect = UINT8_MAX;
134static effect_params_t rgb_effect_params = {0, 0xFF}; 134static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false};
135static rgb_task_states rgb_task_state = SYNCING; 135static rgb_task_states rgb_task_state = SYNCING;
136#if RGB_DISABLE_TIMEOUT > 0 136#if RGB_DISABLE_TIMEOUT > 0
137static uint32_t rgb_anykey_timer; 137static uint32_t rgb_anykey_timer;
@@ -143,6 +143,11 @@ static uint32_t rgb_timer_buffer;
143static last_hit_t last_hit_buffer; 143static last_hit_t last_hit_buffer;
144#endif // RGB_MATRIX_KEYREACTIVE_ENABLED 144#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
145 145
146// split rgb matrix
147#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
148const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT;
149#endif
150
146void eeconfig_read_rgb_matrix(void) { eeprom_read_block(&rgb_matrix_config, EECONFIG_RGB_MATRIX, sizeof(rgb_matrix_config)); } 151void eeconfig_read_rgb_matrix(void) { eeprom_read_block(&rgb_matrix_config, EECONFIG_RGB_MATRIX, sizeof(rgb_matrix_config)); }
147 152
148void eeconfig_update_rgb_matrix(void) { eeprom_update_block(&rgb_matrix_config, EECONFIG_RGB_MATRIX, sizeof(rgb_matrix_config)); } 153void eeconfig_update_rgb_matrix(void) { eeprom_update_block(&rgb_matrix_config, EECONFIG_RGB_MATRIX, sizeof(rgb_matrix_config)); }
@@ -153,6 +158,7 @@ void eeconfig_update_rgb_matrix_default(void) {
153 rgb_matrix_config.mode = RGB_MATRIX_STARTUP_MODE; 158 rgb_matrix_config.mode = RGB_MATRIX_STARTUP_MODE;
154 rgb_matrix_config.hsv = (HSV){RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL}; 159 rgb_matrix_config.hsv = (HSV){RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL};
155 rgb_matrix_config.speed = RGB_MATRIX_STARTUP_SPD; 160 rgb_matrix_config.speed = RGB_MATRIX_STARTUP_SPD;
161 rgb_matrix_config.flags = LED_FLAG_ALL;
156 eeconfig_update_rgb_matrix(); 162 eeconfig_update_rgb_matrix();
157} 163}
158 164
@@ -164,6 +170,7 @@ void eeconfig_debug_rgb_matrix(void) {
164 dprintf("rgb_matrix_config.hsv.s = %d\n", rgb_matrix_config.hsv.s); 170 dprintf("rgb_matrix_config.hsv.s = %d\n", rgb_matrix_config.hsv.s);
165 dprintf("rgb_matrix_config.hsv.v = %d\n", rgb_matrix_config.hsv.v); 171 dprintf("rgb_matrix_config.hsv.v = %d\n", rgb_matrix_config.hsv.v);
166 dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed); 172 dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed);
173 dprintf("rgb_matrix_config.flags = %d\n", rgb_matrix_config.flags);
167} 174}
168 175
169__attribute__((weak)) uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { return 0; } 176__attribute__((weak)) uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { return 0; }
@@ -180,9 +187,22 @@ uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *l
180 187
181void rgb_matrix_update_pwm_buffers(void) { rgb_matrix_driver.flush(); } 188void rgb_matrix_update_pwm_buffers(void) { rgb_matrix_driver.flush(); }
182 189
183void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color(index, red, green, blue); } 190void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
191#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
192 if (!is_keyboard_left() && index >= k_rgb_matrix_split[0])
193 rgb_matrix_driver.set_color(index - k_rgb_matrix_split[0], red, green, blue);
194 else if (is_keyboard_left() && index < k_rgb_matrix_split[0])
195#endif
196 rgb_matrix_driver.set_color(index, red, green, blue);
197}
184 198
185void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color_all(red, green, blue); } 199void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
200#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
201 for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) rgb_matrix_set_color(i, red, green, blue);
202#else
203 rgb_matrix_driver.set_color_all(red, green, blue);
204#endif
205}
186 206
187void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) { 207void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) {
188#ifndef RGB_MATRIX_SPLIT 208#ifndef RGB_MATRIX_SPLIT
@@ -315,6 +335,10 @@ static void rgb_task_start(void) {
315static void rgb_task_render(uint8_t effect) { 335static void rgb_task_render(uint8_t effect) {
316 bool rendering = false; 336 bool rendering = false;
317 rgb_effect_params.init = (effect != rgb_last_effect) || (rgb_matrix_config.enable != rgb_last_enable); 337 rgb_effect_params.init = (effect != rgb_last_effect) || (rgb_matrix_config.enable != rgb_last_enable);
338 if (rgb_effect_params.flags != rgb_matrix_config.flags) {
339 rgb_effect_params.flags = rgb_matrix_config.flags;
340 rgb_matrix_set_color_all(0, 0, 0);
341 }
318 342
319 // each effect can opt to do calculations 343 // each effect can opt to do calculations
320 // and/or request PWM buffer updates. 344 // and/or request PWM buffer updates.
@@ -618,6 +642,6 @@ void rgb_matrix_decrease_speed_helper(bool write_to_eeprom) { rgb_matrix_set_spe
618void rgb_matrix_decrease_speed_noeeprom(void) { rgb_matrix_decrease_speed_helper(false); } 642void rgb_matrix_decrease_speed_noeeprom(void) { rgb_matrix_decrease_speed_helper(false); }
619void rgb_matrix_decrease_speed(void) { rgb_matrix_decrease_speed_helper(true); } 643void rgb_matrix_decrease_speed(void) { rgb_matrix_decrease_speed_helper(true); }
620 644
621led_flags_t rgb_matrix_get_flags(void) { return rgb_effect_params.flags; } 645led_flags_t rgb_matrix_get_flags(void) { return rgb_matrix_config.flags; }
622 646
623void rgb_matrix_set_flags(led_flags_t flags) { rgb_effect_params.flags = flags; } 647void rgb_matrix_set_flags(led_flags_t flags) { rgb_matrix_config.flags = flags; }
diff --git a/quantum/rgb_matrix_types.h b/quantum/rgb_matrix_types.h
index 7b8171fb2..1a37922af 100644
--- a/quantum/rgb_matrix_types.h
+++ b/quantum/rgb_matrix_types.h
@@ -85,10 +85,11 @@ typedef struct PACKED {
85typedef union { 85typedef union {
86 uint32_t raw; 86 uint32_t raw;
87 struct PACKED { 87 struct PACKED {
88 uint8_t enable : 2; 88 uint8_t enable : 2;
89 uint8_t mode : 6; 89 uint8_t mode : 6;
90 HSV hsv; 90 HSV hsv;
91 uint8_t speed; // EECONFIG needs to be increased to support this 91 uint8_t speed; // EECONFIG needs to be increased to support this
92 led_flags_t flags;
92 }; 93 };
93} rgb_config_t; 94} rgb_config_t;
94 95
diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c
index 2ae44e6e1..9e75e19ce 100644
--- a/quantum/split_common/split_util.c
+++ b/quantum/split_common/split_util.c
@@ -1,3 +1,18 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include "split_util.h" 16#include "split_util.h"
2#include "matrix.h" 17#include "matrix.h"
3#include "keyboard.h" 18#include "keyboard.h"
@@ -6,14 +21,7 @@
6#include "transport.h" 21#include "transport.h"
7#include "quantum.h" 22#include "quantum.h"
8#include "wait.h" 23#include "wait.h"
9 24#include "usb_util.h"
10#ifdef PROTOCOL_LUFA
11# include <LUFA/Drivers/USB/USB.h>
12#endif
13
14#ifdef PROTOCOL_VUSB
15# include <usbdrv/usbdrv.h>
16#endif
17 25
18#ifdef EE_HANDS 26#ifdef EE_HANDS
19# include "eeconfig.h" 27# include "eeconfig.h"
@@ -31,56 +39,21 @@
31# define SPLIT_USB_TIMEOUT_POLL 10 39# define SPLIT_USB_TIMEOUT_POLL 10
32#endif 40#endif
33 41
34#ifdef PROTOCOL_CHIBIOS
35# define SPLIT_USB_DETECT // Force this on for now
36#endif
37
38volatile bool isLeftHand = true; 42volatile bool isLeftHand = true;
39 43
40#if defined(SPLIT_USB_DETECT) 44#if defined(SPLIT_USB_DETECT)
41# if defined(PROTOCOL_LUFA) 45static bool usbIsActive(void) {
42static inline bool usbHasActiveConnection(void) { return USB_Device_IsAddressSet(); }
43static inline void usbDisable(void) {
44 USB_Disable();
45 USB_DeviceState = DEVICE_STATE_Unattached;
46}
47# elif defined(PROTOCOL_CHIBIOS)
48static inline bool usbHasActiveConnection(void) { return usbGetDriverStateI(&USBD1) == USB_ACTIVE; }
49static inline void usbDisable(void) { usbStop(&USBD1); }
50# elif defined(PROTOCOL_VUSB)
51static inline bool usbHasActiveConnection(void) {
52 usbPoll();
53 return usbConfiguration;
54}
55static inline void usbDisable(void) { usbDeviceDisconnect(); }
56# else
57static inline bool usbHasActiveConnection(void) { return true; }
58static inline void usbDisable(void) {}
59# endif
60
61bool usbIsActive(void) {
62 for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) { 46 for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) {
63 // This will return true if a USB connection has been established 47 // This will return true if a USB connection has been established
64 if (usbHasActiveConnection()) { 48 if (usb_connected_state()) {
65 return true; 49 return true;
66 } 50 }
67 wait_ms(SPLIT_USB_TIMEOUT_POLL); 51 wait_ms(SPLIT_USB_TIMEOUT_POLL);
68 } 52 }
69
70 // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow
71 usbDisable();
72
73 return false; 53 return false;
74} 54}
75#elif defined(PROTOCOL_LUFA) && defined(OTGPADE)
76static inline bool usbIsActive(void) {
77 USB_OTGPAD_On(); // enables VBUS pad
78 wait_us(5);
79
80 return USB_VBUS_GetStatus(); // checks state of VBUS
81}
82#else 55#else
83static inline bool usbIsActive(void) { return true; } 56static inline bool usbIsActive(void) { return usb_vbus_state(); }
84#endif 57#endif
85 58
86#ifdef SPLIT_HAND_MATRIX_GRID 59#ifdef SPLIT_HAND_MATRIX_GRID
@@ -126,6 +99,11 @@ __attribute__((weak)) bool is_keyboard_master(void) {
126 // only check once, as this is called often 99 // only check once, as this is called often
127 if (usbstate == UNKNOWN) { 100 if (usbstate == UNKNOWN) {
128 usbstate = usbIsActive() ? MASTER : SLAVE; 101 usbstate = usbIsActive() ? MASTER : SLAVE;
102
103 // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow
104 if (usbstate == SLAVE) {
105 usb_disable();
106 }
129 } 107 }
130 108
131 return (usbstate == MASTER); 109 return (usbstate == MASTER);
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c
index 61b61ea08..27a1c0d3a 100644
--- a/quantum/split_common/transport.c
+++ b/quantum/split_common/transport.c
@@ -22,6 +22,10 @@ static pin_t encoders_pad[] = ENCODERS_PAD_A;
22# define NUMBER_OF_ENCODERS (sizeof(encoders_pad) / sizeof(pin_t)) 22# define NUMBER_OF_ENCODERS (sizeof(encoders_pad) / sizeof(pin_t))
23#endif 23#endif
24 24
25#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
26# include "rgb_matrix.h"
27#endif
28
25#if defined(USE_I2C) 29#if defined(USE_I2C)
26 30
27# include "i2c_master.h" 31# include "i2c_master.h"
@@ -54,6 +58,10 @@ typedef struct _I2C_slave_buffer_t {
54# ifdef WPM_ENABLE 58# ifdef WPM_ENABLE
55 uint8_t current_wpm; 59 uint8_t current_wpm;
56# endif 60# endif
61# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
62 rgb_config_t rgb_matrix;
63 bool rgb_suspend_state;
64# endif
57} I2C_slave_buffer_t; 65} I2C_slave_buffer_t;
58 66
59static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; 67static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg;
@@ -68,6 +76,8 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re
68# define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) 76# define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync)
69# define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state) 77# define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state)
70# define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm) 78# define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm)
79# define I2C_RGB_MATRIX_START offsetof(I2C_slave_buffer_t, rgb_matrix)
80# define I2C_RGB_SUSPEND_START offsetof(I2C_slave_buffer_t, rgb_suspend_state)
71 81
72# define TIMEOUT 100 82# define TIMEOUT 100
73 83
@@ -141,6 +151,11 @@ bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[])
141# endif 151# endif
142# endif 152# endif
143 153
154# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
155 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_MATRIX_START, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix), TIMEOUT);
156 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_SUSPEND_START, (void *)g_suspend_state, sizeof(i2c_buffer->rgb_suspend_state), TIMEOUT);
157# endif
158
144# ifndef DISABLE_SYNC_TIMER 159# ifndef DISABLE_SYNC_TIMER
145 i2c_buffer->sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; 160 i2c_buffer->sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET;
146 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_SYNC_TIME_START, (void *)&i2c_buffer->sync_timer, sizeof(i2c_buffer->sync_timer), TIMEOUT); 161 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_SYNC_TIME_START, (void *)&i2c_buffer->sync_timer, sizeof(i2c_buffer->sync_timer), TIMEOUT);
@@ -186,6 +201,11 @@ void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[])
186 set_oneshot_mods(i2c_buffer->oneshot_mods); 201 set_oneshot_mods(i2c_buffer->oneshot_mods);
187# endif 202# endif
188# endif 203# endif
204
205# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
206 memcpy((void *)i2c_buffer->rgb_matrix, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix));
207 memcpy((void *)i2c_buffer->rgb_suspend_state, (void *)g_suspend_state, sizeof(i2c_buffer->rgb_suspend_state));
208# endif
189} 209}
190 210
191void transport_master_init(void) { i2c_init(); } 211void transport_master_init(void) { i2c_init(); }
@@ -226,6 +246,10 @@ typedef struct _Serial_m2s_buffer_t {
226# ifdef WPM_ENABLE 246# ifdef WPM_ENABLE
227 uint8_t current_wpm; 247 uint8_t current_wpm;
228# endif 248# endif
249# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
250 rgb_config_t rgb_matrix;
251 bool rgb_suspend_state;
252# endif
229} Serial_m2s_buffer_t; 253} Serial_m2s_buffer_t;
230 254
231# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 255# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
@@ -333,18 +357,24 @@ bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[])
333 357
334# ifdef WPM_ENABLE 358# ifdef WPM_ENABLE
335 // Write wpm to slave 359 // Write wpm to slave
336 serial_m2s_buffer.current_wpm = get_current_wpm(); 360 serial_m2s_buffer.current_wpm = get_current_wpm();
337# endif 361# endif
338 362
339# ifdef SPLIT_MODS_ENABLE 363# ifdef SPLIT_MODS_ENABLE
340 serial_m2s_buffer.real_mods = get_mods(); 364 serial_m2s_buffer.real_mods = get_mods();
341 serial_m2s_buffer.weak_mods = get_weak_mods(); 365 serial_m2s_buffer.weak_mods = get_weak_mods();
342# ifndef NO_ACTION_ONESHOT 366# ifndef NO_ACTION_ONESHOT
343 serial_m2s_buffer.oneshot_mods = get_oneshot_mods(); 367 serial_m2s_buffer.oneshot_mods = get_oneshot_mods();
344# endif 368# endif
345# endif 369# endif
370
371# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
372 serial_m2s_buffer.rgb_matrix = rgb_matrix_config;
373 serial_m2s_buffer.rgb_suspend_state = g_suspend_state;
374# endif
375
346# ifndef DISABLE_SYNC_TIMER 376# ifndef DISABLE_SYNC_TIMER
347 serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; 377 serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET;
348# endif 378# endif
349 return true; 379 return true;
350} 380}
@@ -381,6 +411,11 @@ void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[])
381 set_oneshot_mods(serial_m2s_buffer.oneshot_mods); 411 set_oneshot_mods(serial_m2s_buffer.oneshot_mods);
382# endif 412# endif
383# endif 413# endif
414
415# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
416 rgb_matrix_config = serial_m2s_buffer.rgb_matrix;
417 g_suspend_state = serial_m2s_buffer.rgb_suspend_state;
418# endif
384} 419}
385 420
386#endif 421#endif
diff --git a/readme.md b/readme.md
index 6092f209b..bb85115af 100644
--- a/readme.md
+++ b/readme.md
@@ -9,6 +9,12 @@
9 9
10This is a keyboard firmware based on the [tmk\_keyboard firmware](https://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR and ARM controllers, and more specifically, the [OLKB product line](https://olkb.com), the [ErgoDox EZ](https://ergodox-ez.com) keyboard, and the [Clueboard product line](https://clueboard.co). 10This is a keyboard firmware based on the [tmk\_keyboard firmware](https://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR and ARM controllers, and more specifically, the [OLKB product line](https://olkb.com), the [ErgoDox EZ](https://ergodox-ez.com) keyboard, and the [Clueboard product line](https://clueboard.co).
11 11
12# THIS IS THE DEVELOP BRANCH
13
14Warning- This is the `develop` branch of QMK Firmware. You may encounter broken code here. Please see [Breaking Changes](https://docs.qmk.fm/#/breaking_changes) for more information.
15
16# Original readme continues
17
12## Documentation 18## Documentation
13 19
14* [See the official documentation on docs.qmk.fm](https://docs.qmk.fm) 20* [See the official documentation on docs.qmk.fm](https://docs.qmk.fm)
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index 238b3c69f..2f8f81126 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -12,6 +12,7 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \
12 $(COMMON_DIR)/sendchar_null.c \ 12 $(COMMON_DIR)/sendchar_null.c \
13 $(COMMON_DIR)/eeconfig.c \ 13 $(COMMON_DIR)/eeconfig.c \
14 $(COMMON_DIR)/report.c \ 14 $(COMMON_DIR)/report.c \
15 $(COMMON_DIR)/usb_util.c \
15 $(PLATFORM_COMMON_DIR)/suspend.c \ 16 $(PLATFORM_COMMON_DIR)/suspend.c \
16 $(PLATFORM_COMMON_DIR)/timer.c \ 17 $(PLATFORM_COMMON_DIR)/timer.c \
17 $(COMMON_DIR)/sync_timer.c \ 18 $(COMMON_DIR)/sync_timer.c \
@@ -24,28 +25,6 @@ else
24 include $(TMK_PATH)/$(COMMON_DIR)/lib_printf.mk 25 include $(TMK_PATH)/$(COMMON_DIR)/lib_printf.mk
25endif 26endif
26 27
27# Option modules
28BOOTMAGIC_ENABLE ?= no
29VALID_MAGIC_TYPES := yes full lite
30ifneq ($(strip $(BOOTMAGIC_ENABLE)), no)
31 ifeq ($(filter $(BOOTMAGIC_ENABLE),$(VALID_MAGIC_TYPES)),)
32 $(error BOOTMAGIC_ENABLE="$(BOOTMAGIC_ENABLE)" is not a valid type of magic)
33 endif
34 ifeq ($(strip $(BOOTMAGIC_ENABLE)), lite)
35 TMK_COMMON_DEFS += -DBOOTMAGIC_LITE
36 TMK_COMMON_SRC += $(COMMON_DIR)/bootmagic_lite.c
37
38 TMK_COMMON_DEFS += -DMAGIC_ENABLE
39 TMK_COMMON_SRC += $(COMMON_DIR)/magic.c
40 else
41 TMK_COMMON_DEFS += -DBOOTMAGIC_ENABLE
42 TMK_COMMON_SRC += $(COMMON_DIR)/bootmagic.c
43 endif
44else
45 TMK_COMMON_DEFS += -DMAGIC_ENABLE
46 TMK_COMMON_SRC += $(COMMON_DIR)/magic.c
47endif
48
49SHARED_EP_ENABLE = no 28SHARED_EP_ENABLE = no
50MOUSE_SHARED_EP ?= yes 29MOUSE_SHARED_EP ?= yes
51ifeq ($(strip $(KEYBOARD_SHARED_EP)), yes) 30ifeq ($(strip $(KEYBOARD_SHARED_EP)), yes)
diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c
index 000503b08..a57c8bf66 100644
--- a/tmk_core/common/action_util.c
+++ b/tmk_core/common/action_util.c
@@ -147,12 +147,16 @@ void clear_oneshot_swaphands(void) {
147 * FIXME: needs doc 147 * FIXME: needs doc
148 */ 148 */
149void set_oneshot_layer(uint8_t layer, uint8_t state) { 149void set_oneshot_layer(uint8_t layer, uint8_t state) {
150 oneshot_layer_data = layer << 3 | state; 150 if (!keymap_config.oneshot_disable) {
151 layer_on(layer); 151 oneshot_layer_data = layer << 3 | state;
152 layer_on(layer);
152# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) 153# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
153 oneshot_layer_time = timer_read(); 154 oneshot_layer_time = timer_read();
154# endif 155# endif
155 oneshot_layer_changed_kb(get_oneshot_layer()); 156 oneshot_layer_changed_kb(get_oneshot_layer());
157 } else {
158 layer_on(layer);
159 }
156} 160}
157/** \brief Reset oneshot layer 161/** \brief Reset oneshot layer
158 * 162 *
@@ -172,7 +176,7 @@ void reset_oneshot_layer(void) {
172void clear_oneshot_layer_state(oneshot_fullfillment_t state) { 176void clear_oneshot_layer_state(oneshot_fullfillment_t state) {
173 uint8_t start_state = oneshot_layer_data; 177 uint8_t start_state = oneshot_layer_data;
174 oneshot_layer_data &= ~state; 178 oneshot_layer_data &= ~state;
175 if (!get_oneshot_layer_state() && start_state != oneshot_layer_data) { 179 if ((!get_oneshot_layer_state() && start_state != oneshot_layer_data) || keymap_config.oneshot_disable) {
176 layer_off(get_oneshot_layer()); 180 layer_off(get_oneshot_layer());
177 reset_oneshot_layer(); 181 reset_oneshot_layer();
178 } 182 }
@@ -182,6 +186,39 @@ void clear_oneshot_layer_state(oneshot_fullfillment_t state) {
182 * FIXME: needs doc 186 * FIXME: needs doc
183 */ 187 */
184bool is_oneshot_layer_active(void) { return get_oneshot_layer_state(); } 188bool is_oneshot_layer_active(void) { return get_oneshot_layer_state(); }
189
190/** \brief set oneshot
191 *
192 * FIXME: needs doc
193 */
194void oneshot_set(bool active) {
195 if (keymap_config.oneshot_disable != active) {
196 keymap_config.oneshot_disable = active;
197 eeconfig_update_keymap(keymap_config.raw);
198 dprintf("Oneshot: active: %d\n", active);
199 }
200}
201
202/** \brief toggle oneshot
203 *
204 * FIXME: needs doc
205 */
206void oneshot_toggle(void) { oneshot_set(!keymap_config.oneshot_disable); }
207
208/** \brief enable oneshot
209 *
210 * FIXME: needs doc
211 */
212void oneshot_enable(void) { oneshot_set(true); }
213
214/** \brief disable oneshot
215 *
216 * FIXME: needs doc
217 */
218void oneshot_disable(void) { oneshot_set(false); }
219
220bool is_oneshot_enabled(void) { return keymap_config.oneshot_disable; }
221
185#endif 222#endif
186 223
187/** \brief Send keyboard report 224/** \brief Send keyboard report
@@ -321,14 +358,17 @@ void del_oneshot_mods(uint8_t mods) {
321 * FIXME: needs doc 358 * FIXME: needs doc
322 */ 359 */
323void set_oneshot_mods(uint8_t mods) { 360void set_oneshot_mods(uint8_t mods) {
324 if (oneshot_mods != mods) { 361 if (!keymap_config.oneshot_disable) {
362 if (oneshot_mods != mods) {
325# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) 363# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
326 oneshot_time = timer_read(); 364 oneshot_time = timer_read();
327# endif 365# endif
328 oneshot_mods = mods; 366 oneshot_mods = mods;
329 oneshot_mods_changed_kb(mods); 367 oneshot_mods_changed_kb(mods);
368 }
330 } 369 }
331} 370}
371
332/** \brief clear oneshot mods 372/** \brief clear oneshot mods
333 * 373 *
334 * FIXME: needs doc 374 * FIXME: needs doc
diff --git a/tmk_core/common/action_util.h b/tmk_core/common/action_util.h
index ff29f79b0..f2b3897ae 100644
--- a/tmk_core/common/action_util.h
+++ b/tmk_core/common/action_util.h
@@ -85,6 +85,11 @@ void oneshot_mods_changed_kb(uint8_t mods);
85void oneshot_layer_changed_user(uint8_t layer); 85void oneshot_layer_changed_user(uint8_t layer);
86void oneshot_layer_changed_kb(uint8_t layer); 86void oneshot_layer_changed_kb(uint8_t layer);
87 87
88void oneshot_toggle(void);
89void oneshot_enable(void);
90void oneshot_disable(void);
91bool is_oneshot_enabled(void);
92
88/* inspect */ 93/* inspect */
89uint8_t has_anymod(void); 94uint8_t has_anymod(void);
90 95
diff --git a/tmk_core/common/arm_atsam/_wait.h b/tmk_core/common/arm_atsam/_wait.h
new file mode 100644
index 000000000..41b686b56
--- /dev/null
+++ b/tmk_core/common/arm_atsam/_wait.h
@@ -0,0 +1,22 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include "clks.h"
19
20#define wait_ms(ms) CLK_delay_ms(ms)
21#define wait_us(us) CLK_delay_us(us)
22#define waitInputPinDelay()
diff --git a/tmk_core/common/avr/_wait.h b/tmk_core/common/avr/_wait.h
new file mode 100644
index 000000000..56eb316fa
--- /dev/null
+++ b/tmk_core/common/avr/_wait.h
@@ -0,0 +1,29 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include <util/delay.h>
19
20#define wait_ms(ms) _delay_ms(ms)
21#define wait_us(us) _delay_us(us)
22
23/* The AVR series GPIOs have a one clock read delay for changes in the digital input signal.
24 * But here's more margin to make it two clocks. */
25#ifndef GPIO_INPUT_PIN_DELAY
26# define GPIO_INPUT_PIN_DELAY 2
27#endif
28
29#define waitInputPinDelay() __builtin_avr_delay_cycles(GPIO_INPUT_PIN_DELAY)
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index 47a82a2ee..d52c8ac41 100644
--- a/tmk_core/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
@@ -28,6 +28,10 @@
28# include "rgblight.h" 28# include "rgblight.h"
29#endif 29#endif
30 30
31#ifdef RGB_MATRIX_ENABLE
32# include "rgb_matrix.h"
33#endif
34
31/** \brief Suspend idle 35/** \brief Suspend idle
32 * 36 *
33 * FIXME: needs doc 37 * FIXME: needs doc
diff --git a/tmk_core/common/chibios/_wait.h b/tmk_core/common/chibios/_wait.h
new file mode 100644
index 000000000..5bface53e
--- /dev/null
+++ b/tmk_core/common/chibios/_wait.h
@@ -0,0 +1,55 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include <ch.h>
19
20/* chThdSleepX of zero maps to infinite - so we map to a tiny delay to still yield */
21#define wait_ms(ms) \
22 do { \
23 if (ms != 0) { \
24 chThdSleepMilliseconds(ms); \
25 } else { \
26 chThdSleepMicroseconds(1); \
27 } \
28 } while (0)
29#define wait_us(us) \
30 do { \
31 if (us != 0) { \
32 chThdSleepMicroseconds(us); \
33 } else { \
34 chThdSleepMicroseconds(1); \
35 } \
36 } while (0)
37
38/* For GPIOs on ARM-based MCUs, the input pins are sampled by the clock of the bus
39 * to which the GPIO is connected.
40 * The connected buses differ depending on the various series of MCUs.
41 * And since the instruction execution clock of the CPU and the bus clock of GPIO are different,
42 * there is a delay of several clocks to read the change of the input signal.
43 *
44 * Define this delay with the GPIO_INPUT_PIN_DELAY macro.
45 * If the GPIO_INPUT_PIN_DELAY macro is not defined, the following default values will be used.
46 * (A fairly large value of 0.25 microseconds is set.)
47 */
48
49#include "wait.c"
50
51#ifndef GPIO_INPUT_PIN_DELAY
52# define GPIO_INPUT_PIN_DELAY (STM32_SYSCLK / 1000000L / 4)
53#endif
54
55#define waitInputPinDelay() wait_cpuclock(GPIO_INPUT_PIN_DELAY)
diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c
index 6cabcc4b8..4a175a628 100644
--- a/tmk_core/common/chibios/bootloader.c
+++ b/tmk_core/common/chibios/bootloader.c
@@ -79,7 +79,7 @@ void enter_bootloader_mode_if_requested(void) {
79 } 79 }
80} 80}
81 81
82#elif defined(KL2x) || defined(K20x) // STM32_BOOTLOADER_DUAL_BANK // STM32_BOOTLOADER_ADDRESS 82#elif defined(KL2x) || defined(K20x) || defined(MK66F18) // STM32_BOOTLOADER_DUAL_BANK // STM32_BOOTLOADER_ADDRESS
83/* Kinetis */ 83/* Kinetis */
84 84
85# if defined(BOOTLOADER_KIIBOHD) 85# if defined(BOOTLOADER_KIIBOHD)
diff --git a/tmk_core/common/chibios/chibios_config.h b/tmk_core/common/chibios/chibios_config.h
index b4d96465d..1d8ace495 100644
--- a/tmk_core/common/chibios/chibios_config.h
+++ b/tmk_core/common/chibios/chibios_config.h
@@ -15,6 +15,8 @@
15 */ 15 */
16#pragma once 16#pragma once
17 17
18#define SPLIT_USB_DETECT // Force this on for now
19
18#if defined(STM32F1XX) 20#if defined(STM32F1XX)
19# define USE_GPIOV1 21# define USE_GPIOV1
20#endif 22#endif
@@ -28,4 +30,9 @@
28# define USE_I2CV1 30# define USE_I2CV1
29# define USE_I2CV1_CONTRIB // for some reason a bunch of ChibiOS-Contrib boards only have clock_speed 31# define USE_I2CV1_CONTRIB // for some reason a bunch of ChibiOS-Contrib boards only have clock_speed
30# define USE_GPIOV1 32# define USE_GPIOV1
33# define STM32_SYSCLK KINETIS_SYSCLK_FREQUENCY
34#endif
35
36#if defined(MK66F18)
37# define STM32_SYSCLK KINETIS_SYSCLK_FREQUENCY
31#endif 38#endif
diff --git a/tmk_core/common/chibios/sleep_led.c b/tmk_core/common/chibios/sleep_led.c
index 5595eec0e..477056a45 100644
--- a/tmk_core/common/chibios/sleep_led.c
+++ b/tmk_core/common/chibios/sleep_led.c
@@ -9,21 +9,13 @@
9 * Use LP timer on Kinetises, TIM14 on STM32F0. 9 * Use LP timer on Kinetises, TIM14 on STM32F0.
10 */ 10 */
11 11
12#if defined(KL2x) || defined(K20x) 12#ifndef SLEEP_LED_GPT_DRIVER
13 13# if defined(STM32F0XX)
14/* Use Low Power Timer (LPTMR) */ 14# define SLEEP_LED_GPT_DRIVER GPTD14
15# define TIMER_INTERRUPT_VECTOR KINETIS_LPTMR0_IRQ_VECTOR 15# endif
16# define RESET_COUNTER LPTMR0->CSR |= LPTMRx_CSR_TCF
17
18#elif defined(STM32F0XX)
19
20/* Use TIM14 manually */
21# define TIMER_INTERRUPT_VECTOR STM32_TIM14_HANDLER
22# define RESET_COUNTER STM32_TIM14->SR &= ~STM32_TIM_SR_UIF
23
24#endif 16#endif
25 17
26#if defined(KL2x) || defined(K20x) || defined(STM32F0XX) /* common parts for timers/interrupts */ 18#if defined(KL2x) || defined(K20x) || defined(SLEEP_LED_GPT_DRIVER) /* common parts for timers/interrupts */
27 19
28/* Breathing Sleep LED brighness(PWM On period) table 20/* Breathing Sleep LED brighness(PWM On period) table
29 * (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle 21 * (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle
@@ -33,10 +25,7 @@
33 */ 25 */
34static const uint8_t breathing_table[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 6, 10, 15, 23, 32, 44, 58, 74, 93, 113, 135, 157, 179, 199, 218, 233, 245, 252, 255, 252, 245, 233, 218, 199, 179, 157, 135, 113, 93, 74, 58, 44, 32, 23, 15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 26static const uint8_t breathing_table[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 6, 10, 15, 23, 32, 44, 58, 74, 93, 113, 135, 157, 179, 199, 218, 233, 245, 252, 255, 252, 245, 233, 218, 199, 179, 157, 135, 113, 93, 74, 58, 44, 32, 23, 15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
35 27
36/* interrupt handler */ 28void sleep_led_timer_callback(void) {
37OSAL_IRQ_HANDLER(TIMER_INTERRUPT_VECTOR) {
38 OSAL_IRQ_PROLOGUE();
39
40 /* Software PWM 29 /* Software PWM
41 * timer:1111 1111 1111 1111 30 * timer:1111 1111 1111 1111
42 * \_____/\/ \_______/____ count(0-255) 31 * \_____/\/ \_______/____ count(0-255)
@@ -64,17 +53,16 @@ OSAL_IRQ_HANDLER(TIMER_INTERRUPT_VECTOR) {
64 if (timer.pwm.count == breathing_table[timer.pwm.index]) { 53 if (timer.pwm.count == breathing_table[timer.pwm.index]) {
65 led_set(0); 54 led_set(0);
66 } 55 }
67
68 /* Reset the counter */
69 RESET_COUNTER;
70
71 OSAL_IRQ_EPILOGUE();
72} 56}
73 57
74#endif /* common parts for known platforms */ 58#endif /* common parts for known platforms */
75 59
76#if defined(KL2x) || defined(K20x) /* platform selection: familiar Kinetis chips */ 60#if defined(KL2x) || defined(K20x) /* platform selection: familiar Kinetis chips */
77 61
62/* Use Low Power Timer (LPTMR) */
63# define TIMER_INTERRUPT_VECTOR KINETIS_LPTMR0_IRQ_VECTOR
64# define RESET_COUNTER LPTMR0->CSR |= LPTMRx_CSR_TCF
65
78/* LPTMR clock options */ 66/* LPTMR clock options */
79# define LPTMR_CLOCK_MCGIRCLK 0 /* 4MHz clock */ 67# define LPTMR_CLOCK_MCGIRCLK 0 /* 4MHz clock */
80# define LPTMR_CLOCK_LPO 1 /* 1kHz clock */ 68# define LPTMR_CLOCK_LPO 1 /* 1kHz clock */
@@ -86,6 +74,18 @@ OSAL_IRQ_HANDLER(TIMER_INTERRUPT_VECTOR) {
86# define SIM_SCGC5_LPTMR SIM_SCGC5_LPTIMER 74# define SIM_SCGC5_LPTMR SIM_SCGC5_LPTIMER
87# endif 75# endif
88 76
77/* interrupt handler */
78OSAL_IRQ_HANDLER(TIMER_INTERRUPT_VECTOR) {
79 OSAL_IRQ_PROLOGUE();
80
81 sleep_led_timer_callback();
82
83 /* Reset the counter */
84 RESET_COUNTER;
85
86 OSAL_IRQ_EPILOGUE();
87}
88
89/* Initialise the timer */ 89/* Initialise the timer */
90void sleep_led_init(void) { 90void sleep_led_init(void) {
91 /* Make sure the clock to the LPTMR is enabled */ 91 /* Make sure the clock to the LPTMR is enabled */
@@ -159,45 +159,23 @@ void sleep_led_toggle(void) {
159 LPTMR0->CSR ^= LPTMRx_CSR_TEN; 159 LPTMR0->CSR ^= LPTMRx_CSR_TEN;
160} 160}
161 161
162#elif defined(STM32F0XX) /* platform selection: STM32F0XX */ 162#elif defined(SLEEP_LED_GPT_DRIVER)
163
164/* Initialise the timer */
165void sleep_led_init(void) {
166 /* enable clock */
167 rccEnableTIM14(FALSE); /* low power enable = FALSE */
168 rccResetTIM14();
169
170 /* prescale */
171 /* Assuming 48MHz internal clock */
172 /* getting cca 65484 irqs/sec */
173 STM32_TIM14->PSC = 733;
174 163
175 /* auto-reload */ 164static void gptTimerCallback(GPTDriver *gptp) {
176 /* 0 => interrupt every time */ 165 (void)gptp;
177 STM32_TIM14->ARR = 3; 166 sleep_led_timer_callback();
167}
178 168
179 /* enable counter update event interrupt */ 169static const GPTConfig gptcfg = {1000000, gptTimerCallback, 0, 0};
180 STM32_TIM14->DIER |= STM32_TIM_DIER_UIE;
181 170
182 /* register interrupt vector */ 171/* Initialise the timer */
183 nvicEnableVector(STM32_TIM14_NUMBER, 2); /* vector, priority */ 172void sleep_led_init(void) { gptStart(&SLEEP_LED_GPT_DRIVER, &gptcfg); }
184}
185 173
186void sleep_led_enable(void) { 174void sleep_led_enable(void) { gptStartContinuous(&SLEEP_LED_GPT_DRIVER, gptcfg.frequency / 0xFFFF); }
187 /* Enable the timer */
188 STM32_TIM14->CR1 = STM32_TIM_CR1_CEN | STM32_TIM_CR1_URS;
189 /* URS => update event only on overflow; setting UG bit disabled */
190}
191 175
192void sleep_led_disable(void) { 176void sleep_led_disable(void) { gptStopTimer(&SLEEP_LED_GPT_DRIVER); }
193 /* Disable the timer */
194 STM32_TIM14->CR1 = 0;
195}
196 177
197void sleep_led_toggle(void) { 178void sleep_led_toggle(void) { (SLEEP_LED_GPT_DRIVER.state == GPT_READY) ? sleep_led_enable() : sleep_led_disable(); }
198 /* Toggle the timer */
199 STM32_TIM14->CR1 ^= STM32_TIM_CR1_CEN;
200}
201 179
202#else /* platform selection: not on familiar chips */ 180#else /* platform selection: not on familiar chips */
203 181
diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c
index 49e20641f..17f024cab 100644
--- a/tmk_core/common/chibios/suspend.c
+++ b/tmk_core/common/chibios/suspend.c
@@ -24,6 +24,10 @@
24# include "rgblight.h" 24# include "rgblight.h"
25#endif 25#endif
26 26
27#ifdef RGB_MATRIX_ENABLE
28# include "rgb_matrix.h"
29#endif
30
27/** \brief suspend idle 31/** \brief suspend idle
28 * 32 *
29 * FIXME: needs doc 33 * FIXME: needs doc
@@ -53,6 +57,10 @@ void suspend_power_down(void) {
53 backlight_set(0); 57 backlight_set(0);
54#endif 58#endif
55 59
60#ifdef RGB_MATRIX_ENABLE
61 rgb_matrix_task();
62#endif
63
56 // Turn off LED indicators 64 // Turn off LED indicators
57 uint8_t leds_off = 0; 65 uint8_t leds_off = 0;
58#if defined(BACKLIGHT_CAPS_LOCK) && defined(BACKLIGHT_ENABLE) 66#if defined(BACKLIGHT_CAPS_LOCK) && defined(BACKLIGHT_ENABLE)
diff --git a/tmk_core/common/chibios/wait.c b/tmk_core/common/chibios/wait.c
new file mode 100644
index 000000000..c6270fd95
--- /dev/null
+++ b/tmk_core/common/chibios/wait.c
@@ -0,0 +1,89 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __OPTIMIZE__
18# pragma message "Compiler optimizations disabled; wait_cpuclock() won't work as designed"
19#endif
20
21#define CLOCK_DELAY_NOP8 "nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t"
22
23__attribute__((always_inline)) static inline void wait_cpuclock(unsigned int n) { /* n: 1..135 */
24 /* The argument n must be a constant expression.
25 * That way, compiler optimization will remove unnecessary code. */
26 if (n < 1) {
27 return;
28 }
29 if (n > 8) {
30 unsigned int n8 = n / 8;
31 n = n - n8 * 8;
32 switch (n8) {
33 case 16:
34 asm volatile(CLOCK_DELAY_NOP8::: "memory");
35 case 15:
36 asm volatile(CLOCK_DELAY_NOP8::: "memory");
37 case 14:
38 asm volatile(CLOCK_DELAY_NOP8::: "memory");
39 case 13:
40 asm volatile(CLOCK_DELAY_NOP8::: "memory");
41 case 12:
42 asm volatile(CLOCK_DELAY_NOP8::: "memory");
43 case 11:
44 asm volatile(CLOCK_DELAY_NOP8::: "memory");
45 case 10:
46 asm volatile(CLOCK_DELAY_NOP8::: "memory");
47 case 9:
48 asm volatile(CLOCK_DELAY_NOP8::: "memory");
49 case 8:
50 asm volatile(CLOCK_DELAY_NOP8::: "memory");
51 case 7:
52 asm volatile(CLOCK_DELAY_NOP8::: "memory");
53 case 6:
54 asm volatile(CLOCK_DELAY_NOP8::: "memory");
55 case 5:
56 asm volatile(CLOCK_DELAY_NOP8::: "memory");
57 case 4:
58 asm volatile(CLOCK_DELAY_NOP8::: "memory");
59 case 3:
60 asm volatile(CLOCK_DELAY_NOP8::: "memory");
61 case 2:
62 asm volatile(CLOCK_DELAY_NOP8::: "memory");
63 case 1:
64 asm volatile(CLOCK_DELAY_NOP8::: "memory");
65 case 0:
66 break;
67 }
68 }
69 switch (n) {
70 case 8:
71 asm volatile("nop" ::: "memory");
72 case 7:
73 asm volatile("nop" ::: "memory");
74 case 6:
75 asm volatile("nop" ::: "memory");
76 case 5:
77 asm volatile("nop" ::: "memory");
78 case 4:
79 asm volatile("nop" ::: "memory");
80 case 3:
81 asm volatile("nop" ::: "memory");
82 case 2:
83 asm volatile("nop" ::: "memory");
84 case 1:
85 asm volatile("nop" ::: "memory");
86 case 0:
87 break;
88 }
89} \ No newline at end of file
diff --git a/tmk_core/common/eeconfig.c b/tmk_core/common/eeconfig.c
index 5e3ebe6ee..92a509217 100644
--- a/tmk_core/common/eeconfig.c
+++ b/tmk_core/common/eeconfig.c
@@ -57,7 +57,7 @@ void eeconfig_init_quantum(void) {
57 eeprom_update_dword(EECONFIG_HAPTIC, 0); 57 eeprom_update_dword(EECONFIG_HAPTIC, 0);
58 eeprom_update_byte(EECONFIG_VELOCIKEY, 0); 58 eeprom_update_byte(EECONFIG_VELOCIKEY, 0);
59 eeprom_update_dword(EECONFIG_RGB_MATRIX, 0); 59 eeprom_update_dword(EECONFIG_RGB_MATRIX, 0);
60 eeprom_update_byte(EECONFIG_RGB_MATRIX_SPEED, 0); 60 eeprom_update_word(EECONFIG_RGB_MATRIX_EXTENDED, 0);
61 61
62 // TODO: Remove once ARM has a way to configure EECONFIG_HANDEDNESS 62 // TODO: Remove once ARM has a way to configure EECONFIG_HANDEDNESS
63 // within the emulated eeprom via dfu-util or another tool 63 // within the emulated eeprom via dfu-util or another tool
diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h
index 86b9e6f99..9e18fd4e1 100644
--- a/tmk_core/common/eeconfig.h
+++ b/tmk_core/common/eeconfig.h
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
21#include <stdbool.h> 21#include <stdbool.h>
22 22
23#ifndef EECONFIG_MAGIC_NUMBER 23#ifndef EECONFIG_MAGIC_NUMBER
24# define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEEB // When changing, decrement this value to avoid future re-init issues 24# define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEEA // When changing, decrement this value to avoid future re-init issues
25#endif 25#endif
26#define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF 26#define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF
27 27
@@ -43,12 +43,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
43#define EECONFIG_VELOCIKEY (uint8_t *)23 43#define EECONFIG_VELOCIKEY (uint8_t *)23
44 44
45#define EECONFIG_HAPTIC (uint32_t *)24 45#define EECONFIG_HAPTIC (uint32_t *)24
46
47// Mutually exclusive
48#define EECONFIG_LED_MATRIX (uint32_t *)28
46#define EECONFIG_RGB_MATRIX (uint32_t *)28 49#define EECONFIG_RGB_MATRIX (uint32_t *)28
47#define EECONFIG_RGB_MATRIX_SPEED (uint8_t *)32 50// Speed & Flags
51#define EECONFIG_LED_MATRIX_EXTENDED (uint16_t *)32
52#define EECONFIG_RGB_MATRIX_EXTENDED (uint16_t *)32
53
48// TODO: Combine these into a single word and single block of EEPROM 54// TODO: Combine these into a single word and single block of EEPROM
49#define EECONFIG_KEYMAP_UPPER_BYTE (uint8_t *)33 55#define EECONFIG_KEYMAP_UPPER_BYTE (uint8_t *)34
50// Size of EEPROM being used, other code can refer to this for available EEPROM 56// Size of EEPROM being used, other code can refer to this for available EEPROM
51#define EECONFIG_SIZE 34 57#define EECONFIG_SIZE 35
52/* debug bit */ 58/* debug bit */
53#define EECONFIG_DEBUG_ENABLE (1 << 0) 59#define EECONFIG_DEBUG_ENABLE (1 << 0)
54#define EECONFIG_DEBUG_MATRIX (1 << 1) 60#define EECONFIG_DEBUG_MATRIX (1 << 1)
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c
index ce3255c06..65d9e00c7 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -34,11 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
34#ifdef BACKLIGHT_ENABLE 34#ifdef BACKLIGHT_ENABLE
35# include "backlight.h" 35# include "backlight.h"
36#endif 36#endif
37#ifdef BOOTMAGIC_ENABLE
38# include "bootmagic.h"
39#else
40# include "magic.h"
41#endif
42#ifdef MOUSEKEY_ENABLE 37#ifdef MOUSEKEY_ENABLE
43# include "mousekey.h" 38# include "mousekey.h"
44#endif 39#endif
@@ -296,11 +291,6 @@ void keyboard_init(void) {
296#ifdef ADB_MOUSE_ENABLE 291#ifdef ADB_MOUSE_ENABLE
297 adb_mouse_init(); 292 adb_mouse_init();
298#endif 293#endif
299#ifdef BOOTMAGIC_ENABLE
300 bootmagic();
301#else
302 magic();
303#endif
304#ifdef BACKLIGHT_ENABLE 294#ifdef BACKLIGHT_ENABLE
305 backlight_init(); 295 backlight_init();
306#endif 296#endif
diff --git a/tmk_core/common/magic.c b/tmk_core/common/magic.c
deleted file mode 100644
index e14994164..000000000
--- a/tmk_core/common/magic.c
+++ /dev/null
@@ -1,39 +0,0 @@
1#include <stdint.h>
2#include <stdbool.h>
3#if defined(__AVR__)
4# include <util/delay.h>
5#endif
6#include "matrix.h"
7#include "bootloader.h"
8#include "debug.h"
9#include "keymap.h"
10#include "host.h"
11#include "action_layer.h"
12#include "eeconfig.h"
13#include "magic.h"
14
15keymap_config_t keymap_config;
16
17/** \brief Magic
18 *
19 * FIXME: Needs doc
20 */
21void magic(void) {
22 /* check signature */
23 if (!eeconfig_is_enabled()) {
24 eeconfig_init();
25 }
26
27 /* debug enable */
28 debug_config.raw = eeconfig_read_debug();
29
30 /* keymap config */
31 keymap_config.raw = eeconfig_read_keymap();
32
33 uint8_t default_layer = 0;
34 default_layer = eeconfig_read_default_layer();
35 default_layer_set((layer_state_t)default_layer);
36
37 /* Also initialize layer state to trigger callback functions for layer_state */
38 layer_state_set_kb((layer_state_t)layer_state);
39}
diff --git a/tmk_core/common/magic.h b/tmk_core/common/magic.h
deleted file mode 100644
index a6552c04d..000000000
--- a/tmk_core/common/magic.h
+++ /dev/null
@@ -1,3 +0,0 @@
1#pragma once
2
3void magic(void);
diff --git a/tmk_core/common/test/_wait.h b/tmk_core/common/test/_wait.h
new file mode 100644
index 000000000..4e22f593b
--- /dev/null
+++ b/tmk_core/common/test/_wait.h
@@ -0,0 +1,22 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include <inttypes.h>
19
20void wait_ms(uint32_t ms);
21#define wait_us(us) wait_ms(us / 1000)
22#define waitInputPinDelay()
diff --git a/tmk_core/common/usb_util.c b/tmk_core/common/usb_util.c
new file mode 100644
index 000000000..e4c50fcb1
--- /dev/null
+++ b/tmk_core/common/usb_util.c
@@ -0,0 +1,29 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "usb_util.h"
17#include "wait.h"
18
19__attribute__((weak)) void usb_disable(void) {}
20__attribute__((weak)) bool usb_connected_state(void) { return true; }
21__attribute__((weak)) bool usb_vbus_state(void) {
22#ifdef USB_VBUS_PIN
23 setPinInput(USB_VBUS_PIN);
24 wait_us(5);
25 return readPin(USB_VBUS_PIN);
26#else
27 return true;
28#endif
29}
diff --git a/tmk_core/common/usb_util.h b/tmk_core/common/usb_util.h
new file mode 100644
index 000000000..4ebedb1e7
--- /dev/null
+++ b/tmk_core/common/usb_util.h
@@ -0,0 +1,22 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include <stdbool.h>
19
20void usb_disable(void);
21bool usb_connected_state(void);
22bool usb_vbus_state(void);
diff --git a/tmk_core/common/wait.h b/tmk_core/common/wait.h
index 28224fe3a..cf7180fb0 100644
--- a/tmk_core/common/wait.h
+++ b/tmk_core/common/wait.h
@@ -1,3 +1,18 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#pragma once 16#pragma once
2 17
3#include <inttypes.h> 18#include <inttypes.h>
@@ -6,114 +21,8 @@
6extern "C" { 21extern "C" {
7#endif 22#endif
8 23
9#if defined(__ARMEL__) || defined(__ARMEB__) 24#if __has_include_next("_wait.h")
10# ifndef __OPTIMIZE__ 25# include_next "_wait.h" /* Include the platforms _wait.h */
11# pragma message "Compiler optimizations disabled; wait_cpuclock() won't work as designed"
12# endif
13
14# define wait_cpuclock(x) wait_cpuclock_allnop(x)
15
16# define CLOCK_DELAY_NOP8 "nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t"
17
18__attribute__((always_inline)) static inline void wait_cpuclock_allnop(unsigned int n) { /* n: 1..135 */
19 /* The argument n must be a constant expression.
20 * That way, compiler optimization will remove unnecessary code. */
21 if (n < 1) {
22 return;
23 }
24 if (n > 8) {
25 unsigned int n8 = n / 8;
26 n = n - n8 * 8;
27 switch (n8) {
28 case 16:
29 asm volatile(CLOCK_DELAY_NOP8::: "memory");
30 case 15:
31 asm volatile(CLOCK_DELAY_NOP8::: "memory");
32 case 14:
33 asm volatile(CLOCK_DELAY_NOP8::: "memory");
34 case 13:
35 asm volatile(CLOCK_DELAY_NOP8::: "memory");
36 case 12:
37 asm volatile(CLOCK_DELAY_NOP8::: "memory");
38 case 11:
39 asm volatile(CLOCK_DELAY_NOP8::: "memory");
40 case 10:
41 asm volatile(CLOCK_DELAY_NOP8::: "memory");
42 case 9:
43 asm volatile(CLOCK_DELAY_NOP8::: "memory");
44 case 8:
45 asm volatile(CLOCK_DELAY_NOP8::: "memory");
46 case 7:
47 asm volatile(CLOCK_DELAY_NOP8::: "memory");
48 case 6:
49 asm volatile(CLOCK_DELAY_NOP8::: "memory");
50 case 5:
51 asm volatile(CLOCK_DELAY_NOP8::: "memory");
52 case 4:
53 asm volatile(CLOCK_DELAY_NOP8::: "memory");
54 case 3:
55 asm volatile(CLOCK_DELAY_NOP8::: "memory");
56 case 2:
57 asm volatile(CLOCK_DELAY_NOP8::: "memory");
58 case 1:
59 asm volatile(CLOCK_DELAY_NOP8::: "memory");
60 case 0:
61 break;
62 }
63 }
64 switch (n) {
65 case 8:
66 asm volatile("nop" ::: "memory");
67 case 7:
68 asm volatile("nop" ::: "memory");
69 case 6:
70 asm volatile("nop" ::: "memory");
71 case 5:
72 asm volatile("nop" ::: "memory");
73 case 4:
74 asm volatile("nop" ::: "memory");
75 case 3:
76 asm volatile("nop" ::: "memory");
77 case 2:
78 asm volatile("nop" ::: "memory");
79 case 1:
80 asm volatile("nop" ::: "memory");
81 case 0:
82 break;
83 }
84}
85#endif
86
87#if defined(__AVR__)
88# include <util/delay.h>
89# define wait_ms(ms) _delay_ms(ms)
90# define wait_us(us) _delay_us(us)
91# define wait_cpuclock(x) __builtin_avr_delay_cycles(x)
92#elif defined PROTOCOL_CHIBIOS
93# include <ch.h>
94# define wait_ms(ms) \
95 do { \
96 if (ms != 0) { \
97 chThdSleepMilliseconds(ms); \
98 } else { \
99 chThdSleepMicroseconds(1); \
100 } \
101 } while (0)
102# define wait_us(us) \
103 do { \
104 if (us != 0) { \
105 chThdSleepMicroseconds(us); \
106 } else { \
107 chThdSleepMicroseconds(1); \
108 } \
109 } while (0)
110#elif defined PROTOCOL_ARM_ATSAM
111# include "clks.h"
112# define wait_ms(ms) CLK_delay_ms(ms)
113# define wait_us(us) CLK_delay_us(us)
114#else // Unit tests
115void wait_ms(uint32_t ms);
116# define wait_us(us) wait_ms(us / 1000)
117#endif 26#endif
118 27
119#ifdef __cplusplus 28#ifdef __cplusplus
diff --git a/tmk_core/protocol.mk b/tmk_core/protocol.mk
index 0c41642b9..cc87e8347 100644
--- a/tmk_core/protocol.mk
+++ b/tmk_core/protocol.mk
@@ -54,5 +54,9 @@ ifeq ($(strip $(XT_ENABLE)), yes)
54 OPT_DEFS += -DXT_ENABLE 54 OPT_DEFS += -DXT_ENABLE
55endif 55endif
56 56
57ifeq ($(strip $(USB_HID_ENABLE)), yes)
58 include $(TMK_DIR)/protocol/usb_hid.mk
59endif
60
57# Search Path 61# Search Path
58VPATH += $(TMK_DIR)/protocol 62VPATH += $(TMK_DIR)/protocol
diff --git a/tmk_core/protocol/chibios.mk b/tmk_core/protocol/chibios.mk
index 80554abb3..d01697835 100644
--- a/tmk_core/protocol/chibios.mk
+++ b/tmk_core/protocol/chibios.mk
@@ -6,6 +6,7 @@ SRC += $(CHIBIOS_DIR)/usb_main.c
6SRC += $(CHIBIOS_DIR)/main.c 6SRC += $(CHIBIOS_DIR)/main.c
7SRC += usb_descriptor.c 7SRC += usb_descriptor.c
8SRC += $(CHIBIOS_DIR)/usb_driver.c 8SRC += $(CHIBIOS_DIR)/usb_driver.c
9SRC += $(CHIBIOS_DIR)/usb_util.c
9SRC += $(LIBSRC) 10SRC += $(LIBSRC)
10 11
11VPATH += $(TMK_PATH)/$(PROTOCOL_DIR) 12VPATH += $(TMK_PATH)/$(PROTOCOL_DIR)
diff --git a/tmk_core/protocol/chibios/usb_util.c b/tmk_core/protocol/chibios/usb_util.c
new file mode 100644
index 000000000..5945e8a8d
--- /dev/null
+++ b/tmk_core/protocol/chibios/usb_util.c
@@ -0,0 +1,21 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include <hal.h>
17#include "usb_util.h"
18
19void usb_disable(void) { usbStop(&USBD1); }
20
21bool usb_connected_state(void) { return usbGetDriverStateI(&USBD1) == USB_ACTIVE; }
diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk
index 1cc1fa04e..9d9fb728b 100644
--- a/tmk_core/protocol/lufa.mk
+++ b/tmk_core/protocol/lufa.mk
@@ -44,6 +44,7 @@ ifeq ($(strip $(VIRTSER_ENABLE)), yes)
44endif 44endif
45 45
46SRC += $(LUFA_SRC) 46SRC += $(LUFA_SRC)
47SRC += $(LUFA_DIR)/usb_util.c
47 48
48# Search Path 49# Search Path
49VPATH += $(TMK_PATH)/$(LUFA_DIR) 50VPATH += $(TMK_PATH)/$(LUFA_DIR)
diff --git a/tmk_core/protocol/lufa/usb_util.c b/tmk_core/protocol/lufa/usb_util.c
new file mode 100644
index 000000000..9e943a21b
--- /dev/null
+++ b/tmk_core/protocol/lufa/usb_util.c
@@ -0,0 +1,34 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include <LUFA/Drivers/USB/USB.h>
17#include "usb_util.h"
18#include "wait.h"
19
20void usb_disable(void) {
21 USB_Disable();
22 USB_DeviceState = DEVICE_STATE_Unattached;
23}
24
25bool usb_connected_state(void) { return USB_Device_IsAddressSet(); }
26
27#if defined(OTGPADE)
28bool usb_vbus_state(void) {
29 USB_OTGPAD_On(); // enables VBUS pad
30 wait_us(5);
31
32 return USB_VBUS_GetStatus(); // checks state of VBUS
33}
34#endif
diff --git a/tmk_core/protocol/vusb.mk b/tmk_core/protocol/vusb.mk
index 1de600308..e4d013b38 100644
--- a/tmk_core/protocol/vusb.mk
+++ b/tmk_core/protocol/vusb.mk
@@ -5,6 +5,7 @@ VUSB_PATH = $(LIB_PATH)/vusb
5 5
6SRC += $(VUSB_DIR)/main.c \ 6SRC += $(VUSB_DIR)/main.c \
7 $(VUSB_DIR)/vusb.c \ 7 $(VUSB_DIR)/vusb.c \
8 $(VUSB_DIR)/usb_util.c \
8 $(VUSB_PATH)/usbdrv/usbdrv.c \ 9 $(VUSB_PATH)/usbdrv/usbdrv.c \
9 $(VUSB_PATH)/usbdrv/usbdrvasm.S \ 10 $(VUSB_PATH)/usbdrv/usbdrvasm.S \
10 $(VUSB_PATH)/usbdrv/oddebug.c 11 $(VUSB_PATH)/usbdrv/oddebug.c
diff --git a/tmk_core/protocol/vusb/usb_util.c b/tmk_core/protocol/vusb/usb_util.c
new file mode 100644
index 000000000..602854dbe
--- /dev/null
+++ b/tmk_core/protocol/vusb/usb_util.c
@@ -0,0 +1,24 @@
1/* Copyright 2021 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include <usbdrv/usbdrv.h>
17#include "usb_util.h"
18
19void usb_disable(void) { usbDeviceDisconnect(); }
20
21bool usb_connected_state(void) {
22 usbPoll();
23 return usbConfiguration;
24}