diff options
146 files changed, 1299 insertions, 1096 deletions
diff --git a/builddefs/build_keyboard.mk b/builddefs/build_keyboard.mk index dc86b232df..2b9ec48e70 100644 --- a/builddefs/build_keyboard.mk +++ b/builddefs/build_keyboard.mk @@ -390,10 +390,12 @@ ifneq ("$(KEYMAP_H)","") CONFIG_H += $(KEYMAP_H) endif +OPT_DEFS += -DKEYMAP_C=\"$(KEYMAP_C)\" + # project specific files SRC += \ $(KEYBOARD_SRC) \ - $(KEYMAP_C) \ + $(QUANTUM_DIR)/keymap_introspection.c \ $(QUANTUM_SRC) \ $(QUANTUM_DIR)/main.c \ @@ -469,6 +471,19 @@ check-size: build check-md5: build objs-size: build +ifeq ($(strip $(TOP_SYMBOLS)),yes) +all: top-symbols +check-size: top-symbols +top-symbols: build + echo "###########################################" + echo "# Highest flash usage:" + $(NM) -Crtd --size-sort $(BUILD_DIR)/$(TARGET).elf | grep -i ' [t] ' | head -n10 | sed -e 's#^0000000# #g' -e 's#^000000# #g' -e 's#^00000# #g' -e 's#^0000# #g' -e 's#^000# #g' -e 's#^00# #g' -e 's#^0# #g' + echo "###########################################" + echo "# Highest RAM usage:" + $(NM) -Crtd --size-sort $(BUILD_DIR)/$(TARGET).elf | grep -i ' [dbv] ' | head -n10 | sed -e 's#^0000000# #g' -e 's#^000000# #g' -e 's#^00000# #g' -e 's#^0000# #g' -e 's#^000# #g' -e 's#^00# #g' -e 's#^0# #g' + echo "###########################################" +endif + include $(BUILDDEFS_PATH)/show_options.mk include $(BUILDDEFS_PATH)/common_rules.mk diff --git a/builddefs/build_test.mk b/builddefs/build_test.mk index 5ad33b19c5..834184f221 100644 --- a/builddefs/build_test.mk +++ b/builddefs/build_test.mk @@ -42,7 +42,7 @@ VPATH += \ all: elf -VPATH += $(COMMON_VPATH) +VPATH += $(TEST_PATH) $(COMMON_VPATH) PLATFORM:=TEST PLATFORM_KEY:=test BOOTLOADER_TYPE:=none diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index c976b8296d..ff0c6b0cc6 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -160,27 +160,26 @@ ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),) $(call CATASTROPHIC_ERROR,Invalid EEPROM_DRIVER,EEPROM_DRIVER="$(EEPROM_DRIVER)" is not a valid EEPROM driver) else OPT_DEFS += -DEEPROM_ENABLE + COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/eeprom + COMMON_VPATH += $(DRIVER_PATH)/eeprom + COMMON_VPATH += $(PLATFORM_COMMON_DIR) ifeq ($(strip $(EEPROM_DRIVER)), custom) # Custom EEPROM implementation -- only needs to implement init/erase/read_block/write_block OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_CUSTOM - COMMON_VPATH += $(DRIVER_PATH)/eeprom SRC += eeprom_driver.c else ifeq ($(strip $(EEPROM_DRIVER)), i2c) # External I2C EEPROM implementation OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_I2C - COMMON_VPATH += $(DRIVER_PATH)/eeprom QUANTUM_LIB_SRC += i2c_master.c SRC += eeprom_driver.c eeprom_i2c.c else ifeq ($(strip $(EEPROM_DRIVER)), spi) # External SPI EEPROM implementation OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_SPI - COMMON_VPATH += $(DRIVER_PATH)/eeprom QUANTUM_LIB_SRC += spi_master.c SRC += eeprom_driver.c eeprom_spi.c else ifeq ($(strip $(EEPROM_DRIVER)), transient) # Transient EEPROM implementation -- no data storage but provides runtime area for it OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT - COMMON_VPATH += $(DRIVER_PATH)/eeprom SRC += eeprom_driver.c eeprom_transient.c else ifeq ($(strip $(EEPROM_DRIVER)), vendor) # Vendor-implemented EEPROM @@ -191,17 +190,13 @@ else ifneq ($(filter STM32F3xx_% STM32F1xx_% %_STM32F401xC %_STM32F401xE %_STM32F405xG %_STM32F411xE %_STM32F072xB %_STM32F042x6 %_GD32VF103xB %_GD32VF103x8, $(MCU_SERIES)_$(MCU_LDSCRIPT)),) # Emulated EEPROM OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_FLASH_EMULATED - COMMON_VPATH += $(DRIVER_PATH)/eeprom - SRC += eeprom_driver.c - SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c - SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c + COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/flash + COMMON_VPATH += $(DRIVER_PATH)/flash + SRC += eeprom_driver.c eeprom_stm32.c flash_stm32.c else ifneq ($(filter $(MCU_SERIES),STM32L0xx STM32L1xx),) # True EEPROM on STM32L0xx, L1xx OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_L0_L1 - COMMON_VPATH += $(DRIVER_PATH)/eeprom - COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/eeprom - SRC += eeprom_driver.c - SRC += eeprom_stm32_L0_L1.c + SRC += eeprom_driver.c eeprom_stm32_L0_L1.c else ifneq ($(filter $(MCU_SERIES),KL2x K20x),) # Teensy EEPROM implementations OPT_DEFS += -DEEPROM_TEENSY @@ -209,17 +204,16 @@ else else # Fall back to transient, i.e. non-persistent OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT - COMMON_VPATH += $(DRIVER_PATH)/eeprom SRC += eeprom_driver.c eeprom_transient.c endif else ifeq ($(PLATFORM),ARM_ATSAM) # arm_atsam EEPROM OPT_DEFS += -DEEPROM_SAMD - SRC += $(PLATFORM_COMMON_DIR)/eeprom_samd.c + SRC += eeprom_samd.c else ifeq ($(PLATFORM),TEST) # Test harness "EEPROM" OPT_DEFS += -DEEPROM_TEST_HARNESS - SRC += $(PLATFORM_COMMON_DIR)/eeprom.c + SRC += eeprom.c endif endif endif @@ -542,12 +536,6 @@ ifeq ($(strip $(LED_TABLES)), yes) SRC += $(QUANTUM_DIR)/led_tables.c endif -ifeq ($(strip $(TERMINAL_ENABLE)), yes) - SRC += $(QUANTUM_DIR)/process_keycode/process_terminal.c - OPT_DEFS += -DTERMINAL_ENABLE - OPT_DEFS += -DUSER_PRINT -endif - ifeq ($(strip $(VIA_ENABLE)), yes) DYNAMIC_KEYMAP_ENABLE := yes RAW_ENABLE := yes diff --git a/builddefs/common_rules.mk b/builddefs/common_rules.mk index d3acddc87b..6573257c78 100644 --- a/builddefs/common_rules.mk +++ b/builddefs/common_rules.mk @@ -1,19 +1,5 @@ # Hey Emacs, this is a -*- makefile -*- #---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jg Wunsch, et al. -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# # Enable vpath seraching for source files only # Without this, output files, could be read from the wrong .build directories @@ -38,36 +24,15 @@ NO_LTO_OBJ := $(filter %.a,$(OBJ)) MASTER_OUTPUT := $(firstword $(OUTPUTS)) - - # Output format. (can be srec, ihex, binary) FORMAT = ihex # Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) OPT ?= s -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=gnu99 - - -# Place -D or -U options here for C sources -#CDEFS += - - -# Place -D or -U options here for ASM sources -#ADEFS += - - -# Place -D or -U options here for C++ sources -#CXXDEFS += -D__STDC_LIMIT_MACROS -#CXXDEFS += -D__STDC_CONSTANT_MACROS -#CXXDEFS += +# Compiler flag to set the C and C++ language standard level +CSTANDARD = -std=gnu11 +CXXSTANDARD = -std=gnu++14 # Speed up recompilations by opt-in usage of ccache USE_CCACHE ?= no @@ -75,12 +40,8 @@ ifneq ($(USE_CCACHE),no) CC_PREFIX ?= ccache endif -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. +#---------------- C Compiler Options ---------------- + ifeq ($(strip $(LTO_ENABLE)), yes) ifeq ($(PLATFORM),ARM_ATSAM) $(info Enabling LTO on arm_atsam-targeting boards is known to have a high likelihood of failure.) @@ -111,23 +72,14 @@ CFLAGS += -Wstrict-prototypes ifneq ($(strip $(ALLOW_WARNINGS)), yes) CFLAGS += -Werror endif -#CFLAGS += -mshort-calls -#CFLAGS += -fno-unit-at-a-time -#CFLAGS += -Wundef -#CFLAGS += -Wunreachable-code -#CFLAGS += -Wsign-compare CFLAGS += $(CSTANDARD) # This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION # Fixing of multiple variable definitions must be made. CFLAGS += -fcommon -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. +#---------------- C++ Compiler Options ---------------- + ifeq ($(strip $(DEBUG_ENABLE)),yes) CXXFLAGS += -g$(DEBUG) endif @@ -141,57 +93,17 @@ CXXFLAGS += -Wundef ifneq ($(strip $(ALLOW_WARNINGS)), yes) CXXFLAGS += -Werror endif -#CXXFLAGS += -mshort-calls -#CXXFLAGS += -fno-unit-at-a-time -#CXXFLAGS += -Wstrict-prototypes -#CXXFLAGS += -Wunreachable-code -#CXXFLAGS += -Wsign-compare -#CXXFLAGS += $(CSTANDARD) #---------------- Assembler Options ---------------- + ASFLAGS += $(ADEFS) ifeq ($(VERBOSE_AS_CMD),yes) ASFLAGS += -v endif -#---------------- Library Options ---------------- -# Minimalistic printf version -PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min - -# Floating point printf version (requires MATH_LIB = -lm below) -PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt - -# If this is left blank, then it will use the Standard printf version. -PRINTF_LIB = -#PRINTF_LIB = $(PRINTF_LIB_MIN) -#PRINTF_LIB = $(PRINTF_LIB_FLOAT) - - -# Minimalistic scanf version -SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min - -# Floating point + %[ scanf version (requires MATH_LIB = -lm below) -SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt - -# If this is left blank, then it will use the Standard scanf version. -SCANF_LIB = -#SCANF_LIB = $(SCANF_LIB_MIN) -#SCANF_LIB = $(SCANF_LIB_FLOAT) - - -MATH_LIB = -lm -CREATE_MAP ?= yes - - #---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -# -# Comennt out "--relax" option to avoid a error such: -# (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12' -# +CREATE_MAP ?= yes ifeq ($(CREATE_MAP),yes) LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref endif @@ -201,20 +113,11 @@ endif #LDFLAGS += -Wl,--relax LDFLAGS += $(EXTMEMOPTS) LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) -LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) -#LDFLAGS += -T linker_script.x +LDFLAGS += -lm # You can give EXTRALDFLAGS at 'make' command line. LDFLAGS += $(EXTRALDFLAGS) #---------------- Assembler Listings ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. ADHLNS_ENABLE ?= no ifeq ($(ADHLNS_ENABLE),yes) diff --git a/builddefs/show_options.mk b/builddefs/show_options.mk index f67d009191..1c1c189f27 100644 --- a/builddefs/show_options.mk +++ b/builddefs/show_options.mk @@ -5,7 +5,6 @@ BUILD_OPTION_NAMES = \ CONSOLE_ENABLE \ COMMAND_ENABLE \ NKRO_ENABLE \ - TERMINAL_ENABLE \ CUSTOM_MATRIX \ DEBOUNCE_TYPE \ SPLIT_KEYBOARD \ diff --git a/data/mappings/info_config.json b/data/mappings/info_config.json index 5f0d903bd7..fcceb98025 100644 --- a/data/mappings/info_config.json +++ b/data/mappings/info_config.json @@ -12,6 +12,7 @@ "AUDIO_VOICES": {"info_key": "audio.voices", "value_type": "bool"}, "BACKLIGHT_BREATHING": {"info_key": "backlight.breathing", "value_type": "bool"}, "BREATHING_PERIOD": {"info_key": "backlight.breathing_period", "value_type": "int"}, + "BACKLIGHT_ON_STATE": {"info_key": "backlight.on_state", "value_type": "int"}, "BACKLIGHT_PIN": {"info_key": "backlight.pin"}, "BOTH_SHIFTS_TURNS_ON_CAPS_WORD": {"info_key": "caps_word.both_shifts_turns_on", "value_type": "bool"}, "CAPS_WORD_IDLE_TIMEOUT": {"info_key": "caps_word.idle_timeout", "value_type": "int"}, @@ -35,6 +36,9 @@ "LED_CAPS_LOCK_PIN": {"info_key": "indicators.caps_lock"}, "LED_NUM_LOCK_PIN": {"info_key": "indicators.num_lock"}, "LED_SCROLL_LOCK_PIN": {"info_key": "indicators.scroll_lock"}, + "LED_COMPOSE_PIN": {"info_key": "indicators.compose"}, + "LED_KANA_PIN": {"info_key": "indicators.kana"}, + "LED_PIN_ON_STATE": {"info_key": "indicators.on_state", "value_type": "int"}, "MANUFACTURER": {"info_key": "manufacturer"}, "MATRIX_HAS_GHOST": {"info_key": "matrix_pins.ghost", "value_type": "bool"}, "MATRIX_IO_DELAY": {"info_key": "matrix_pins.io_delay", "value_type": "int"}, diff --git a/data/schemas/definitions.jsonschema b/data/schemas/definitions.jsonschema index 1bdfbbeb03..5a2e5ccc05 100644 --- a/data/schemas/definitions.jsonschema +++ b/data/schemas/definitions.jsonschema @@ -150,5 +150,11 @@ "min": 0, "max": 255, "multipleOf": 1 + }, + "bit": { + "type": "number", + "min": 0, + "max": 1, + "multipleOf": 1 } } diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index fd60920578..9f6721ba9d 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -45,7 +45,8 @@ "max": 31, "multipleOf": 1 }, - "pin": {"$ref": "qmk.definitions.v1#/mcu_pin"} + "pin": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "on_state": {"$ref": "qmk.definitions.v1#/bit"} } }, "bluetooth": { @@ -119,7 +120,10 @@ "properties": { "caps_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"}, "num_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"}, - "scroll_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"} + "scroll_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "compose": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "kana": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "on_state": {"$ref": "qmk.definitions.v1#/bit"} } }, "layout_aliases": { diff --git a/docs/_summary.md b/docs/_summary.md index 11f5e1dd51..78d7f30ea4 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -88,7 +88,6 @@ * [Swap Hands](feature_swap_hands.md) * [Tap Dance](feature_tap_dance.md) * [Tap-Hold Configuration](tap_hold.md) - * [Terminal](feature_terminal.md) * [Unicode](feature_unicode.md) * [Userspace](feature_userspace.md) * [WPM Calculation](feature_wpm.md) diff --git a/docs/config_options.md b/docs/config_options.md index 8227a0e074..9aa360576a 100644 --- a/docs/config_options.md +++ b/docs/config_options.md @@ -174,6 +174,8 @@ If you define these options you will enable the associated feature, which may in * sets the timer for leader key chords to run on each key press rather than overall * `#define LEADER_KEY_STRICT_KEY_PROCESSING` * Disables keycode filtering for Mod-Tap and Layer-Tap keycodes. Eg, if you enable this, you would need to specify `MT(MOD_CTL, KC_A)` if you want to use `KC_A`. +* `#define MOUSE_EXTENDED_REPORT` + * Enables support for extended reports (-32767 to 32767, instead of -127 to 127), which may allow for smoother reporting, and prevent maxing out of the reports. Applies to both Pointing Device and Mousekeys. * `#define ONESHOT_TIMEOUT 300` * how long before oneshot times out * `#define ONESHOT_TAP_TOGGLE 2` diff --git a/docs/eeprom_driver.md b/docs/eeprom_driver.md index 6dcf10c04d..306ebacb3f 100644 --- a/docs/eeprom_driver.md +++ b/docs/eeprom_driver.md @@ -43,8 +43,9 @@ Module | Equivalent `#define` | Source -----------------|---------------------------------|------------------------------------------ CAT24C512 EEPROM | `#define EEPROM_I2C_CAT24C512` | <https://www.sparkfun.com/products/14764> RM24C512C EEPROM | `#define EEPROM_I2C_RM24C512C` | <https://www.sparkfun.com/products/14764> -24LC64 EEPROM | `#define EEPROM_I2C_24LC64` | <https://www.microchip.com/wwwproducts/en/24LC64> -24LC128 EEPROM | `#define EEPROM_I2C_24LC128` | <https://www.microchip.com/wwwproducts/en/24LC128> +24LC32A EEPROM | `#define EEPROM_I2C_24LC32A` | <https://www.microchip.com/en-us/product/24LC32A> +24LC64 EEPROM | `#define EEPROM_I2C_24LC64` | <https://www.microchip.com/en-us/product/24LC64> +24LC128 EEPROM | `#define EEPROM_I2C_24LC128` | <https://www.microchip.com/en-us/product/24LC128> 24LC256 EEPROM | `#define EEPROM_I2C_24LC256` | <https://www.sparkfun.com/products/525> MB85RC256V FRAM | `#define EEPROM_I2C_MB85RC256V` | <https://www.adafruit.com/product/1895> diff --git a/docs/feature_pointing_device.md b/docs/feature_pointing_device.md index 02c1e64a31..250e2843f6 100644 --- a/docs/feature_pointing_device.md +++ b/docs/feature_pointing_device.md @@ -259,6 +259,7 @@ The following configuration options are only available when using `SPLIT_POINTIN |`POINTING_DEVICE_ROTATION_270_RIGHT` | (Optional) Rotates the X and Y data by 270 degrees. | _not defined_ | |`POINTING_DEVICE_INVERT_X_RIGHT` | (Optional) Inverts the X axis report. | _not defined_ | |`POINTING_DEVICE_INVERT_Y_RIGHT` | (Optional) Inverts the Y axis report. | _not defined_ | +|`MOUSE_EXTENDED_REPORT` | (Optional) Enables support for extended mouse reports. (-32767 to 32767, instead of just -127 to 127) | !> If there is a `_RIGHT` configuration option or callback, the [common configuration](feature_pointing_device.md?id=common-configuration) option will work for the left. For correct left/right detection you should setup a [handedness option](feature_split_keyboard?id=setting-handedness), `EE_HANDS` is usually a good option for an existing board that doesn't do handedness by hardware. diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 295e610fc4..ec67e32078 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -409,6 +409,7 @@ You can use up to 2 AW20216 IC's. Do not specify `DRIVER_<N>_xxx` defines for IC | `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | | | `AW_SCALING_MAX` | (Optional) LED current scaling value (0-255, higher values mean LED is brighter at full PWM) | 150 | | `AW_GLOBAL_CURRENT_MAX` | (Optional) Driver global current limit (0-255, higher values means the driver may consume more power) | 150 | +| `AW_SPI_MODE` | (Optional) Mode for SPI communication (0-3, defines polarity and phase of the clock) | 3 | | `AW_SPI_DIVISOR` | (Optional) Clock divisor for SPI communication (powers of 2, smaller numbers means faster communication, should not be less than 4) | 4 | Here is an example using 2 drivers. diff --git a/docs/feature_split_keyboard.md b/docs/feature_split_keyboard.md index 6ef70bf788..4fac083974 100644 --- a/docs/feature_split_keyboard.md +++ b/docs/feature_split_keyboard.md @@ -141,6 +141,9 @@ Next, you will have to flash the EEPROM files once for the correct hand to the c * ARM controllers with a DFU compatible bootloader (e.g. Proton-C): * `:dfu-util-split-left` * `:dfu-util-split-right` +* ARM controllers with a UF2 compatible bootloader: + * `:uf2-split-left` + * `:uf2-split-right` Example: diff --git a/docs/feature_tap_dance.md b/docs/feature_tap_dance.md index c055a9989a..05134ec229 100644 --- a/docs/feature_tap_dance.md +++ b/docs/feature_tap_dance.md @@ -14,55 +14,48 @@ Optionally, you might want to set a custom `TAPPING_TERM` time by adding somethi ```c #define TAPPING_TERM 175 +#define TAPPING_TERM_PER_KEY ``` -The `TAPPING_TERM` time is the maximum time allowed between taps of your Tap Dance key, and is measured in milliseconds. For example, if you used the above `#define` statement and set up a Tap Dance key that sends `Space` on single-tap and `Enter` on double-tap, then this key will send `ENT` only if you tap this key twice in less than 175ms. If you tap the key, wait more than 175ms, and tap the key again you'll end up sending `SPC SPC` instead. +The `TAPPING_TERM` time is the maximum time allowed between taps of your Tap Dance key, and is measured in milliseconds. For example, if you used the above `#define` statement and set up a Tap Dance key that sends `Space` on single-tap and `Enter` on double-tap, then this key will send `ENT` only if you tap this key twice in less than 175ms. If you tap the key, wait more than 175ms, and tap the key again you'll end up sending `SPC SPC` instead. The `TAPPING_TERM_PER_KEY` definition is only needed if you control the tapping term through a [custom `get_tapping_term` function](tap_hold.md#tapping_term), which may be needed because `TAPPING_TERM` affects not just tap-dance keys. -Next, you will want to define some tap-dance keys, which is easiest to do with the `TD()` macro, that takes a number which will later be used as an index into the `tap_dance_actions` array. +Next, you will want to define some tap-dance keys, which is easiest to do with the `TD()` macro. That macro takes a number which will later be used as an index into the `tap_dance_actions` array and turns it into a tap-dance keycode. After this, you'll want to use the `tap_dance_actions` array to specify what actions shall be taken when a tap-dance key is in action. Currently, there are five possible options: * `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: Sends the `kc1` keycode when tapped once, `kc2` otherwise. When the key is held, the appropriate keycode is registered: `kc1` when pressed and held, `kc2` when tapped once, then pressed and held. * `ACTION_TAP_DANCE_LAYER_MOVE(kc, layer)`: Sends the `kc` keycode when tapped once, or moves to `layer`. (this functions like the `TO` layer keycode). - * This is the same as `ACTION_TAP_DANCE_DUAL_ROLE`, but renamed to something that is clearer about its functionality. Both names will work. * `ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer)`: Sends the `kc` keycode when tapped once, or toggles the state of `layer`. (this functions like the `TG` layer keycode). * `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action. * `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function when the dance action finishes (like the previous option), and the last function when the tap dance action resets. -* ~~`ACTION_TAP_DANCE_FN_ADVANCED_TIME(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn, tap_specific_tapping_term)`~~: This functions identically to the `ACTION_TAP_DANCE_FN_ADVANCED` function, but uses a custom tapping term for it, instead of the predefined `TAPPING_TERM`. - * This is deprecated in favor of the Per Key Tapping Term functionality, as outlined [here](tap_hold.md#tapping-term). You'd want to check for the specific `TD()` macro that you want to use (such as `TD(TD_ESC_CAPS)`) instead of using this specific Tap Dance function. The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE_DOUBLE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise. !> Keep in mind that only [basic keycodes](keycodes_basic.md) are supported here. Custom keycodes are not supported. -Similar to the first option, the second option is good for simple layer-switching cases. +Similar to the first option, the second and third option are good for simple layer-switching cases. -For more complicated cases, use the third or fourth options (examples of each are listed below). - -Finally, the fifth option is particularly useful if your non-Tap-Dance keys start behaving weirdly after adding the code for your Tap Dance keys. The likely problem is that you changed the `TAPPING_TERM` time to make your Tap Dance keys easier for you to use, and that this has changed the way your other keys handle interrupts. +For more complicated cases, like blink the LEDs, fiddle with the backlighting, and so on, use the fourth or fifth option. Examples of each are listed below. ## Implementation Details :id=implementation Well, that's the bulk of it! You should now be able to work through the examples below, and to develop your own Tap Dance functionality. But if you want a deeper understanding of what's going on behind the scenes, then read on for the explanation of how it all works! -The main entry point is `process_tap_dance()`, called from `process_record_quantum()`, which is run for every keypress, and our handler gets to run early. This function checks whether the key pressed is a tap-dance key. If it is not, and a tap-dance was in action, we handle that first, and enqueue the newly pressed key. If it is a tap-dance key, then we check if it is the same as the already active one (if there's one active, that is). If it is not, we fire off the old one first, then register the new one. If it was the same, we increment the counter and reset the timer. - -This means that you have `TAPPING_TERM` time to tap the key again; you do not have to input all the taps within a single `TAPPING_TERM` timeframe. This allows for longer tap counts, with minimal impact on responsiveness. +Let's go over the three functions mentioned in `ACTION_TAP_DANCE_FN_ADVANCED` in a little more detail. They all receive the same too arguments: a pointer to a structure that holds all dance related state information, and a pointer to a use case specific state variable. The three functions differ in when they are called. The first, `on_each_tap_fn()`, is called every time the tap dance key is *pressed*. Before it is called, the counter is incremented and the timer is reset. The second function, `on_dance_finished_fn()`, is called when the tap dance is interrupted or ends because `TAPPING_TERM` milliseconds have passed since the last tap. When the `finished` field of the dance state structure is set to `true`, the `on_dance_finished_fn()` is skipped. After `on_dance_finished_fn()` was called or would have been called, but no sooner than when the tap dance key is *released*, `on_dance_reset_fn()` is called. It is possible to end a tap dance immediately, skipping `on_dance_finished_fn()`, but not `on_dance_reset_fn`, by calling `reset_tap_dance(state)`. -Our next stop is `tap_dance_task()`. This handles the timeout of tap-dance keys. +To accomplish this logic, the tap dance mechanics use three entry points. The main entry point is `process_tap_dance()`, called from `process_record_quantum()` *after* `process_record_kb()` and `process_record_user()`. This function is responsible for calling `on_each_tap_fn()` and `on_dance_reset_fn()`. In order to handle interruptions of a tap dance, another entry point, `preprocess_tap_dance()` is run right at the beginning of `process_record_quantum()`. This function checks whether the key pressed is a tap-dance key. If it is not, and a tap-dance was in action, we handle that first, and enqueue the newly pressed key. If it is a tap-dance key, then we check if it is the same as the already active one (if there's one active, that is). If it is not, we fire off the old one first, then register the new one. Finally, `tap_dance_task()` periodically checks whether `TAPPING_TERM` has passed since the last key press and finishes a tap dance if that is the case. -For the sake of flexibility, tap-dance actions can be either a pair of keycodes, or a user function. The latter allows one to handle higher tap counts, or do extra things, like blink the LEDs, fiddle with the backlighting, and so on. This is accomplished by using an union, and some clever macros. +This means that you have `TAPPING_TERM` time to tap the key again; you do not have to input all the taps within a single `TAPPING_TERM` timeframe. This allows for longer tap counts, with minimal impact on responsiveness. ## Examples :id=examples -### Simple Example :id=simple-example +### Simple Example: Send `ESC` on Single Tap, `CAPS_LOCK` on Double Tap :id=simple-example Here's a simple example for a single definition: 1. In your `rules.mk`, add `TAP_DANCE_ENABLE = yes` -2. In your `config.h` (which you can copy from `qmk_firmware/keyboards/planck/config.h` to your keymap directory), add `#define TAPPING_TERM 200` -3. In your `keymap.c` file, define the variables and definitions, then add to your keymap: +2. In your `keymap.c` file, define the variables and definitions, then add to your keymap: ```c // Tap Dance declarations @@ -92,40 +85,15 @@ All the enums used in the examples are declared like this: ```c // Enums defined for all examples: enum { - CT_SE, - CT_CLN, + TD_ESC_CAPS, CT_EGG, CT_FLSH, - X_TAP_DANCE -}; -``` - -#### Example 1: Send `:` on Single Tap, `;` on Double Tap :id=example-1 - -```c -void dance_cln_finished(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - register_code16(KC_COLN); - } else { - register_code(KC_SCLN); - } -} - -void dance_cln_reset(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - unregister_code16(KC_COLN); - } else { - unregister_code(KC_SCLN); - } -} - -// All tap dance functions would go here. Only showing this one. -qk_tap_dance_action_t tap_dance_actions[] = { - [CT_CLN] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_cln_finished, dance_cln_reset), + CT_CLN, + X_CTL, }; ``` -#### Example 2: Send "Safety Dance!" After 100 Taps :id=example-2 +#### Example 1: Send "Safety Dance!" After 100 Taps :id=example-1 ```c void dance_egg(qk_tap_dance_state_t *state, void *user_data) { @@ -140,7 +108,7 @@ qk_tap_dance_action_t tap_dance_actions[] = { }; ``` -#### Example 3: Turn LED Lights On Then Off, One at a Time :id=example-3 +#### Example 2: Turn LED Lights On Then Off, One at a Time :id=example-2 ```c // On each tap, light up one LED, from right to left @@ -181,15 +149,74 @@ void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) { ergodox_right_led_3_off(); } -// All tap dances now put together. Example 3 is "CT_FLASH" +// All tap dances now put together. Example 2 is "CT_FLSH" qk_tap_dance_action_t tap_dance_actions[] = { - [CT_SE] = ACTION_TAP_DANCE_DOUBLE(KC_SPC, KC_ENT), - [CT_CLN] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_cln_finished, dance_cln_reset), + [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), [CT_EGG] = ACTION_TAP_DANCE_FN(dance_egg), [CT_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED(dance_flsh_each, dance_flsh_finished, dance_flsh_reset) }; ``` +#### Example 3: Send `:` on Tap, `;` on Hold :id=example-3 + +With a little effort, powerful tap-hold configurations can be implemented as tap dances. To emit taps as early as possible, we need to act on releases of the tap dance key. There is no callback for this in the tap dance framework, so we use `process_record_user()`. + +```c +typedef struct { + uint16_t tap; + uint16_t hold; + uint16_t held; +} tap_dance_tap_hold_t; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + qk_tap_dance_action_t *action; + + switch (keycode) { + case TD(CT_CLN): // list all tap dance keycodes with tap-hold configurations + action = &tap_dance_actions[TD_INDEX(keycode)]; + if (!record->event.pressed && action->state.count && !action->state.finished) { + tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)action->user_data; + tap_code16(tap_hold->tap); + } + } + return true; +} + +void tap_dance_tap_hold_finished(qk_tap_dance_state_t *state, void *user_data) { + tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data; + + if (state->pressed) { + if (state->count == 1 +#ifndef PERMISSIVE_HOLD + && !state->interrupted +#endif + ) { + register_code16(tap_hold->hold); + tap_hold->held = tap_hold->hold; + } else { + register_code16(tap_hold->tap); + tap_hold->held = tap_hold->tap; + } + } +} + +void tap_dance_tap_hold_reset(qk_tap_dance_state_t *state, void *user_data) { + tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data; + + if (tap_hold->held) { + unregister_code16(tap_hold->held); + tap_hold->held = 0; + } +} + +#define ACTION_TAP_DANCE_TAP_HOLD(tap, hold) \ + { .fn = {NULL, tap_dance_tap_hold_finished, tap_dance_tap_hold_reset}, .user_data = (void *)&((tap_dance_tap_hold_t){tap, hold, 0}), } + +qk_tap_dance_action_t tap_dance_actions[] = { + [CT_CLN] = ACTION_TAP_DANCE_TAP_HOLD(KC_COLN, KC_SCLN), +}; +``` + #### Example 4: 'Quad Function Tap-Dance' :id=example-4 By [DanielGGordon](https://github.com/danielggordon) @@ -329,7 +356,7 @@ And then simply use `TD(X_CTL)` anywhere in your keymap. If you want to implement this in your userspace, then you may want to check out how [DanielGGordon](https://github.com/qmk/qmk_firmware/tree/master/users/gordon) has implemented this in their userspace. -> In this configuration "hold" takes place **after** tap dance timeout (see `ACTION_TAP_DANCE_FN_ADVANCED_TIME`). To achieve instant hold, remove `state->interrupted` checks in conditions. As a result you may use comfortable longer tapping periods to have more time for taps and not to wait too long for holds (try starting with doubled `TAPPING_TERM`). +> In this configuration "hold" takes place **after** tap dance timeout. To achieve instant hold, remove `state->interrupted` checks in conditions. As a result you may use comfortable longer tapping periods to have more time for taps and not to wait too long for holds (try starting with doubled `TAPPING_TERM`). #### Example 5: Using tap dance for advanced mod-tap and layer-tap keys :id=example-5 @@ -511,8 +538,18 @@ void ql_reset(qk_tap_dance_state_t *state, void *user_data) { // Associate our tap dance key with its functionality qk_tap_dance_action_t tap_dance_actions[] = { - [QUOT_LAYR] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, ql_finished, ql_reset, 275) + [QUOT_LAYR] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset) }; + +// Set a long-ish tapping term for tap-dance keys +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: + return 275; + default: + return TAPPING_TERM; + } +} ``` The above code is similar to that used in previous examples. The one point to note is that we need to be able to check which layers are active at any time so we can toggle them if needed. To do this we use the `layer_state_is(layer)` function which returns `true` if the given `layer` is active. @@ -521,6 +558,6 @@ The use of `cur_dance()` and `ql_tap_state` mirrors the above examples. The `case: TD_SINGLE_TAP` in `ql_finished` is similar to the above examples. The `TD_SINGLE_HOLD` case works in conjunction with `ql_reset()` to switch to `_MY_LAYER` while the tap dance key is held, and to switch away from `_MY_LAYER` when the key is released. This mirrors the use of `MO(_MY_LAYER)`. The `TD_DOUBLE_TAP` case works by checking whether `_MY_LAYER` is the active layer, and toggling it on or off accordingly. This mirrors the use of `TG(_MY_LAYER)`. -`tap_dance_actions[]` works similar to the above examples. Note that I used `ACTION_TAP_DANCE_FN_ADVANCED_TIME()` instead of `ACTION_TAP_DANCE_FN_ADVANCED()`. This is because I like my `TAPPING_TERM` to be short (\~175ms) for my non-tap-dance keys but find that this is too quick for me to reliably complete tap dance actions - thus the increased time of 275ms here. +`tap_dance_actions[]` works similar to the above examples. Note that, additionally, I set a longer tapping term for the tap dance keys. This is because I like my `TAPPING_TERM` to be short (\~175ms) for my non-tap-dance keys but find that this is too quick for me to reliably complete tap dance actions - thus the increased time of 275ms here. In order for the per-key tapping terms to take effect, `TAPPING_TERM_PER_KEY` must be defined in your `config.h`. Finally, to get this tap dance key working, be sure to include `TD(QUOT_LAYR)` in your `keymaps[]`. diff --git a/docs/feature_terminal.md b/docs/feature_terminal.md deleted file mode 100644 index f850622165..0000000000 --- a/docs/feature_terminal.md +++ /dev/null @@ -1,107 +0,0 @@ -# Terminal - -> This feature is currently *huge*, and should probably only be put on boards with a lot of memory, or for fun. - -The terminal feature is a command-line-like interface designed to communicate through a text editor with keystrokes. It's beneficial to turn off auto-indent features in your editor. - -To enable, stick this in your `rules.mk` or `Makefile`: - - TERMINAL_ENABLE = yes - -And use the `TERM_ON` and `TERM_OFF` keycodes to turn it on or off. - -When enabled, a `> ` prompt will appear, where you'll be able to type, backspace (a bell will ding if you reach the beginning and audio is enabled), and hit enter to send the command. Arrow keys are currently disabled so it doesn't get confused. Moving your cursor around with the mouse is discouraged. - -`#define TERMINAL_HELP` enables some other output helpers that aren't really needed with this page. - -Pressing "up" and "down" will allow you to cycle through the past 5 commands entered. - -## Future Ideas - -* Keyboard/user-extensible commands -* Smaller footprint -* Arrow key support -* Command history - Done -* SD card support -* LCD support for buffer display -* Keycode -> name string LUT -* Layer status -* *Analog/digital port read/write* -* RGB mode stuff -* Macro definitions -* EEPROM read/write -* Audio control - -## Current Commands - -### `about` - -Prints out the current version of QMK with a build date: - -``` -> about -QMK Firmware - v0.5.115-7-g80ed73-dirty - Built: 2017-08-29-20:24:44 -``` - - -### `print-buffer` - -Outputs the last 5 commands entered - -``` -> print-buffer -0. print-buffer -1. help -2. about -3. keymap 0 -4. help -5. flush-buffer -``` - -### `flush-buffer` - -Clears command buffer -``` -> flush-buffer -Buffer cleared! -``` - - -### `help` - - -Prints out the available commands: - -``` -> help -commands available: - about help keycode keymap exit print-buffer flush-buffer -``` - -### `keycode <layer> <row> <col>` - -Prints out the keycode value of a certain layer, row, and column: - -``` -> keycode 0 1 0 -0x29 (41) -``` - -### `keymap <layer>` - -Prints out the entire keymap for a certain layer - -``` -> keymap 0 -0x002b, 0x0014, 0x001a, 0x0008, 0x0015, 0x0017, 0x001c, 0x0018, 0x000c, 0x0012, 0x0013, 0x002a, -0x0029, 0x0004, 0x0016, 0x0007, 0x0009, 0x000a, 0x000b, 0x000d, 0x000e, 0x000f, 0x0033, 0x0034, -0x00e1, 0x001d, 0x001b, 0x0006, 0x0019, 0x0005, 0x0011, 0x0010, 0x0036, 0x0037, 0x0038, 0x0028, -0x5cd6, 0x00e0, 0x00e2, 0x00e3, 0x5cd4, 0x002c, 0x002c, 0x5cd5, 0x0050, 0x0051, 0x0052, 0x004f, -> -``` - -### `exit` - -Exits the terminal - same as `TERM_OFF`. diff --git a/docs/flashing.md b/docs/flashing.md index 271e15b13c..dfb255f2dc 100644 --- a/docs/flashing.md +++ b/docs/flashing.md @@ -358,3 +358,7 @@ CLI Flashing sequence: 2. Wait for the OS to detect the device 3. Flash via QMK CLI eg. `qmk flash --keyboard handwired/onekey/blackpill_f411_tinyuf2 --keymap default` 4. Wait for the keyboard to become available + +### `make` Targets + +* `:uf2-split-left` and `:uf2-split-right`: Flashes the firmware but also sets the handedness setting in EEPROM by generating a side specific firmware. diff --git a/docs/ja/_summary.md b/docs/ja/_summary.md index 81b5756c27..8516a5eaaa 100644 --- a/docs/ja/_summary.md +++ b/docs/ja/_summary.md @@ -85,7 +85,6 @@ * [スワップハンド](ja/feature_swap_hands.md) * [タップダンス](ja/feature_tap_dance.md) * [タップホールド設定](ja/tap_hold.md) - * [ターミナル](ja/feature_terminal.md) * [ユニコード](ja/feature_unicode.md) * [ユーザスペース](ja/feature_userspace.md) * [WPM 計算](ja/feature_wpm.md) diff --git a/docs/ja/feature_tap_dance.md b/docs/ja/feature_tap_dance.md index a6d108f1e9..762816f21b 100644 --- a/docs/ja/feature_tap_dance.md +++ b/docs/ja/feature_tap_dance.md @@ -28,7 +28,6 @@ * `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: 1回タップすると `kc1` キーコードを送信し、2回タップすると `kc2` キーコードを送信します。キーを押し続けているときは、適切なキーコードが登録されます: キーを押し続けた場合は `kc1`、一度タップしてから続けてもう一度キーを押してそのまま押し続けたときは、 `kc2` が登録されます。 * `ACTION_TAP_DANCE_LAYER_MOVE(kc, layer)`: 1回タップすると `kc` キーコードが送信され、2回タップすると `layer` レイヤーに移動します(これは `TO` レイヤーキーコードのように機能します)。 - * この機能は `ACTION_TAP_DANCE_DUAL_ROLE` と同じですが、機能が明確になるように関数名を変更しました。どちらの関数名でも実行できます。 * `ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer)`: 1回タップすると `kc` キーコードが送信され、2回タップすると `layer` の状態をトグルします(これは `TG` レイヤーキーコードのように機能します)。 * `ACTION_TAP_DANCE_FN(fn)`: ユーザーキーマップに定義した指定の関数が呼び出されます。タップダンス実行の回数分タップすると、最後の時点で呼び出されます。 * `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: タップする度にユーザーキーマップに定義した最初の関数が呼び出されます。タップダンスの実行が終わった時点で2番目の関数が呼び出され、タップダンスの実行をリセットするときに最後の関数が呼び出されます。 diff --git a/docs/ja/feature_terminal.md b/docs/ja/feature_terminal.md deleted file mode 100644 index 8e125ecee0..0000000000 --- a/docs/ja/feature_terminal.md +++ /dev/null @@ -1,112 +0,0 @@ -# ターミナル - -<!--- - original document: 0.8.147:docs/feature_terminal.md - git diff 0.8.147 HEAD -- docs/feature_terminal.md | cat ---> - -> この機能は現在のところ*巨大*であり、おそらく大量のメモリを搭載したキーボード、または楽しみのためにのみ配置する必要があります。 - -ターミナル機能はテキストエディタを介してキーストロークで通信するように設計されたコマンドラインのようなインタフェースです。エディタで自動インデント機能をオフにすることは有益です。 - -有効にするには、以下を `rules.mk` または `Makefile` に貼り付けます: - - TERMINAL_ENABLE = yes - -そして、オンまたはオフにするために、`TERM_ON` および `TERM_OFF` キーコードを使います。 - -有効な場合、`> ` プロンプトが現れ、ここでコマンドやバックスペース(オーディオが有効な場合は、先頭に到達するとベルが鳴ります)を入力することができ、エンターを入力するとコマンドを送信します。矢印キーは現在のところ無効なため、混乱することはありません。マウスでカーソルを移動することはお勧めしません。 - -`#define TERMINAL_HELP` は、このページでは実際には必要のない他の出力ヘルパーを有効にします。 - -"上矢印" および "下矢印" により、過去に入力した5つのコマンドを順に切り替えることができます。 - -## 今後のアイデア - -* キーボード/ユーザ拡張可能なコマンド -* より小さなフットプリント -* 矢印キーのサポート -* コマンド履歴 - 完了 -* SD カードのサポート -* バッファディスプレイのための LCD サポート -* キーコード -> 名称の対応表 -* レイヤー状態 -* *アナログ/デジタル ポートの読み込み/書き込み* -* RGB モード関連機能 -* マクロ定義 -* EEPROM の読み込み/書き込み -* オーディオ制御 - -## 現在のコマンド - -### `about` - -現在の QMK のバージョンとビルドした日の出力: - -``` -> about -QMK Firmware - v0.5.115-7-g80ed73-dirty - Built: 2017-08-29-20:24:44 -``` - - -### `print-buffer` - -最後に入力した5つのコマンドの出力 - -``` -> print-buffer -0. print-buffer -1. help -2. about -3. keymap 0 -4. help -5. flush-buffer -``` - -### `flush-buffer` - -コマンドバッファをクリア -``` -> flush-buffer -Buffer cleared! -``` - - -### `help` - - -利用可能なコマンドの出力: - -``` -> help -commands available: - about help keycode keymap exit print-buffer flush-buffer -``` - -### `keycode <layer> <row> <col>` - -特定のレイヤー、行および列のキーコード値の出力: - -``` -> keycode 0 1 0 -0x29 (41) -``` - -### `keymap <layer>` - -特定のレイヤーの全てのキーマップの出力 - -``` -> keymap 0 -0x002b, 0x0014, 0x001a, 0x0008, 0x0015, 0x0017, 0x001c, 0x0018, 0x000c, 0x0012, 0x0013, 0x002a, -0x0029, 0x0004, 0x0016, 0x0007, 0x0009, 0x000a, 0x000b, 0x000d, 0x000e, 0x000f, 0x0033, 0x0034, -0x00e1, 0x001d, 0x001b, 0x0006, 0x0019, 0x0005, 0x0011, 0x0010, 0x0036, 0x0037, 0x0038, 0x0028, -0x5cd6, 0x00e0, 0x00e2, 0x00e3, 0x5cd4, 0x002c, 0x002c, 0x5cd5, 0x0050, 0x0051, 0x0052, 0x004f, -> -``` - -### `exit` - -ターミナルの終了 - `TERM_OFF` と同じ。 diff --git a/docs/ja/understanding_qmk.md b/docs/ja/understanding_qmk.md index 1654f8e002..550ee3a7c0 100644 --- a/docs/ja/understanding_qmk.md +++ b/docs/ja/understanding_qmk.md @@ -161,7 +161,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * [`bool process_combo(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_combo.c#L115) * [`bool process_printer(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_printer.c#L77) * [`bool process_auto_shift(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_auto_shift.c#L94) - * [`bool process_terminal(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_terminal.c#L264) * [Quantum 固有のキーコードを識別して処理する](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/quantum.c#L291) この一連のイベントの中の任意のステップで (`process_record_kb()` のような)関数は `false` を返して、以降の処理を停止することができます。 diff --git a/docs/platformdev_chibios_earlyinit.md b/docs/platformdev_chibios_earlyinit.md index aaa91ba438..e1256f2714 100644 --- a/docs/platformdev_chibios_earlyinit.md +++ b/docs/platformdev_chibios_earlyinit.md @@ -20,7 +20,7 @@ As such, if you wish to override this API consider limiting use to writing to lo | `#define STM32_BOOTLOADER_DUAL_BANK` | Relevant for dual-bank STM32 MCUs, signifies that a GPIO is to be toggled in order to enter bootloader mode. | `FALSE` | | `#define STM32_BOOTLOADER_DUAL_BANK_GPIO` | Relevant for dual-bank STM32 MCUs, the pin to toggle when attempting to enter bootloader mode, e.g. `B8` | `<none>` | | `#define STM32_BOOTLOADER_DUAL_BANK_POLARITY` | Relevant for dual-bank STM32 MCUs, the value to set the pin to in order to trigger charging of the RC circuit. e.g. `0` or `1`. | `0` | -| `#define STM32_BOOTLOADER_DUAL_BANK_DELAY` | Relevant for dual-bank STM32 MCUs, an arbitrary measurement of time to delay before resetting the MCU. Increasing number increases the delay. | `100000` | +| `#define STM32_BOOTLOADER_DUAL_BANK_DELAY` | Relevant for dual-bank STM32 MCUs, an arbitrary measurement of time to delay before resetting the MCU. Increasing number increases the delay. | `100` | Kinetis MCUs have no configurable options. diff --git a/docs/understanding_qmk.md b/docs/understanding_qmk.md index 9b80fb179e..c1bcfe3ce9 100644 --- a/docs/understanding_qmk.md +++ b/docs/understanding_qmk.md @@ -155,7 +155,6 @@ The `process_record()` function itself is deceptively simple, but hidden within * [`bool process_printer(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_printer.c#L77) * [`bool process_auto_shift(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_auto_shift.c#L94) * `bool process_dynamic_tapping_term(uint16_t keycode, keyrecord_t *record)` - * [`bool process_terminal(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_terminal.c#L264) * [Identify and process Quantum-specific keycodes](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/quantum.c#L291) At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing. diff --git a/docs/zh-cn/_summary.md b/docs/zh-cn/_summary.md index dbad1021fa..3baee6dc2e 100644 --- a/docs/zh-cn/_summary.md +++ b/docs/zh-cn/_summary.md @@ -91,7 +91,6 @@ * [换手](zh-cn/feature_swap_hands.md) * [一键多用](zh-cn/feature_tap_dance.md) * [点按配置](zh-cn/tap_hold.md) - * [终端](zh-cn/feature_terminal.md) * [Unicode](zh-cn/feature_unicode.md) * [用户空间](zh-cn/feature_userspace.md) * [WPM计算](zh-cn/feature_wpm.md) diff --git a/drivers/eeprom/eeprom_i2c.h b/drivers/eeprom/eeprom_i2c.h index 77eea66d63..85317c9ea5 100644 --- a/drivers/eeprom/eeprom_i2c.h +++ b/drivers/eeprom/eeprom_i2c.h @@ -54,6 +54,11 @@ # define EXTERNAL_EEPROM_PAGE_SIZE 32 # define EXTERNAL_EEPROM_ADDRESS_SIZE 2 # define EXTERNAL_EEPROM_WRITE_TIME 5 +#elif defined(EEPROM_I2C_24LC32A) +# define EXTERNAL_EEPROM_BYTE_COUNT 4096 +# define EXTERNAL_EEPROM_PAGE_SIZE 32 +# define EXTERNAL_EEPROM_ADDRESS_SIZE 2 +# define EXTERNAL_EEPROM_WRITE_TIME 5 #elif defined(EEPROM_I2C_MB85RC256V) # define EXTERNAL_EEPROM_BYTE_COUNT 32768 # define EXTERNAL_EEPROM_PAGE_SIZE 128 diff --git a/drivers/led/aw20216.c b/drivers/led/aw20216.c index 448accdcd3..299434f909 100644 --- a/drivers/led/aw20216.c +++ b/drivers/led/aw20216.c @@ -53,6 +53,10 @@ # define AW_GLOBAL_CURRENT_MAX 150 #endif +#ifndef AW_SPI_MODE +# define AW_SPI_MODE 3 +#endif + #ifndef AW_SPI_DIVISOR # define AW_SPI_DIVISOR 4 #endif @@ -63,7 +67,7 @@ bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; bool AW20216_write(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t* data, uint8_t len) { static uint8_t s_spi_transfer_buffer[2] = {0}; - if (!spi_start(cs_pin, false, 3, AW_SPI_DIVISOR)) { + if (!spi_start(cs_pin, false, AW_SPI_MODE, AW_SPI_DIVISOR)) { spi_stop(); return false; } diff --git a/drivers/ps2/ps2.h b/drivers/ps2/ps2.h index f123192852..2465e16235 100644 --- a/drivers/ps2/ps2.h +++ b/drivers/ps2/ps2.h @@ -89,6 +89,7 @@ uint8_t ps2_host_send(uint8_t data); uint8_t ps2_host_recv_response(void); uint8_t ps2_host_recv(void); void ps2_host_set_led(uint8_t usb_led); +bool pbuf_has_data(void); /*-------------------------------------------------------------------- * static functions diff --git a/drivers/ps2/ps2_interrupt.c b/drivers/ps2/ps2_interrupt.c index c49b4f8b75..c9a9f1e1ec 100644 --- a/drivers/ps2/ps2_interrupt.c +++ b/drivers/ps2/ps2_interrupt.c @@ -66,8 +66,8 @@ uint8_t ps2_error = PS2_ERR_NONE; static inline uint8_t pbuf_dequeue(void); static inline void pbuf_enqueue(uint8_t data); -static inline bool pbuf_has_data(void); static inline void pbuf_clear(void); +bool pbuf_has_data(void); #if defined(PROTOCOL_CHIBIOS) void ps2_interrupt_service_routine(void); @@ -309,7 +309,7 @@ static inline uint8_t pbuf_dequeue(void) { return val; } -static inline bool pbuf_has_data(void) { +bool pbuf_has_data(void) { #if defined(__AVR__) uint8_t sreg = SREG; cli(); diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index ccb0a929ae..66b48bb3c3 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -53,6 +53,7 @@ void ps2_mouse_init(void) { ps2_mouse_set_remote_mode(); #else ps2_mouse_enable_data_reporting(); + ps2_mouse_set_stream_mode(); #endif #ifdef PS2_MOUSE_ENABLE_SCROLLING @@ -75,19 +76,33 @@ void ps2_mouse_task(void) { extern int tp_buttons; /* receives packet from mouse */ +#ifdef PS2_MOUSE_USE_REMOTE_MODE uint8_t rcv; rcv = ps2_host_send(PS2_MOUSE_READ_DATA); if (rcv == PS2_ACK) { mouse_report.buttons = ps2_host_recv_response() | tp_buttons; mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER; mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER; -#ifdef PS2_MOUSE_ENABLE_SCROLLING +# ifdef PS2_MOUSE_ENABLE_SCROLLING mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK) * PS2_MOUSE_V_MULTIPLIER; -#endif +# endif + } else { + if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); + return; + } +#else + if (pbuf_has_data()) { + mouse_report.buttons = ps2_host_recv_response() | tp_buttons; + mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER; + mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER; +# ifdef PS2_MOUSE_ENABLE_SCROLLING + mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK) * PS2_MOUSE_V_MULTIPLIER; +# endif } else { if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); return; } +#endif /* if mouse moves or buttons state changes */ if (mouse_report.x || mouse_report.y || mouse_report.v || ((mouse_report.buttons ^ buttons_prev) & PS2_MOUSE_BTN_MASK)) { diff --git a/drivers/sensors/pimoroni_trackball.c b/drivers/sensors/pimoroni_trackball.c index 333e017a06..88a351316b 100644 --- a/drivers/sensors/pimoroni_trackball.c +++ b/drivers/sensors/pimoroni_trackball.c @@ -95,16 +95,3 @@ int16_t pimoroni_trackball_get_offsets(uint8_t negative_dir, uint8_t positive_di uint16_t magnitude = (scale * offset * offset * precision) >> 7; return isnegative ? -(int16_t)(magnitude) : (int16_t)(magnitude); } - -void pimoroni_trackball_adapt_values(int8_t* mouse, int16_t* offset) { - if (*offset > 127) { - *mouse = 127; - *offset -= 127; - } else if (*offset < -127) { - *mouse = -127; - *offset += 127; - } else { - *mouse = *offset; - *offset = 0; - } -} diff --git a/drivers/sensors/pimoroni_trackball.h b/drivers/sensors/pimoroni_trackball.h index e20ee748a7..749f381bbd 100644 --- a/drivers/sensors/pimoroni_trackball.h +++ b/drivers/sensors/pimoroni_trackball.h @@ -52,7 +52,6 @@ typedef struct { void pimoroni_trackball_device_init(void); void pimoroni_trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white); int16_t pimoroni_trackball_get_offsets(uint8_t negative_dir, uint8_t positive_dir, uint8_t scale); -void pimoroni_trackball_adapt_values(int8_t* mouse, int16_t* offset); uint16_t pimoroni_trackball_get_cpi(void); void pimoroni_trackball_set_cpi(uint16_t cpi); i2c_status_t read_pimoroni_trackball(pimoroni_data_t* data); diff --git a/keyboards/40percentclub/mf68/keymaps/delivrance/rules.mk b/keyboards/40percentclub/mf68/keymaps/delivrance/rules.mk index 5ac2ce5ccb..3d056cb71b 100644 --- a/keyboards/40percentclub/mf68/keymaps/delivrance/rules.mk +++ b/keyboards/40percentclub/mf68/keymaps/delivrance/rules.mk @@ -1,6 +1,5 @@ BACKLIGHT_DRIVER = custom NKRO_ENABLE = yes -TERMINAL_ENABLE = yes DYNAMIC_MACRO_ENABLE = yes # Use RAM (fake EEPROM, transient) instead of real EEPROM diff --git a/keyboards/basekeys/slice/rev1/keymaps/2moons/keymap.c b/keyboards/basekeys/slice/rev1/keymaps/2moons/keymap.c index 26ca151089..1292f2d2ed 100644 --- a/keyboards/basekeys/slice/rev1/keymaps/2moons/keymap.c +++ b/keyboards/basekeys/slice/rev1/keymaps/2moons/keymap.c @@ -46,8 +46,8 @@ enum tapdances{ }; qk_tap_dance_action_t tap_dance_actions[] = { - [TD_ESFL] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _FLOCK), - [TD_ESQW] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY), + [TD_ESFL] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _FLOCK), + [TD_ESQW] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY), }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/basekeys/slice/rev1_rgb/keymaps/2moons_rgb/keymap.c b/keyboards/basekeys/slice/rev1_rgb/keymaps/2moons_rgb/keymap.c index 05de0e42d0..7e82c7b7d2 100644 --- a/keyboards/basekeys/slice/rev1_rgb/keymaps/2moons_rgb/keymap.c +++ b/keyboards/basekeys/slice/rev1_rgb/keymaps/2moons_rgb/keymap.c @@ -39,8 +39,8 @@ enum tapdances{ }; qk_tap_dance_action_t tap_dance_actions[] = { - [TD_ESFL] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _FLOCK), - [TD_ESQW] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY), + [TD_ESFL] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _FLOCK), + [TD_ESQW] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY), }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/bpiphany/frosty_flake/keymaps/nikchi/config.h b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/config.h index 4bc6d2c3c0..e45034f9a8 100644 --- a/keyboards/bpiphany/frosty_flake/keymaps/nikchi/config.h +++ b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/config.h @@ -2,6 +2,7 @@ // place overrides here #define TAPPING_TERM 200 +#define TAPPING_TERM_PER_KEY #define LEADER_TIMEOUT 800 #define DISABLE_SPACE_CADET_ROLLOVER diff --git a/keyboards/bpiphany/frosty_flake/keymaps/nikchi/keymap.c b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/keymap.c index dd2098d945..6db177c183 100644 --- a/keyboards/bpiphany/frosty_flake/keymaps/nikchi/keymap.c +++ b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/keymap.c @@ -52,17 +52,33 @@ qk_tap_dance_action_t tap_dance_actions[] = { // Tap once for CTRL, twice for Caps Lock [TD_CTCPS] = ACTION_TAP_DANCE_DOUBLE(KC_LCTL, KC_CAPS), [COPA] = ACTION_TAP_DANCE_DOUBLE(LCTL(KC_C), LCTL(KC_V)), - [EMOJIS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleEmojis, NULL, NULL, 800), - [ANIMAL] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleAnimals, NULL, NULL, 800), - //[SYMBOLS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleSymbols, NULL, NULL, 800), - [FOODS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleFoods, NULL, NULL, 800), - [ETC] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleEtc, NULL, NULL, 800), - //[VEHICLES] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleVehicles, NULL, NULL, 800), - //[SUPPLEMENT] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleSupplement, NULL, NULL, 800), - [ALLS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleAll, NULL, NULL, 800) + [EMOJIS] = ACTION_TAP_DANCE_FN_ADVANCED(cycleEmojis, NULL, NULL), + [ANIMAL] = ACTION_TAP_DANCE_FN_ADVANCED(cycleAnimals, NULL, NULL), + //[SYMBOLS] = ACTION_TAP_DANCE_FN_ADVANCED(cycleSymbols, NULL, NULL), + [FOODS] = ACTION_TAP_DANCE_FN_ADVANCED(cycleFoods, NULL, NULL), + [ETC] = ACTION_TAP_DANCE_FN_ADVANCED(cycleEtc, NULL, NULL), + //[VEHICLES] = ACTION_TAP_DANCE_FN_ADVANCED(cycleVehicles, NULL, NULL), + //[SUPPLEMENT] = ACTION_TAP_DANCE_FN_ADVANCED(cycleSupplement, NULL, NULL), + [ALLS] = ACTION_TAP_DANCE_FN_ADVANCED(cycleAll, NULL, NULL) // Other declarations would go here, separated by commas, if you have them }; +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(EMOJIS): + case TD(ANIMAL): + //case TD(SYMBOLS): + case TD(FOODS): + case TD(ETC): + //case TD(VEHICLES): + //case TD(SUPPLEMENT): + case TD(ALLS): + return 800; + default: + return TAPPING_TERM; + } +} + // macros const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { switch(id) { diff --git a/keyboards/bpiphany/frosty_flake/keymaps/nikchi/variableTapDance.md b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/variableTapDance.md index b2e5041393..c3fce50f2a 100644 --- a/keyboards/bpiphany/frosty_flake/keymaps/nikchi/variableTapDance.md +++ b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/variableTapDance.md @@ -3,7 +3,4 @@ Tap Dance is constrained normally by `TAPPING_TERM` defined in your keyboard's c -- `ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term)` : This works the same as `ACTION_TAP_DANCE_FN_ADVANCED` just with the extra `tap_specific_tapping_term` arguement at the end. This way you can set a specific tap dance to have a longer or shorter tap in between your taps, giving you more, or less, time in between each tap. - - -`tap_specific_tapping_term` should be the same type and range of values that one would put into the `TAPPING_TERM` definition in the config.h file. +- Implementing `uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record)`, you can set a specific tap dance to have a longer or shorter tap in between your taps, giving you more, or less, time in between each tap. The return value should be the same type and range of values that one would put into the `TAPPING_TERM` definition in the config.h file. diff --git a/keyboards/ckeys/handwire_101/keymaps/default/keymap.c b/keyboards/ckeys/handwire_101/keymaps/default/keymap.c index 3bb1a2c009..3f5ebc8655 100755 --- a/keyboards/ckeys/handwire_101/keymaps/default/keymap.c +++ b/keyboards/ckeys/handwire_101/keymaps/default/keymap.c @@ -134,10 +134,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------=======------------------------' */ [_TERMINAL] = LAYOUT_ortho_4x4( - _______, TERM_ABOUT, _______, _______, - TERM_OFF, TERM_PRINT, _______, _______, - _______, TERM_FLUSH, _______, _______, - TERM_ON, TERM_HELP , _______, _______ + _______, TERM_ABOUT, _______, _______, + _______, TERM_PRINT, _______, _______, + _______, TERM_FLUSH, _______, _______, + _______, TERM_HELP , _______, _______ ), /* ADMIN * ,-----------------------------------------. diff --git a/keyboards/ckeys/handwire_101/rules.mk b/keyboards/ckeys/handwire_101/rules.mk index 8fa32bcee5..3131bb405a 100755 --- a/keyboards/ckeys/handwire_101/rules.mk +++ b/keyboards/ckeys/handwire_101/rules.mk @@ -12,7 +12,6 @@ MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration -TERMINAL_ENABLE = yes NKRO_ENABLE = yes # Enable N-Key Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality AUDIO_ENABLE = no # Audio output diff --git a/keyboards/contra/keymaps/default/keymap.c b/keyboards/contra/keymaps/default/keymap.c index 6c05ebebff..1a365c9a6d 100644 --- a/keyboards/contra/keymaps/default/keymap.c +++ b/keyboards/contra/keymaps/default/keymap.c @@ -163,7 +163,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = LAYOUT_planck_mit( _______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, - _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) diff --git a/keyboards/delikeeb/vaneela/keymaps/default/keymap.c b/keyboards/delikeeb/vaneela/keymaps/default/keymap.c index b1d7401b9d..57df91cd4d 100644 --- a/keyboards/delikeeb/vaneela/keymaps/default/keymap.c +++ b/keyboards/delikeeb/vaneela/keymaps/default/keymap.c @@ -106,7 +106,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_FN] = LAYOUT_ortho_5x12( _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,TERM_ON, TERM_OFF, KC_DEL, + _______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL, _______, _______, _______, _______, _______, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ diff --git a/keyboards/delikeeb/vaneela/keymaps/via/keymap.c b/keyboards/delikeeb/vaneela/keymaps/via/keymap.c index 65194b84d3..4bfee3daf5 100644 --- a/keyboards/delikeeb/vaneela/keymaps/via/keymap.c +++ b/keyboards/delikeeb/vaneela/keymaps/via/keymap.c @@ -105,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_FN] = LAYOUT_ortho_5x12( _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,TERM_ON, TERM_OFF, KC_DEL, + _______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______, _______, _______, _______, _______, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ diff --git a/keyboards/dm9records/plaid/keymaps/default/keymap.c b/keyboards/dm9records/plaid/keymaps/default/keymap.c index f11b744066..d96c250609 100644 --- a/keyboards/dm9records/plaid/keymaps/default/keymap.c +++ b/keyboards/dm9records/plaid/keymaps/default/keymap.c @@ -195,7 +195,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = LAYOUT_plaid_grid( QK_BOOT,LED_1, LED_2, LED_3, LED_4, LED_5,LED_6, LED_7, LED_8, LED_9, LED_0,KC_DEL , _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, - _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) diff --git a/keyboards/doppelganger/doppelganger.c b/keyboards/doppelganger/doppelganger.c index 04d19480da..304d764028 100644 --- a/keyboards/doppelganger/doppelganger.c +++ b/keyboards/doppelganger/doppelganger.c @@ -15,25 +15,31 @@ */ #include "doppelganger.h" -void keyboard_pre_init_kb (void) { - setPinOutput(C6); - setPinOutput(B0); +void keyboard_pre_init_kb(void) { + setPinOutput(C6); + setPinOutput(B0); } bool led_update_kb(led_t led_state) { - bool res = led_update_user(led_state); - if(res) { - // writePin sets the pin high for 1 and low for 0. - // In this example the pins are inverted, setting - // it low/0 turns it on, and high/1 turns the LED off. - // This behavior depends on whether the LED is between the pin - // and VCC or the pin and GND. - writePin(C6, !led_state.caps_lock); - } - return res; + bool res = led_update_user(led_state); + if (res) { + // writePin sets the pin high for 1 and low for 0. + // In this example the pins are inverted, setting + // it low/0 turns it on, and high/1 turns the LED off. + // This behavior depends on whether the LED is between the pin + // and VCC or the pin and GND. + writePin(C6, !led_state.caps_lock); + } + return res; } __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { - writePin(B0, !(state & (1UL << 1))); - return state; + writePin(B0, !(state & (1UL << 1))); + return state; +} + +// Override core logic as we reuse SPLIT_HAND_PIN within matrix pins +bool is_keyboard_left(void) { + setPinInput(SPLIT_HAND_PIN); + return readPin(SPLIT_HAND_PIN); } diff --git a/keyboards/duck/lightsaver/keymaps/rasmus/keymap.c b/keyboards/duck/lightsaver/keymaps/rasmus/keymap.c index 70dc17bb13..65f128a26b 100644 --- a/keyboards/duck/lightsaver/keymaps/rasmus/keymap.c +++ b/keyboards/duck/lightsaver/keymaps/rasmus/keymap.c @@ -34,8 +34,8 @@ enum { //Tap Dance Definitions qk_tap_dance_action_t tap_dance_actions[] = { - [TD_F1_GAME] = ACTION_TAP_DANCE_DUAL_ROLE(KC_F1, GAME), - [TD_CAPS_FN] = ACTION_TAP_DANCE_DUAL_ROLE(KC_CAPS, 5) + [TD_F1_GAME] = ACTION_TAP_DANCE_LAYER_MOVE(KC_F1, GAME), + [TD_CAPS_FN] = ACTION_TAP_DANCE_LAYER_MOVE(KC_CAPS, 5) }; enum macro_id { diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/config.h b/keyboards/ergodox_ez/keymaps/hacker_dvorak/config.h index da20820787..c35963d842 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/config.h +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/config.h @@ -7,6 +7,7 @@ #undef TAPPING_TERM #define TAPPING_TERM 175 +#define TAPPING_TERM_PER_KEY #undef DEBOUNCE #define DEBOUNCE 15 diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dance_actions.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dance_actions.c index 59e3e2b0dc..1d5e1cee00 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dance_actions.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dance_actions.c @@ -13,14 +13,32 @@ qk_tap_dance_action_t tap_dance_actions[] = { [RPRN_RBRC] = ACTION_TAP_DANCE_DOUBLE(KC_RPRN, KC_RBRC), [LCBR_LABK] = ACTION_TAP_DANCE_DOUBLE(KC_LCBR, KC_LABK), [RCBR_RABK] = ACTION_TAP_DANCE_DOUBLE(KC_RCBR, KC_RABK), - [SCLN_COLN] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, scln_coln_finished, scln_coln_reset, DANCING_TERM), - [QUOT_DQUO] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, quot_dquot_finished, quot_dquot_reset, DANCING_TERM), - [DOT_COMM] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, dot_comm_finished, dot_comm_reset, DANCING_TERM), - [NONE_LEAD] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, none_lead_finished, none_lead_reset, DANCING_TERM), - [U_ARR_GUI] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, u_arrows_gui_finished, u_arrows_gui_reset, DANCING_TERM), - [H_MOU_GUI] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, h_mouse_gui_finished, h_mouse_gui_reset, DANCING_TERM), - [J_MED_MEH] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, j_media_meh_finished, j_media_meh_reset, DANCING_TERM), - [W_MED_MEH] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, w_media_meh_finished, w_media_meh_reset, DANCING_TERM), - [K_NUM_HYP] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, k_numpad_hyper_finished, k_numpad_hyper_reset, DANCING_TERM), - [M_CHO_HYP] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, m_chords_hyper_finished, m_chords_hyper_reset, DANCING_TERM), + [SCLN_COLN] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, scln_coln_finished, scln_coln_reset), + [QUOT_DQUO] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, quot_dquot_finished, quot_dquot_reset), + [DOT_COMM] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dot_comm_finished, dot_comm_reset), + [NONE_LEAD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, none_lead_finished, none_lead_reset), + [U_ARR_GUI] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, u_arrows_gui_finished, u_arrows_gui_reset), + [H_MOU_GUI] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, h_mouse_gui_finished, h_mouse_gui_reset), + [J_MED_MEH] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, j_media_meh_finished, j_media_meh_reset), + [W_MED_MEH] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, w_media_meh_finished, w_media_meh_reset), + [K_NUM_HYP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, k_numpad_hyper_finished, k_numpad_hyper_reset), + [M_CHO_HYP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, m_chords_hyper_finished, m_chords_hyper_reset), }; + +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(SCLN_COLN): + case TD(QUOT_DQUO): + case TD(DOT_COMM): + case TD(NONE_LEAD): + case TD(U_ARR_GUI): + case TD(H_MOU_GUI): + case TD(J_MED_MEH): + case TD(W_MED_MEH): + case TD(K_NUM_HYP): + case TD(M_CHO_HYP): + return DANCING_TERM; + default: + return TAPPING_TERM; + } +} diff --git a/keyboards/fractal/keymaps/default/keymap.c b/keyboards/fractal/keymaps/default/keymap.c index 6b0a8cc18c..ded4890d8c 100644 --- a/keyboards/fractal/keymaps/default/keymap.c +++ b/keyboards/fractal/keymaps/default/keymap.c @@ -158,7 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_ADJUST] = LAYOUT_ortho_5x12( KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, - _______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL, + _______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL, _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ diff --git a/keyboards/gboards/gergoplex/keymaps/georgepetri/config.h b/keyboards/gboards/gergoplex/keymaps/georgepetri/config.h index f66c334b85..e2c27583fa 100644 --- a/keyboards/gboards/gergoplex/keymaps/georgepetri/config.h +++ b/keyboards/gboards/gergoplex/keymaps/georgepetri/config.h @@ -27,3 +27,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define COMBO_ALLOW_ACTION_KEYS #define COMBO_VARIABLE_LEN + +#define TAPPING_TERM_PER_KEY diff --git a/keyboards/gboards/gergoplex/keymaps/georgepetri/keymap.c b/keyboards/gboards/gergoplex/keymaps/georgepetri/keymap.c index e3b8944814..8b832cbac8 100644 --- a/keyboards/gboards/gergoplex/keymaps/georgepetri/keymap.c +++ b/keyboards/gboards/gergoplex/keymaps/georgepetri/keymap.c @@ -199,5 +199,14 @@ void ql_reset(qk_tap_dance_state_t *state, void *user_data) { } qk_tap_dance_action_t tap_dance_actions[] = { - [GAME] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, ql_finished, ql_reset, 275) + [GAME] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset) }; + +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: + return 275; + default: + return TAPPING_TERM; + } +} diff --git a/keyboards/handwired/ortho5x14/keymaps/2u/keymap.c b/keyboards/handwired/ortho5x14/keymaps/2u/keymap.c index 70a96fac9d..d785825332 100644 --- a/keyboards/handwired/ortho5x14/keymaps/2u/keymap.c +++ b/keyboards/handwired/ortho5x14/keymaps/2u/keymap.c @@ -343,9 +343,9 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_PGUP_HOME] = ACTION_TAP_DANCE_DOUBLE(KC_PGUP, KC_HOME), [TD_PGDN_END] = ACTION_TAP_DANCE_DOUBLE(KC_PGDN, KC_END), - [TD_Q_LrALT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_Q, _ALT), - [TD_R_LrKey] = ACTION_TAP_DANCE_DUAL_ROLE(KC_R, _RAISE), - [TD_T_LrMS] = ACTION_TAP_DANCE_DUAL_ROLE(KC_T, _MOUSE), + [TD_Q_LrALT] = ACTION_TAP_DANCE_LAYER_MOVE(KC_Q, _ALT), + [TD_R_LrKey] = ACTION_TAP_DANCE_LAYER_MOVE(KC_R, _RAISE), + [TD_T_LrMS] = ACTION_TAP_DANCE_LAYER_MOVE(KC_T, _MOUSE), [TD_SHIFT_CAPS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL,lshift_finished, lshift_reset), [TD_SPC_ENT] = ACTION_TAP_DANCE_DOUBLE(KC_SPACE, KC_ENT), diff --git a/keyboards/handwired/ortho5x14/keymaps/split1/keymap.c b/keyboards/handwired/ortho5x14/keymaps/split1/keymap.c index b152503aaf..3734510f8c 100644 --- a/keyboards/handwired/ortho5x14/keymaps/split1/keymap.c +++ b/keyboards/handwired/ortho5x14/keymaps/split1/keymap.c @@ -279,9 +279,9 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_PGUP_HOME] = ACTION_TAP_DANCE_DOUBLE(KC_PGUP, KC_HOME), [TD_PGDN_END] = ACTION_TAP_DANCE_DOUBLE(KC_PGUP, KC_END), - [TD_Q_LrALT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_Q, _ALT), - [TD_R_LrKey] = ACTION_TAP_DANCE_DUAL_ROLE(KC_R, _RAISE), - [TD_T_LrMS] = ACTION_TAP_DANCE_DUAL_ROLE(KC_T, _MOUSE), + [TD_Q_LrALT] = ACTION_TAP_DANCE_LAYER_MOVE(KC_Q, _ALT), + [TD_R_LrKey] = ACTION_TAP_DANCE_LAYER_MOVE(KC_R, _RAISE), + [TD_T_LrMS] = ACTION_TAP_DANCE_LAYER_MOVE(KC_T, _MOUSE), [TD_SHIFT_CAPS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL,lshift_finished, lshift_reset), [TD_SPC_ENT] = ACTION_TAP_DANCE_DOUBLE(KC_SPACE, KC_ENT), diff --git a/keyboards/handwired/ortho_brass/keymaps/default/keymap.c b/keyboards/handwired/ortho_brass/keymaps/default/keymap.c index 948a7bd1bc..f32529b6a7 100644 --- a/keyboards/handwired/ortho_brass/keymaps/default/keymap.c +++ b/keyboards/handwired/ortho_brass/keymaps/default/keymap.c @@ -162,7 +162,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = LAYOUT_ortho_4x12_1x2uC( _______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, - _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) diff --git a/keyboards/handwired/riblee_f401/keymaps/default/keymap.c b/keyboards/handwired/riblee_f401/keymaps/default/keymap.c index 6892c0fb49..bee4de5ede 100644 --- a/keyboards/handwired/riblee_f401/keymaps/default/keymap.c +++ b/keyboards/handwired/riblee_f401/keymaps/default/keymap.c @@ -158,7 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_ADJUST] = LAYOUT_ortho_5x12( KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, - _______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL, + _______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL, _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, LCG_SWP, LCG_NRM, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ diff --git a/keyboards/handwired/riblee_f411/keymaps/default/keymap.c b/keyboards/handwired/riblee_f411/keymaps/default/keymap.c index 2e9485d6b9..ff7e1117b8 100644 --- a/keyboards/handwired/riblee_f411/keymaps/default/keymap.c +++ b/keyboards/handwired/riblee_f411/keymaps/default/keymap.c @@ -158,7 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_ADJUST] = LAYOUT_ortho_5x12( KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, - _______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL, + _______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL, _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, LCG_SWP, LCG_NRM, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ diff --git a/keyboards/handwired/rs60/keymaps/default/keymap.c b/keyboards/handwired/rs60/keymaps/default/keymap.c index 6b311a7ebb..6d5dc4a32a 100644 --- a/keyboards/handwired/rs60/keymaps/default/keymap.c +++ b/keyboards/handwired/rs60/keymaps/default/keymap.c @@ -155,7 +155,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_ADJUST] = LAYOUT_ortho_5x12( KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, - _______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL, + _______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL, _______, _______, _______, _______, _______, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ diff --git a/keyboards/handwired/terminus_mini/keymaps/default/keymap.c b/keyboards/handwired/terminus_mini/keymaps/default/keymap.c index 8062aa711f..8d0631072f 100644 --- a/keyboards/handwired/terminus_mini/keymaps/default/keymap.c +++ b/keyboards/handwired/terminus_mini/keymaps/default/keymap.c @@ -193,7 +193,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_ADJUST] = LAYOUT( - _______, _______, _______, _______, _______, QK_BOOT, _______, TERM_ON, TERM_OFF, _______, _______, KC_DEL, + _______, _______, _______, _______, _______, QK_BOOT, _______, _______, _______, _______, _______, KC_DEL, _______, _______, _______, _______, _______, _______, _______, QWERTY, COLEMAK, DVORAK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ diff --git a/keyboards/jones/v03/keymaps/default_jp/config.h b/keyboards/jones/v03/keymaps/default_jp/config.h index aa06121c1c..7545003ac7 100644 --- a/keyboards/jones/v03/keymaps/default_jp/config.h +++ b/keyboards/jones/v03/keymaps/default_jp/config.h @@ -21,3 +21,4 @@ // time for long press #define TAPPING_TERM 200 +#define TAPPING_TERM_PER_KEY diff --git a/keyboards/jones/v03/keymaps/default_jp/keymap.c b/keyboards/jones/v03/keymaps/default_jp/keymap.c index 3f5b10208c..bdcb9e88b1 100644 --- a/keyboards/jones/v03/keymaps/default_jp/keymap.c +++ b/keyboards/jones/v03/keymaps/default_jp/keymap.c @@ -51,9 +51,18 @@ void ql_reset(qk_tap_dance_state_t *state, void *user_data); // Tap Dance definitions qk_tap_dance_action_t tap_dance_actions[] = { [TD_LSFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS), - [TD_ESC_NUM] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, ql_finished, ql_reset, 275), + [TD_ESC_NUM] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset), }; +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_ESC_NUM): + return 275; + default: + return TAPPING_TERM; + } +} + // Defines the keycodes used by our macros in process_record_user enum custom_keycodes { MAC = SAFE_RANGE, @@ -303,7 +312,7 @@ static tap ql_tap_state = { // Functions that control what our tap dance key does void ql_finished(qk_tap_dance_state_t *state, void *user_data) { ql_tap_state.state = cur_dance(state); - switch(state->keycode) { + switch(TAP_DANCE_KEYCODE(state)) { case TD(TD_ESC_NUM): // ESC key action switch (ql_tap_state.state) { case SINGLE_TAP: @@ -332,7 +341,7 @@ void ql_finished(qk_tap_dance_state_t *state, void *user_data) { } void ql_reset(qk_tap_dance_state_t *state, void *user_data) { - switch(state->keycode) { + switch(TAP_DANCE_KEYCODE(state)) { case TD(TD_ESC_NUM): // If the key was held down and now is released then switch off the layer if (ql_tap_state.state == TAP_HOLD) { diff --git a/keyboards/jones/v03_1/keymaps/default_ansi/config.h b/keyboards/jones/v03_1/keymaps/default_ansi/config.h index 0b51190bbe..ee7b09a90c 100644 --- a/keyboards/jones/v03_1/keymaps/default_ansi/config.h +++ b/keyboards/jones/v03_1/keymaps/default_ansi/config.h @@ -21,6 +21,7 @@ // time for long press #define TAPPING_TERM 200 +#define TAPPING_TERM_PER_KEY // music map for music-mode #define MUSIC_MAP diff --git a/keyboards/jones/v03_1/keymaps/default_ansi/keymap.c b/keyboards/jones/v03_1/keymaps/default_ansi/keymap.c index 5b1486bb86..e86204a3e3 100644 --- a/keyboards/jones/v03_1/keymaps/default_ansi/keymap.c +++ b/keyboards/jones/v03_1/keymaps/default_ansi/keymap.c @@ -50,9 +50,18 @@ void ql_reset(qk_tap_dance_state_t *state, void *user_data); // Tap Dance definitions qk_tap_dance_action_t tap_dance_actions[] = { [TD_LSFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS), - [TD_ESC_NUM] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, ql_finished, ql_reset, 275), + [TD_ESC_NUM] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset), }; +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_ESC_NUM): + return 275; + default: + return TAPPING_TERM; + } +} + // Defines the keycodes used by our macros in process_record_user enum custom_keycodes { MAC = SAFE_RANGE, @@ -322,7 +331,7 @@ static tap ql_tap_state = { // Functions that control what our tap dance key does void ql_finished(qk_tap_dance_state_t *state, void *user_data) { ql_tap_state.state = cur_dance(state); - switch(state->keycode) { + switch(TAP_DANCE_KEYCODE(state)) { case TD(TD_ESC_NUM): // ESC key action switch (ql_tap_state.state) { case SINGLE_TAP: @@ -351,7 +360,7 @@ void ql_finished(qk_tap_dance_state_t *state, void *user_data) { } void ql_reset(qk_tap_dance_state_t *state, void *user_data) { - switch(state->keycode) { + switch(TAP_DANCE_KEYCODE(state)) { case TD(TD_ESC_NUM): // If the key was held down and now is released then switch off the layer if (ql_tap_state.state == TAP_HOLD) { diff --git a/keyboards/jones/v03_1/keymaps/default_jp/config.h b/keyboards/jones/v03_1/keymaps/default_jp/config.h index 0b51190bbe..ee7b09a90c 100644 --- a/keyboards/jones/v03_1/keymaps/default_jp/config.h +++ b/keyboards/jones/v03_1/keymaps/default_jp/config.h @@ -21,6 +21,7 @@ // time for long press #define TAPPING_TERM 200 +#define TAPPING_TERM_PER_KEY // music map for music-mode #define MUSIC_MAP diff --git a/keyboards/jones/v03_1/keymaps/default_jp/keymap.c b/keyboards/jones/v03_1/keymaps/default_jp/keymap.c index 436586a721..9a2663f6d7 100644 --- a/keyboards/jones/v03_1/keymaps/default_jp/keymap.c +++ b/keyboards/jones/v03_1/keymaps/default_jp/keymap.c @@ -51,9 +51,18 @@ void ql_reset(qk_tap_dance_state_t *state, void *user_data); // Tap Dance definitions qk_tap_dance_action_t tap_dance_actions[] = { [TD_LSFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS), - [TD_ESC_NUM] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, ql_finished, ql_reset, 275), + [TD_ESC_NUM] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset), }; +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_ESC_NUM): + return 275; + default: + return TAPPING_TERM; + } +} + // Defines the keycodes used by our macros in process_record_user enum custom_keycodes { MAC = SAFE_RANGE, @@ -324,7 +333,7 @@ static tap ql_tap_state = { // Functions that control what our tap dance key does void ql_finished(qk_tap_dance_state_t *state, void *user_data) { ql_tap_state.state = cur_dance(state); - switch(state->keycode) { + switch(TAP_DANCE_KEYCODE(state)) { case TD(TD_ESC_NUM): // ESC key action switch (ql_tap_state.state) { case SINGLE_TAP: @@ -353,7 +362,7 @@ void ql_finished(qk_tap_dance_state_t *state, void *user_data) { } void ql_reset(qk_tap_dance_state_t *state, void *user_data) { - switch(state->keycode) { + switch(TAP_DANCE_KEYCODE(state)) { case TD(TD_ESC_NUM): // If the key was held down and now is released then switch off the layer if (ql_tap_state.state == TAP_HOLD) { diff --git a/keyboards/keycapsss/o4l_5x12/keymaps/default/keymap.c b/keyboards/keycapsss/o4l_5x12/keymaps/default/keymap.c index 050b5a2c3e..2f64a56e9a 100644 --- a/keyboards/keycapsss/o4l_5x12/keymaps/default/keymap.c +++ b/keyboards/keycapsss/o4l_5x12/keymaps/default/keymap.c @@ -92,7 +92,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_ADJUST] = LAYOUT_ortho_5x12( KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, - _______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL, + _______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL, _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ diff --git a/keyboards/keyhive/navi10/keymaps/default/keymap.c b/keyboards/keyhive/navi10/keymaps/default/keymap.c index d1b3127760..c4295b1553 100644 --- a/keyboards/keyhive/navi10/keymaps/default/keymap.c +++ b/keyboards/keyhive/navi10/keymaps/default/keymap.c @@ -127,5 +127,5 @@ void tk_reset(qk_tap_dance_state_t *state, void *user_data){ //associate the tap dance key with its functionality qk_tap_dance_action_t tap_dance_actions[] = { - [TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, tk_finished, tk_reset, 275) + [TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tk_finished, tk_reset) }; diff --git a/keyboards/keyhive/navi10/keymaps/devdev/keymap.c b/keyboards/keyhive/navi10/keymaps/devdev/keymap.c index b0d43ebc69..0fc20cbbd4 100644 --- a/keyboards/keyhive/navi10/keymaps/devdev/keymap.c +++ b/keyboards/keyhive/navi10/keymaps/devdev/keymap.c @@ -259,5 +259,5 @@ void tk_reset(qk_tap_dance_state_t *state, void *user_data){ //associate the tap dance key with its functionality qk_tap_dance_action_t tap_dance_actions[] = { - [TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, tk_finished, tk_reset, TAPPING_TERM) + [TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tk_finished, tk_reset) }; diff --git a/keyboards/keyhive/navi10/keymaps/emdarcher/keymap.c b/keyboards/keyhive/navi10/keymaps/emdarcher/keymap.c index 40efed48d5..37850e28f3 100644 --- a/keyboards/keyhive/navi10/keymaps/emdarcher/keymap.c +++ b/keyboards/keyhive/navi10/keymaps/emdarcher/keymap.c @@ -178,5 +178,5 @@ void tk_reset(qk_tap_dance_state_t *state, void *user_data){ //associate the tap dance key with its functionality qk_tap_dance_action_t tap_dance_actions[] = { - [TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, tk_finished, tk_reset, 275) + [TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tk_finished, tk_reset) }; diff --git a/keyboards/kprepublic/jj50/keymaps/archetype/config.h b/keyboards/kprepublic/jj50/keymaps/archetype/config.h index a12e070b4f..9604ac719c 100644 --- a/keyboards/kprepublic/jj50/keymaps/archetype/config.h +++ b/keyboards/kprepublic/jj50/keymaps/archetype/config.h @@ -6,4 +6,5 @@ #define AUTO_SHIFT_TIMEOUT 150 #define NO_AUTO_SHIFT_ALPHA #define TAPPING_TERM 150 +#define TAPPING_TERM_PER_KEY //#define BOOTMAGIC_KEY_SALT KC_LCTL diff --git a/keyboards/kprepublic/jj50/keymaps/archetype/keymap.c b/keyboards/kprepublic/jj50/keymaps/archetype/keymap.c index 82c615f135..ff59ef43e5 100644 --- a/keyboards/kprepublic/jj50/keymaps/archetype/keymap.c +++ b/keyboards/kprepublic/jj50/keymaps/archetype/keymap.c @@ -167,9 +167,18 @@ qk_tap_dance_action_t tap_dance_actions[] = { // Single tap = ) | Double tap = ] | Triple tap = } | Single hold = KC_LALT [TD_LALT_RBRC] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, right_brackets, right_brackets_reset), // Layer Switcher ESC - [TD_ESC_LAYER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, layer_switcher, layer_switcher_reset, 100), + [TD_ESC_LAYER] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, layer_switcher, layer_switcher_reset), }; +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_ESC_LAYER): + return 100; + default: + return TAPPING_TERM; + } +} + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/massdrop/alt/keymaps/pregame/rules.mk b/keyboards/massdrop/alt/keymaps/pregame/rules.mk index 184405662a..5981633f7c 100644 --- a/keyboards/massdrop/alt/keymaps/pregame/rules.mk +++ b/keyboards/massdrop/alt/keymaps/pregame/rules.mk @@ -8,7 +8,6 @@ DYNAMIC_MACRO_ENABLE = no # Dynamic macro recording and play MOUSEKEY_ENABLE = no # Enable mouse control keycodes. Increases firmware size. TAP_DANCE_ENABLE = no # Enable tap dance keys CONSOLE_ENABLE = no # Enable debugging console. Increases firmware size. -TERMINAL_ENABLE = no EXTRAKEY_ENABLE = yes # Audio control and System control # RAW_ENABLE = yes # Raw HID has not yet been implemented for this keyboard # COMBO_ENABLE # Key combo feature diff --git a/keyboards/massdrop/ctrl/keymaps/endgame/rules.mk b/keyboards/massdrop/ctrl/keymaps/endgame/rules.mk index 9502c242dd..c4fab8ad53 100644 --- a/keyboards/massdrop/ctrl/keymaps/endgame/rules.mk +++ b/keyboards/massdrop/ctrl/keymaps/endgame/rules.mk @@ -7,7 +7,6 @@ MOUSEKEY_ENABLE = yes # Enable mouse control keycodes. Increases firmware size TAP_DANCE_ENABLE = yes # Enable tap dance keys CONSOLE_ENABLE = yes # Enable debugging console. Increases firmware size. SRC += config_led.c # Used to add files to the compilation/linking list. -TERMINAL_ENABLE = yes EXTRAKEY_ENABLE = yes # Audio control and System control # RAW_ENABLE = yes # Raw HID has not yet been implemented for this keyboard # COMBO_ENABLE # Key combo feature diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/rules.mk b/keyboards/massdrop/ctrl/keymaps/matthewrobo/rules.mk index e834404e29..4bb43f525b 100644 --- a/keyboards/massdrop/ctrl/keymaps/matthewrobo/rules.mk +++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/rules.mk @@ -7,7 +7,6 @@ MOUSEKEY_ENABLE = no # Enable mouse control keycodes. Increases firmware size. TAP_DANCE_ENABLE = no # Enable tap dance keys CONSOLE_ENABLE = no # Enable debugging console. Increases firmware size. SRC += config_led.c # Used to add files to the compilation/linking list. -TERMINAL_ENABLE = no EXTRAKEY_ENABLE = yes # Audio control and System control #RAW_ENABLE = yes #Raw HID has not yet been implemented for this keyboard #COMBO_ENABLE #Key combo feature diff --git a/keyboards/massdrop/ctrl/keymaps/xanimos/rules.mk b/keyboards/massdrop/ctrl/keymaps/xanimos/rules.mk index 43a312ce4e..2913eff83b 100644 --- a/keyboards/massdrop/ctrl/keymaps/xanimos/rules.mk +++ b/keyboards/massdrop/ctrl/keymaps/xanimos/rules.mk @@ -8,7 +8,6 @@ TAP_DANCE_ENABLE = yes # Enable tap dance keys CONSOLE_ENABLE = no # Enable debugging console. Increases firmware size. SRC += config_led.c # Used to add files to the compilation/linking list. EXTRAKEY_ENABLE = yes # Audio control and System control -TERMINAL_ENABLE = no # RAW_ENABLE = yes # Raw HID has not yet been implemented for this keyboard # COMBO_ENABLE # Key combo feature # LEADER_ENABLE # Enable leader key chording diff --git a/keyboards/mlego/m48/keymaps/default/keymap.c b/keyboards/mlego/m48/keymaps/default/keymap.c index 5eb40a332a..175f42b9b9 100644 --- a/keyboards/mlego/m48/keymaps/default/keymap.c +++ b/keyboards/mlego/m48/keymaps/default/keymap.c @@ -106,10 +106,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_ADJ] = LAYOUT_ortho_4x12( - _______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , - _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______, - _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL, + _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______, + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) }; diff --git a/keyboards/planck/keymaps/ariccb/config.h b/keyboards/planck/keymaps/ariccb/config.h index 322aa9277f..464a8cd5db 100644 --- a/keyboards/planck/keymaps/ariccb/config.h +++ b/keyboards/planck/keymaps/ariccb/config.h @@ -40,6 +40,7 @@ //#define MIDI_ADVANCED #define TAPPING_TERM 150 +#define TAPPING_TERM_PER_KEY #define IGNORE_MOD_TAP_INTERRUPT // #define IGNORE_MOD_TAP_INTERRUPT // #define HOLD_ON_OTHER_KEY_PRESS diff --git a/keyboards/planck/keymaps/ariccb/keymap.c b/keyboards/planck/keymaps/ariccb/keymap.c index c0b4e490fa..33d0a26273 100644 --- a/keyboards/planck/keymaps/ariccb/keymap.c +++ b/keyboards/planck/keymaps/ariccb/keymap.c @@ -379,9 +379,18 @@ void usl_reset(qk_tap_dance_state_t *state, void *user_data) { // Associate our tap dance key with its functionality qk_tap_dance_action_t tap_dance_actions[] = { - [UNDS_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, usl_finished, usl_reset, 175) + [UNDS_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, usl_finished, usl_reset) }; +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(UNDS_LOWER): + return 175; + default: + return TAPPING_TERM; + } +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_select_word(keycode, record, SELWORD)) { return false; } if (!process_caps_word(keycode, record)) { return false; } @@ -661,4 +670,4 @@ void process_combo_event(uint16_t combo_index, bool pressed) { } break; } -}
\ No newline at end of file +} diff --git a/keyboards/planck/keymaps/default/keymap.c b/keyboards/planck/keymaps/default/keymap.c index 3453d41746..8041e0bada 100644 --- a/keyboards/planck/keymaps/default/keymap.c +++ b/keyboards/planck/keymaps/default/keymap.c @@ -165,7 +165,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = LAYOUT_planck_grid( _______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, - _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) diff --git a/keyboards/planck/keymaps/roguepullrequest/rules.mk b/keyboards/planck/keymaps/roguepullrequest/rules.mk index 9394c96e5b..5eb053e886 100644 --- a/keyboards/planck/keymaps/roguepullrequest/rules.mk +++ b/keyboards/planck/keymaps/roguepullrequest/rules.mk @@ -1,4 +1,3 @@ AUDIO_ENABLE = yes COMMAND_ENABLE = no -TERMINAL_ENABLE = no TAP_DANCE_ENABLE = yes diff --git a/keyboards/planck/keymaps/rootiest/config.h b/keyboards/planck/keymaps/rootiest/config.h index fc1fc81761..5bb5a73a29 100644 --- a/keyboards/planck/keymaps/rootiest/config.h +++ b/keyboards/planck/keymaps/rootiest/config.h @@ -87,6 +87,7 @@ /* * TAP-DANCE options */ +#define TAPPING_TERM_PER_KEY // Control Tap-Dance time individually by key #define TAPPING_TERM 250 // Default time allowed before resetting a Tap-Dance combo #define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped once again. */ #define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */ diff --git a/keyboards/planck/keymaps/rootiest/keymap.c b/keyboards/planck/keymaps/rootiest/keymap.c index 634bf2829e..857d7a9e21 100644 --- a/keyboards/planck/keymaps/rootiest/keymap.c +++ b/keyboards/planck/keymaps/rootiest/keymap.c @@ -1656,13 +1656,26 @@ void sml_reset(qk_tap_dance_state_t* state, void* user_data) { sml_state.state = // Tap Dance definitions qk_tap_dance_action_t tap_dance_actions[] = { // Tap once for °, twice for ℉, thrice for ℃ - [TD_DEG_DEGF] = ACTION_TAP_DANCE_FN(send_degree_symbol), // - [TD_LSHFT_CAPS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, scap_finished, scap_reset, 200), // - [TD_LCTL_STICKY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, slctl_finished, slctl_reset, 200), // - [TD_LALT_STICKY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, slalt_finished, slalt_reset, 200), // - [TD_SMILEY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, sml_finished, sml_reset, 500), + [TD_DEG_DEGF] = ACTION_TAP_DANCE_FN(send_degree_symbol), // + [TD_LSHFT_CAPS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, scap_finished, scap_reset), // + [TD_LCTL_STICKY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, slctl_finished, slctl_reset), // + [TD_LALT_STICKY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, slalt_finished, slalt_reset), // + [TD_SMILEY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, sml_finished, sml_reset), }; +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_LSHFT_CAPS): + case TD(TD_LCTL_STICKY): + case TD(TD_LALT_STICKY): + return 200; + case TD(TD_SMILEY): + return 500; + default: + return TAPPING_TERM; + } +} + // Dip-Switch controls void dip_switch_update_user(uint8_t index, bool active) { switch (index) { diff --git a/keyboards/planck/keymaps/rootiest/rules.mk b/keyboards/planck/keymaps/rootiest/rules.mk index b669d8bb7d..ca0f90b6e9 100644 --- a/keyboards/planck/keymaps/rootiest/rules.mk +++ b/keyboards/planck/keymaps/rootiest/rules.mk @@ -20,8 +20,5 @@ KEY_LOCK_ENABLE = yes # Enables using lock key to maintain holds # SWAP_HANDS_ENABLE = yes # Enables the swap hands function # DEBOUNCE_TYPE = sym_eager_pk # Change debounce algorithm -# NOTE: The following requires a lot of memory to include -TERMINAL_ENABLE = yes # Enables a command-line-like interface designed to communicate through a text editor with keystrokes - # NOTE: The following is not yet available in main qmk branch KEY_OVERRIDE_ENABLE = yes # Allows overiding modifier combos (change Shift+1 without affecting 1 or Shift's normal operation) diff --git a/keyboards/planck/keymaps/synth_sample/keymap.c b/keyboards/planck/keymaps/synth_sample/keymap.c index 0a57b7ce9a..124c01cb05 100644 --- a/keyboards/planck/keymaps/synth_sample/keymap.c +++ b/keyboards/planck/keymaps/synth_sample/keymap.c @@ -160,10 +160,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_ADJUST] = LAYOUT_planck_grid( - _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , - _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, - _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , + _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) }; diff --git a/keyboards/planck/keymaps/synth_wavetable/keymap.c b/keyboards/planck/keymaps/synth_wavetable/keymap.c index d413d63896..a5c5491ebd 100644 --- a/keyboards/planck/keymaps/synth_wavetable/keymap.c +++ b/keyboards/planck/keymaps/synth_wavetable/keymap.c @@ -160,10 +160,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_ADJUST] = LAYOUT_planck_grid( - _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , - _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, - _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , + _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) }; diff --git a/keyboards/ploopyco/mouse/keymaps/drashna/config.h b/keyboards/ploopyco/mouse/keymaps/drashna/config.h index 9aa9a40769..1dc1b7695f 100644 --- a/keyboards/ploopyco/mouse/keymaps/drashna/config.h +++ b/keyboards/ploopyco/mouse/keymaps/drashna/config.h @@ -28,4 +28,4 @@ #define RGBLIGHT_EFFECT_TWINKLE #define RGBLIGHT_SLEEP -#define MOUSE_EXT_REPORT +#define MOUSE_EXTENDED_REPORT diff --git a/keyboards/preonic/keymaps/default/keymap.c b/keyboards/preonic/keymaps/default/keymap.c index ef7614393d..c1faf464d6 100644 --- a/keyboards/preonic/keymaps/default/keymap.c +++ b/keyboards/preonic/keymaps/default/keymap.c @@ -157,7 +157,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_ADJUST] = LAYOUT_preonic_grid( KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, - _______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL, + _______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ diff --git a/keyboards/salicylic_acid3/7skb/keymaps/salicylic/keymap.c b/keyboards/salicylic_acid3/7skb/keymaps/salicylic/keymap.c index 4e1f2acd05..7221f8c612 100644 --- a/keyboards/salicylic_acid3/7skb/keymaps/salicylic/keymap.c +++ b/keyboards/salicylic_acid3/7skb/keymaps/salicylic/keymap.c @@ -32,8 +32,8 @@ enum tapdances{ }; qk_tap_dance_action_t tap_dance_actions[] = { - [TD_ESFL] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _FLOCK), - [TD_ESQW] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY), + [TD_ESFL] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _FLOCK), + [TD_ESQW] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY), }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/salicylic_acid3/7splus/keymaps/salicylic/keymap.c b/keyboards/salicylic_acid3/7splus/keymaps/salicylic/keymap.c index 06d7972a2e..bea5978c50 100644 --- a/keyboards/salicylic_acid3/7splus/keymaps/salicylic/keymap.c +++ b/keyboards/salicylic_acid3/7splus/keymaps/salicylic/keymap.c @@ -39,8 +39,8 @@ enum tapdances{ }; qk_tap_dance_action_t tap_dance_actions[] = { - [TD_ESMS] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _MOUSE), - [TD_ESAR] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY), + [TD_ESMS] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _MOUSE), + [TD_ESAR] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY), }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/salicylic_acid3/jisplit89/keymaps/salicylic/keymap.c b/keyboards/salicylic_acid3/jisplit89/keymaps/salicylic/keymap.c index 4e8addf6b7..eba01d4d65 100644 --- a/keyboards/salicylic_acid3/jisplit89/keymaps/salicylic/keymap.c +++ b/keyboards/salicylic_acid3/jisplit89/keymaps/salicylic/keymap.c @@ -39,8 +39,8 @@ enum tapdances{ }; qk_tap_dance_action_t tap_dance_actions[] = { - [TD_ESMS] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _MOUSE), - [TD_ESAR] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY), + [TD_ESMS] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _MOUSE), + [TD_ESAR] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY), }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/salicylic_acid3/naked60/keymaps/salicylic/keymap.c b/keyboards/salicylic_acid3/naked60/keymaps/salicylic/keymap.c index 8a2dbf051f..b70e68da54 100644 --- a/keyboards/salicylic_acid3/naked60/keymaps/salicylic/keymap.c +++ b/keyboards/salicylic_acid3/naked60/keymaps/salicylic/keymap.c @@ -23,8 +23,8 @@ enum tapdances{ }; qk_tap_dance_action_t tap_dance_actions[] = { - [TD_ESFL] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _FLOCK), - [TD_ESQW] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY), + [TD_ESFL] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _FLOCK), + [TD_ESQW] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY), }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/salicylic_acid3/naked60/keymaps/salicylic_with_nafuda/keymap.c b/keyboards/salicylic_acid3/naked60/keymaps/salicylic_with_nafuda/keymap.c index 4201d79a2e..c43803be35 100644 --- a/keyboards/salicylic_acid3/naked60/keymaps/salicylic_with_nafuda/keymap.c +++ b/keyboards/salicylic_acid3/naked60/keymaps/salicylic_with_nafuda/keymap.c @@ -34,8 +34,8 @@ enum tapdances{ }; qk_tap_dance_action_t tap_dance_actions[] = { - [TD_ESFL] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _FLOCK), - [TD_ESQW] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY), + [TD_ESFL] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _FLOCK), + [TD_ESQW] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY), }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/salicylic_acid3/naked60/keymaps/salicylic_with_setta21/keymap.c b/keyboards/salicylic_acid3/naked60/keymaps/salicylic_with_setta21/keymap.c index 23786da915..6dd2ef8863 100644 --- a/keyboards/salicylic_acid3/naked60/keymaps/salicylic_with_setta21/keymap.c +++ b/keyboards/salicylic_acid3/naked60/keymaps/salicylic_with_setta21/keymap.c @@ -32,8 +32,8 @@ enum tapdances{ }; qk_tap_dance_action_t tap_dance_actions[] = { - [TD_ESFL] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _FLOCK), - [TD_ESQW] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY), + [TD_ESFL] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _FLOCK), + [TD_ESQW] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY), }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/salicylic_acid3/naked64/keymaps/salicylic/keymap.c b/keyboards/salicylic_acid3/naked64/keymaps/salicylic/keymap.c index db46075c8f..ae7843341a 100644 --- a/keyboards/salicylic_acid3/naked64/keymaps/salicylic/keymap.c +++ b/keyboards/salicylic_acid3/naked64/keymaps/salicylic/keymap.c @@ -33,8 +33,8 @@ enum tapdances{ }; qk_tap_dance_action_t tap_dance_actions[] = { - [TD_ESFL] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _FLOCK), - [TD_ESQW] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY), + [TD_ESFL] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _FLOCK), + [TD_ESQW] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY), }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/salicylic_acid3/naked64/keymaps/salicylic_with_setta21/keymap.c b/keyboards/salicylic_acid3/naked64/keymaps/salicylic_with_setta21/keymap.c index c91716cdd4..6e2dd0886f 100644 --- a/keyboards/salicylic_acid3/naked64/keymaps/salicylic_with_setta21/keymap.c +++ b/keyboards/salicylic_acid3/naked64/keymaps/salicylic_with_setta21/keymap.c @@ -38,8 +38,8 @@ enum tapdances{ }; qk_tap_dance_action_t tap_dance_actions[] = { - [TD_ESFL] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _FLOCK), - [TD_ESQW] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY), + [TD_ESFL] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _FLOCK), + [TD_ESQW] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY), }; #define LOWER MO(_LOWER) diff --git a/keyboards/splitkb/kyria/keymaps/j-inc/rules.mk b/keyboards/splitkb/kyria/keymaps/j-inc/rules.mk index 000c995025..ee07f52ff1 100644 --- a/keyboards/splitkb/kyria/keymaps/j-inc/rules.mk +++ b/keyboards/splitkb/kyria/keymaps/j-inc/rules.mk @@ -9,7 +9,6 @@ MOUSEKEY_ENABLE = no TAP_DANCE_ENABLE = no STENO_ENABLE = no BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite -TERMINAL_ENABLE = no GRAVE_ESC_ENABLE = no MAGIC_ENABLE = no SPACE_CADET_ENABLE = no diff --git a/keyboards/thevankeyboards/minivan/keymaps/belak/keymap.c b/keyboards/thevankeyboards/minivan/keymaps/belak/keymap.c index 437b1881a4..0ed709747a 100644 --- a/keyboards/thevankeyboards/minivan/keymaps/belak/keymap.c +++ b/keyboards/thevankeyboards/minivan/keymaps/belak/keymap.c @@ -22,6 +22,9 @@ #define TD_LCTL TD(BE_TD_CTL) #define TD_LALT TD(BE_TD_ALT) +#define ACTION_TAP_DANCE_MOD_TAP(mod) \ + { .fn = {mod_tap_fn, NULL, mod_reset_fn}, .user_data = (void *)&((uint8_t){mod}), } + enum belak_td { BE_TD_GUI = 0, BE_TD_CTL, @@ -32,15 +35,9 @@ void mod_tap_fn(qk_tap_dance_state_t *state, void *user_data); void mod_reset_fn(qk_tap_dance_state_t *state, void *user_data); qk_tap_dance_action_t tap_dance_actions[] = { - [BE_TD_GUI] = ACTION_TAP_DANCE_FN_ADVANCED(mod_tap_fn, NULL, mod_reset_fn), - [BE_TD_CTL] = ACTION_TAP_DANCE_FN_ADVANCED(mod_tap_fn, NULL, mod_reset_fn), - [BE_TD_ALT] = ACTION_TAP_DANCE_FN_ADVANCED(mod_tap_fn, NULL, mod_reset_fn), -}; - -uint16_t tap_dance_keys[] = { - [BE_TD_GUI] = KC_LGUI, - [BE_TD_CTL] = KC_LCTL, - [BE_TD_ALT] = KC_LALT, + [BE_TD_GUI] = ACTION_TAP_DANCE_MOD_TAP(KC_LGUI), + [BE_TD_CTL] = ACTION_TAP_DANCE_MOD_TAP(KC_LCTL), + [BE_TD_ALT] = ACTION_TAP_DANCE_MOD_TAP(KC_LALT), }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -74,7 +71,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void mod_tap_fn(qk_tap_dance_state_t *state, void *user_data) { switch (state->count) { case 1: - register_mods(MOD_BIT(tap_dance_keys[state->keycode - QK_TAP_DANCE])); + uint8_t *mod = (uint8_t *)user_data; + register_mods(MOD_BIT(*mod)); send_keyboard_report(); break; case 2: @@ -90,8 +88,9 @@ void mod_tap_fn(qk_tap_dance_state_t *state, void *user_data) { } void mod_reset_fn(qk_tap_dance_state_t *state, void *user_data) { + uint8_t *mod = (uint8_t *)user_data; layer_off(_L1); layer_off(_L2); - unregister_mods(MOD_BIT(tap_dance_keys[state->keycode - QK_TAP_DANCE])); + unregister_mods(MOD_BIT(*mod)); send_keyboard_report(); } diff --git a/keyboards/work_louder/work_board/keymaps/default/keymap.c b/keyboards/work_louder/work_board/keymaps/default/keymap.c index 59bb437d9d..cae65ff5c2 100644 --- a/keyboards/work_louder/work_board/keymaps/default/keymap.c +++ b/keyboards/work_louder/work_board/keymaps/default/keymap.c @@ -144,9 +144,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_ADJUST] = LAYOUT( - _______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , _______, - _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, - _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, + _______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , _______, + _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) diff --git a/lib/lufa b/lib/lufa -Subproject 19a5d533f02a7b46eeadca99cc9699659cef7a6 +Subproject 35cc3d92f557bc8874ca602d2f22642d77cfe12 diff --git a/lib/python/qmk/cli/doctor/macos.py b/lib/python/qmk/cli/doctor/macos.py index 00fb272858..5d088c9492 100644 --- a/lib/python/qmk/cli/doctor/macos.py +++ b/lib/python/qmk/cli/doctor/macos.py @@ -8,6 +8,6 @@ from .check import CheckStatus def os_test_macos(): """Run the Mac specific tests. """ - cli.log.info("Detected {fg_cyan}macOS %s{fg_reset}.", platform.mac_ver()[0]) + cli.log.info("Detected {fg_cyan}macOS %s (%s){fg_reset}.", platform.mac_ver()[0], 'Apple Silicon' if platform.processor() == 'arm' else 'Intel') return CheckStatus.OK diff --git a/lib/python/qmk/cli/flash.py b/lib/python/qmk/cli/flash.py index 216896b974..ebe739c50e 100644 --- a/lib/python/qmk/cli/flash.py +++ b/lib/python/qmk/cli/flash.py @@ -33,6 +33,8 @@ def print_bootloader_help(): cli.echo('\tdfu-split-right') cli.echo('\tdfu-util-split-left') cli.echo('\tdfu-util-split-right') + cli.echo('\tuf2-split-left') + cli.echo('\tuf2-split-right') cli.echo('For more info, visit https://docs.qmk.fm/#/flashing') diff --git a/platforms/arm_atsam/platform.mk b/platforms/arm_atsam/platform.mk index b49bf764d7..9618838dc3 100644 --- a/platforms/arm_atsam/platform.mk +++ b/platforms/arm_atsam/platform.mk @@ -30,7 +30,7 @@ COMPILEFLAGS += -mthumb CFLAGS += $(COMPILEFLAGS) CXXFLAGS += $(COMPILEFLAGS) -CXXFLAGS += -fno-exceptions -std=c++11 +CXXFLAGS += -fno-exceptions $(CXXSTANDARD) LDFLAGS +=-Wl,--gc-sections LDFLAGS += -Wl,-Map="%OUT%%PROJ_NAME%.map" diff --git a/platforms/avr/drivers/ps2/ps2_usart.c b/platforms/avr/drivers/ps2/ps2_usart.c index 39ec930d4a..581badac64 100644 --- a/platforms/avr/drivers/ps2/ps2_usart.c +++ b/platforms/avr/drivers/ps2/ps2_usart.c @@ -72,8 +72,8 @@ uint8_t ps2_error = PS2_ERR_NONE; static inline uint8_t pbuf_dequeue(void); static inline void pbuf_enqueue(uint8_t data); -static inline bool pbuf_has_data(void); static inline void pbuf_clear(void); +bool pbuf_has_data(void); void ps2_host_init(void) { idle(); // without this many USART errors occur when cable is disconnected @@ -212,7 +212,7 @@ static inline uint8_t pbuf_dequeue(void) { return val; } -static inline bool pbuf_has_data(void) { +bool pbuf_has_data(void) { uint8_t sreg = SREG; cli(); bool has_data = (pbuf_head != pbuf_tail); diff --git a/platforms/avr/platform.mk b/platforms/avr/platform.mk index 978199b385..b51a94c93a 100644 --- a/platforms/avr/platform.mk +++ b/platforms/avr/platform.mk @@ -38,7 +38,7 @@ CFLAGS += -fno-inline-small-functions CFLAGS += -fno-strict-aliasing CXXFLAGS += $(COMPILEFLAGS) -CXXFLAGS += -fno-exceptions -std=c++11 +CXXFLAGS += -fno-exceptions $(CXXSTANDARD) LDFLAGS += -Wl,--gc-sections diff --git a/platforms/chibios/bootloaders/stm32_dfu.c b/platforms/chibios/bootloaders/stm32_dfu.c index ff866bd2bc..7b4ab86033 100644 --- a/platforms/chibios/bootloaders/stm32_dfu.c +++ b/platforms/chibios/bootloaders/stm32_dfu.c @@ -38,7 +38,7 @@ extern uint32_t __ram0_end__; # endif # ifndef STM32_BOOTLOADER_DUAL_BANK_DELAY -# define STM32_BOOTLOADER_DUAL_BANK_DELAY 100000 +# define STM32_BOOTLOADER_DUAL_BANK_DELAY 100 # endif __attribute__((weak)) void bootloader_jump(void) { @@ -55,7 +55,7 @@ __attribute__((weak)) void bootloader_jump(void) { # endif // Wait for a while for the capacitor to charge - wait_ms(100); + wait_ms(STM32_BOOTLOADER_DUAL_BANK_DELAY); // Issue a system reset to get the ROM bootloader to execute, with BOOT0 high NVIC_SystemReset(); diff --git a/platforms/chibios/eeprom_stm32.c b/platforms/chibios/drivers/eeprom/eeprom_stm32.c index a15bfe09ed..a15bfe09ed 100644 --- a/platforms/chibios/eeprom_stm32.c +++ b/platforms/chibios/drivers/eeprom/eeprom_stm32.c diff --git a/platforms/chibios/eeprom_stm32.h b/platforms/chibios/drivers/eeprom/eeprom_stm32.h index 8fcfb556b8..8fcfb556b8 100644 --- a/platforms/chibios/eeprom_stm32.h +++ b/platforms/chibios/drivers/eeprom/eeprom_stm32.h diff --git a/platforms/chibios/eeprom_stm32_defs.h b/platforms/chibios/drivers/eeprom/eeprom_stm32_defs.h index 57d0440330..57d0440330 100644 --- a/platforms/chibios/eeprom_stm32_defs.h +++ b/platforms/chibios/drivers/eeprom/eeprom_stm32_defs.h diff --git a/platforms/chibios/eeprom_teensy.c b/platforms/chibios/drivers/eeprom/eeprom_teensy.c index c8777febde..c8777febde 100644 --- a/platforms/chibios/eeprom_teensy.c +++ b/platforms/chibios/drivers/eeprom/eeprom_teensy.c diff --git a/platforms/chibios/eeprom_teensy.h b/platforms/chibios/drivers/eeprom/eeprom_teensy.h index 9a14a1fa79..9a14a1fa79 100755 --- a/platforms/chibios/eeprom_teensy.h +++ b/platforms/chibios/drivers/eeprom/eeprom_teensy.h diff --git a/platforms/chibios/flash_stm32.c b/platforms/chibios/drivers/flash/flash_stm32.c index 72c41b8b78..72c41b8b78 100644 --- a/platforms/chibios/flash_stm32.c +++ b/platforms/chibios/drivers/flash/flash_stm32.c diff --git a/platforms/chibios/flash_stm32.h b/platforms/chibios/drivers/flash/flash_stm32.h index 6c66642ec5..6c66642ec5 100644 --- a/platforms/chibios/flash_stm32.h +++ b/platforms/chibios/drivers/flash/flash_stm32.h diff --git a/platforms/chibios/flash.mk b/platforms/chibios/flash.mk index a91ef2cf35..86bbc22943 100644 --- a/platforms/chibios/flash.mk +++ b/platforms/chibios/flash.mk @@ -54,11 +54,11 @@ endef # TODO: Remove once ARM has a way to configure EECONFIG_HANDEDNESS # within the emulated eeprom via dfu-util or another tool -ifneq (,$(filter $(MAKECMDGOALS),dfu-util-split-left)) +ifneq (,$(filter $(MAKECMDGOALS), dfu-util-split-left uf2-split-left)) OPT_DEFS += -DINIT_EE_HANDS_LEFT endif -ifneq (,$(filter $(MAKECMDGOALS),dfu-util-split-right)) +ifneq (,$(filter $(MAKECMDGOALS), dfu-util-split-right uf2-split-right)) OPT_DEFS += -DINIT_EE_HANDS_RIGHT endif @@ -66,6 +66,10 @@ dfu-util-split-left: dfu-util dfu-util-split-right: dfu-util +uf2-split-left: flash + +uf2-split-right: flash + ST_LINK_CLI ?= st-link_cli ST_LINK_ARGS ?= diff --git a/platforms/test/platform.mk b/platforms/test/platform.mk index eb2424ec5c..f07c863e69 100644 --- a/platforms/test/platform.mk +++ b/platforms/test/platform.mk @@ -31,4 +31,4 @@ CFLAGS += -fno-strict-aliasing CXXFLAGS += $(COMPILEFLAGS) CXXFLAGS += -fno-exceptions -CXXFLAGS += -std=gnu++11 +CXXFLAGS += $(CXXSTANDARD) diff --git a/platforms/test/rules.mk b/platforms/test/rules.mk index 55512c7392..a2baa283d0 100644 --- a/platforms/test/rules.mk +++ b/platforms/test/rules.mk @@ -11,7 +11,8 @@ eeprom_stm32_large_DEFS := $(eeprom_stm32_DEFS) \ -DFEE_PAGE_COUNT=16 eeprom_stm32_INC := \ - $(PLATFORM_PATH)/chibios/ + $(PLATFORM_PATH)/chibios/drivers/eeprom/ \ + $(PLATFORM_PATH)/chibios/drivers/flash/ eeprom_stm32_tiny_INC := $(eeprom_stm32_INC) eeprom_stm32_large_INC := $(eeprom_stm32_INC) @@ -19,6 +20,6 @@ eeprom_stm32_SRC := \ $(TOP_DIR)/drivers/eeprom/eeprom_driver.c \ $(PLATFORM_PATH)/$(PLATFORM_KEY)/eeprom_stm32_tests.cpp \ $(PLATFORM_PATH)/$(PLATFORM_KEY)/flash_stm32_mock.c \ - $(PLATFORM_PATH)/chibios/eeprom_stm32.c + $(PLATFORM_PATH)/chibios/drivers/eeprom/eeprom_stm32.c eeprom_stm32_tiny_SRC := $(eeprom_stm32_SRC) eeprom_stm32_large_SRC := $(eeprom_stm32_SRC) diff --git a/quantum/action.c b/quantum/action.c index 4e81a5466f..83f6e2a970 100644 --- a/quantum/action.c +++ b/quantum/action.c @@ -844,7 +844,7 @@ __attribute__((weak)) void register_code(uint8_t code) { # endif add_key(KC_CAPS_LOCK); send_keyboard_report(); - wait_ms(100); + wait_ms(TAP_HOLD_CAPS_DELAY); del_key(KC_CAPS_LOCK); send_keyboard_report(); } diff --git a/quantum/keymap.h b/quantum/keymap.h index d64b271efb..081bc54ebe 100644 --- a/quantum/keymap.h +++ b/quantum/keymap.h @@ -55,3 +55,5 @@ extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; // Ensure we have a forward declaration for the encoder map # include "encoder.h" #endif + +#include "keymap_introspection.h" diff --git a/quantum/keymap_introspection.c b/quantum/keymap_introspection.c new file mode 100644 index 0000000000..9628b41eef --- /dev/null +++ b/quantum/keymap_introspection.c @@ -0,0 +1,25 @@ +// Copyright 2022 Nick Brassel (@tzarc) +// SPDX-License-Identifier: GPL-2.0-or-later + +// Pull the actual keymap code so that we can inspect stuff from it +#include KEYMAP_C + +#include "keymap_introspection.h" + +#define NUM_KEYMAP_LAYERS ((uint8_t)(sizeof(keymaps) / ((MATRIX_ROWS) * (MATRIX_COLS) * sizeof(uint16_t)))) + +uint8_t keymap_layer_count(void) { + return NUM_KEYMAP_LAYERS; +} + +#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) + +# define NUM_ENCODERMAP_LAYERS ((uint8_t)(sizeof(encoder_map) / ((NUM_ENCODERS) * (2) * sizeof(uint16_t)))) + +uint8_t encodermap_layer_count(void) { + return NUM_ENCODERMAP_LAYERS; +} + +_Static_assert(NUM_KEYMAP_LAYERS == NUM_ENCODERMAP_LAYERS, "Number of encoder_map layers doesn't match the number of keymap layers"); + +#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) diff --git a/quantum/keymap_introspection.h b/quantum/keymap_introspection.h new file mode 100644 index 0000000000..23f6f2016f --- /dev/null +++ b/quantum/keymap_introspection.h @@ -0,0 +1,15 @@ +// Copyright 2022 Nick Brassel (@tzarc) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#include <stdint.h> + +// Get the number of layers defined in the keymap +uint8_t keymap_layer_count(void); + +#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) + +// Get the number of layers defined in the encoder map +uint8_t encodermap_layer_count(void); + +#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) diff --git a/quantum/pointing_device.c b/quantum/pointing_device.c index a160647890..3c2e2bc09d 100644 --- a/quantum/pointing_device.c +++ b/quantum/pointing_device.c @@ -177,7 +177,8 @@ __attribute__((weak)) void pointing_device_send(void) { report_mouse_t pointing_device_adjust_by_defines(report_mouse_t mouse_report) { // Support rotation of the sensor data #if defined(POINTING_DEVICE_ROTATION_90) || defined(POINTING_DEVICE_ROTATION_180) || defined(POINTING_DEVICE_ROTATION_270) - int8_t x = mouse_report.x, y = mouse_report.y; + mouse_xy_report_t x = mouse_report.x; + mouse_xy_report_t y = mouse_report.y; # if defined(POINTING_DEVICE_ROTATION_90) mouse_report.x = y; mouse_report.y = -x; @@ -347,7 +348,7 @@ void pointing_device_set_cpi_on_side(bool left, uint16_t cpi) { * @param[in] int16_t value * @return int8_t clamped value */ -static inline int8_t pointing_device_movement_clamp(int16_t value) { +static inline int8_t pointing_device_hv_clamp(int16_t value) { if (value < INT8_MIN) { return INT8_MIN; } else if (value > INT8_MAX) { @@ -358,6 +359,21 @@ static inline int8_t pointing_device_movement_clamp(int16_t value) { } /** + * @brief clamps int16_t to int8_t + * + * @param[in] clamp_range_t value + * @return mouse_xy_report_t clamped value + */ +static inline mouse_xy_report_t pointing_device_xy_clamp(clamp_range_t value) { + if (value < XY_REPORT_MIN) { + return XY_REPORT_MIN; + } else if (value > XY_REPORT_MAX) { + return XY_REPORT_MAX; + } else { + return value; + } +} +/** * @brief combines 2 mouse reports and returns 2 * * Combines 2 report_mouse_t structs, clamping movement values to int8_t and ignores report_id then returns the resulting report_mouse_t struct. @@ -369,10 +385,10 @@ static inline int8_t pointing_device_movement_clamp(int16_t value) { * @return combined report_mouse_t of left_report and right_report */ report_mouse_t pointing_device_combine_reports(report_mouse_t left_report, report_mouse_t right_report) { - left_report.x = pointing_device_movement_clamp((int16_t)left_report.x + right_report.x); - left_report.y = pointing_device_movement_clamp((int16_t)left_report.y + right_report.y); - left_report.h = pointing_device_movement_clamp((int16_t)left_report.h + right_report.h); - left_report.v = pointing_device_movement_clamp((int16_t)left_report.v + right_report.v); + left_report.x = pointing_device_xy_clamp((clamp_range_t)left_report.x + right_report.x); + left_report.y = pointing_device_xy_clamp((clamp_range_t)left_report.y + right_report.y); + left_report.h = pointing_device_hv_clamp((int16_t)left_report.h + right_report.h); + left_report.v = pointing_device_hv_clamp((int16_t)left_report.v + right_report.v); left_report.buttons |= right_report.buttons; return left_report; } @@ -390,7 +406,8 @@ report_mouse_t pointing_device_combine_reports(report_mouse_t left_report, repor report_mouse_t pointing_device_adjust_by_defines_right(report_mouse_t mouse_report) { // Support rotation of the sensor data # if defined(POINTING_DEVICE_ROTATION_90_RIGHT) || defined(POINTING_DEVICE_ROTATION_RIGHT) || defined(POINTING_DEVICE_ROTATION_RIGHT) - int8_t x = mouse_report.x, y = mouse_report.y; + mouse_xy_report_t x = mouse_report.x; + mouse_xy_report_t y = mouse_report.y; # if defined(POINTING_DEVICE_ROTATION_90_RIGHT) mouse_report.x = y; mouse_report.y = -x; diff --git a/quantum/pointing_device.h b/quantum/pointing_device.h index 5c0eaeaf34..1e5ef9590c 100644 --- a/quantum/pointing_device.h +++ b/quantum/pointing_device.h @@ -75,6 +75,16 @@ typedef enum { POINTING_DEVICE_BUTTON8, } pointing_device_buttons_t; +#ifdef MOUSE_EXTENDED_REPORT +# define XY_REPORT_MIN INT16_MIN +# define XY_REPORT_MAX INT16_MAX +typedef int32_t clamp_range_t; +#else +# define XY_REPORT_MIN INT8_MIN +# define XY_REPORT_MAX INT8_MAX +typedef int16_t clamp_range_t; +#endif + void pointing_device_init(void); void pointing_device_task(void); void pointing_device_send(void); diff --git a/quantum/pointing_device_drivers.c b/quantum/pointing_device_drivers.c index 56363c7ac6..41d7018c86 100644 --- a/quantum/pointing_device_drivers.c +++ b/quantum/pointing_device_drivers.c @@ -22,8 +22,8 @@ #include "timer.h" #include <stddef.h> -// hid mouse reports cannot exceed -127 to 127, so constrain to that value -#define constrain_hid(amt) ((amt) < -127 ? -127 : ((amt) > 127 ? 127 : (amt))) +#define CONSTRAIN_HID(amt) ((amt) < INT8_MIN ? INT8_MIN : ((amt) > INT8_MAX ? INT8_MAX : (amt))) +#define CONSTRAIN_HID_XY(amt) ((amt) < XY_REPORT_MIN ? XY_REPORT_MIN : ((amt) > XY_REPORT_MAX ? XY_REPORT_MAX : (amt))) // get_report functions should probably be moved to their respective drivers. #if defined(POINTING_DEVICE_DRIVER_adns5050) @@ -35,8 +35,8 @@ report_mouse_t adns5050_get_report(report_mouse_t mouse_report) { if (debug_mouse) dprintf("Raw ] X: %d, Y: %d\n", data.dx, data.dy); # endif - mouse_report.x = data.dx; - mouse_report.y = data.dy; + mouse_report.x = (mouse_xy_report_t)data.dx; + mouse_report.y = (mouse_xy_report_t)data.dy; } return mouse_report; @@ -55,11 +55,8 @@ const pointing_device_driver_t pointing_device_driver = { report_mouse_t adns9800_get_report_driver(report_mouse_t mouse_report) { report_adns9800_t sensor_report = adns9800_get_report(); - int8_t clamped_x = constrain_hid(sensor_report.x); - int8_t clamped_y = constrain_hid(sensor_report.y); - - mouse_report.x = clamped_x; - mouse_report.y = clamped_y; + mouse_report.x = CONSTRAIN_HID_XY(sensor_report.x); + mouse_report.y = CONSTRAIN_HID_XY(sensor_report.y); return mouse_report; } @@ -107,16 +104,16 @@ const pointing_device_driver_t pointing_device_driver = { # endif report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) { - pinnacle_data_t touchData = cirque_pinnacle_read_data(); - static uint16_t x = 0, y = 0, mouse_timer = 0; - int8_t report_x = 0, report_y = 0; - static bool is_z_down = false; + pinnacle_data_t touchData = cirque_pinnacle_read_data(); + static uint16_t x = 0, y = 0, mouse_timer = 0; + mouse_xy_report_t report_x = 0, report_y = 0; + static bool is_z_down = false; cirque_pinnacle_scale_data(&touchData, cirque_pinnacle_get_scale(), cirque_pinnacle_get_scale()); // Scale coordinates to arbitrary X, Y resolution if (x && y && touchData.xValue && touchData.yValue) { - report_x = (int8_t)(touchData.xValue - x); - report_y = (int8_t)(touchData.yValue - y); + report_x = (mouse_xy_report_t)(touchData.xValue - x); + report_y = (mouse_xy_report_t)(touchData.yValue - y); } x = touchData.xValue; y = touchData.yValue; @@ -157,11 +154,26 @@ const pointing_device_driver_t pointing_device_driver = { // clang-format on #elif defined(POINTING_DEVICE_DRIVER_pimoroni_trackball) + +mouse_xy_report_t pimoroni_trackball_adapt_values(clamp_range_t* offset) { + if (*offset > XY_REPORT_MAX) { + *offset -= XY_REPORT_MAX; + return (mouse_xy_report_t)XY_REPORT_MAX; + } else if (*offset < XY_REPORT_MIN) { + *offset += XY_REPORT_MAX; + return (mouse_xy_report_t)XY_REPORT_MIN; + } else { + mouse_xy_report_t temp_return = *offset; + *offset = 0; + return temp_return; + } +} + report_mouse_t pimoroni_trackball_get_report(report_mouse_t mouse_report) { - static uint16_t debounce = 0; - static uint8_t error_count = 0; - pimoroni_data_t pimoroni_data = {0}; - static int16_t x_offset = 0, y_offset = 0; + static uint16_t debounce = 0; + static uint8_t error_count = 0; + pimoroni_data_t pimoroni_data = {0}; + static clamp_range_t x_offset = 0, y_offset = 0; if (error_count < PIMORONI_TRACKBALL_ERROR_COUNT) { i2c_status_t status = read_pimoroni_trackball(&pimoroni_data); @@ -174,8 +186,8 @@ report_mouse_t pimoroni_trackball_get_report(report_mouse_t mouse_report) { if (!debounce) { x_offset += pimoroni_trackball_get_offsets(pimoroni_data.right, pimoroni_data.left, PIMORONI_TRACKBALL_SCALE); y_offset += pimoroni_trackball_get_offsets(pimoroni_data.down, pimoroni_data.up, PIMORONI_TRACKBALL_SCALE); - pimoroni_trackball_adapt_values(&mouse_report.x, &x_offset); - pimoroni_trackball_adapt_values(&mouse_report.y, &y_offset); + mouse_report.x = pimoroni_trackball_adapt_values(&x_offset); + mouse_report.y = pimoroni_trackball_adapt_values(&y_offset); } else { debounce--; } @@ -221,8 +233,8 @@ report_mouse_t pmw3360_get_report(report_mouse_t mouse_report) { # endif MotionStart = timer_read(); } - mouse_report.x = constrain_hid(data.dx); - mouse_report.y = constrain_hid(data.dy); + mouse_report.x = CONSTRAIN_HID_XY(data.dx); + mouse_report.y = CONSTRAIN_HID_XY(data.dy); } return mouse_report; @@ -259,8 +271,8 @@ report_mouse_t pmw3389_get_report(report_mouse_t mouse_report) { # endif MotionStart = timer_read(); } - mouse_report.x = constrain_hid(data.dx); - mouse_report.y = constrain_hid(data.dy); + mouse_report.x = CONSTRAIN_HID_XY(data.dx); + mouse_report.y = CONSTRAIN_HID_XY(data.dy); } return mouse_report; diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index db8df5f870..3270a1b000 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -15,12 +15,8 @@ */ #include "quantum.h" -#ifndef NO_ACTION_ONESHOT -uint8_t get_oneshot_mods(void); -#endif - -static uint16_t last_td; -static int16_t highest_td = -1; +static uint16_t active_td; +static uint16_t last_tap_time; void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; @@ -34,18 +30,14 @@ void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data) void qk_tap_dance_pair_finished(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; - if (state->count == 1) { - register_code16(pair->kc1); - } else if (state->count == 2) { - register_code16(pair->kc2); - } + register_code16(pair->kc1); } void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; - wait_ms(TAP_CODE_DELAY); if (state->count == 1) { + wait_ms(TAP_CODE_DELAY); unregister_code16(pair->kc1); } else if (state->count == 2) { unregister_code16(pair->kc2); @@ -87,23 +79,40 @@ static inline void _process_tap_dance_action_fn(qk_tap_dance_state_t *state, voi } static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *action) { + action->state.count++; + action->state.weak_mods = get_mods(); + action->state.weak_mods |= get_weak_mods(); +#ifndef NO_ACTION_ONESHOT + action->state.oneshot_mods = get_oneshot_mods(); +#endif _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_each_tap); } -static inline void process_tap_dance_action_on_dance_finished(qk_tap_dance_action_t *action) { - if (action->state.finished) return; - action->state.finished = true; - add_mods(action->state.oneshot_mods); - add_weak_mods(action->state.weak_mods); - send_keyboard_report(); - _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_dance_finished); -} - static inline void process_tap_dance_action_on_reset(qk_tap_dance_action_t *action) { _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_reset); - del_mods(action->state.oneshot_mods); del_weak_mods(action->state.weak_mods); +#ifndef NO_ACTION_ONESHOT + del_mods(action->state.oneshot_mods); +#endif send_keyboard_report(); + action->state = (const qk_tap_dance_state_t){0}; +} + +static inline void process_tap_dance_action_on_dance_finished(qk_tap_dance_action_t *action) { + if (!action->state.finished) { + action->state.finished = true; + add_weak_mods(action->state.weak_mods); +#ifndef NO_ACTION_ONESHOT + add_mods(action->state.oneshot_mods); +#endif + send_keyboard_report(); + _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_dance_finished); + } + active_td = 0; + if (!action->state.pressed) { + // There will not be a key release event, so reset now. + process_tap_dance_action_on_reset(action); + } } void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) { @@ -111,51 +120,33 @@ void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) return; - if (highest_td == -1) return; - - for (int i = 0; i <= highest_td; i++) { - action = &tap_dance_actions[i]; - if (action->state.count) { - if (keycode == action->state.keycode && keycode == last_td) continue; - action->state.interrupted = true; - action->state.interrupting_keycode = keycode; - process_tap_dance_action_on_dance_finished(action); - reset_tap_dance(&action->state); - - // Tap dance actions can leave some weak mods active (e.g., if the tap dance is mapped to a keycode with - // modifiers), but these weak mods should not affect the keypress which interrupted the tap dance. - clear_weak_mods(); - } - } + if (!active_td || keycode == active_td) return; + + action = &tap_dance_actions[TD_INDEX(active_td)]; + action->state.interrupted = true; + action->state.interrupting_keycode = keycode; + process_tap_dance_action_on_dance_finished(action); + + // Tap dance actions can leave some weak mods active (e.g., if the tap dance is mapped to a keycode with + // modifiers), but these weak mods should not affect the keypress which interrupted the tap dance. + clear_weak_mods(); } bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { - uint16_t idx = keycode - QK_TAP_DANCE; qk_tap_dance_action_t *action; switch (keycode) { case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: - if ((int16_t)idx > highest_td) highest_td = idx; - action = &tap_dance_actions[idx]; + action = &tap_dance_actions[TD_INDEX(keycode)]; action->state.pressed = record->event.pressed; if (record->event.pressed) { - action->state.keycode = keycode; - action->state.count++; - action->state.timer = timer_read(); -#ifndef NO_ACTION_ONESHOT - action->state.oneshot_mods = get_oneshot_mods(); -#else - action->state.oneshot_mods = 0; -#endif - action->state.weak_mods = get_mods(); - action->state.weak_mods |= get_weak_mods(); + last_tap_time = timer_read(); process_tap_dance_action_on_each_tap(action); - - last_td = keycode; + active_td = action->state.finished ? 0 : keycode; } else { - if (action->state.count && action->state.finished) { - reset_tap_dance(&action->state); + if (action->state.finished) { + process_tap_dance_action_on_reset(action); } } @@ -166,35 +157,17 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { } void tap_dance_task() { - if (highest_td == -1) return; - uint16_t tap_user_defined; - - for (uint8_t i = 0; i <= highest_td; i++) { - qk_tap_dance_action_t *action = &tap_dance_actions[i]; - if (action->custom_tapping_term > 0) { - tap_user_defined = action->custom_tapping_term; - } else { - tap_user_defined = GET_TAPPING_TERM(action->state.keycode, &(keyrecord_t){}); - } - if (action->state.count && timer_elapsed(action->state.timer) > tap_user_defined) { - process_tap_dance_action_on_dance_finished(action); - reset_tap_dance(&action->state); - } - } -} - -void reset_tap_dance(qk_tap_dance_state_t *state) { qk_tap_dance_action_t *action; - if (state->pressed) return; + if (!active_td || timer_elapsed(last_tap_time) <= GET_TAPPING_TERM(active_td, &(keyrecord_t){})) return; - action = &tap_dance_actions[state->keycode - QK_TAP_DANCE]; - - process_tap_dance_action_on_reset(action); + action = &tap_dance_actions[TD_INDEX(active_td)]; + if (!action->state.interrupted) { + process_tap_dance_action_on_dance_finished(action); + } +} - state->count = 0; - state->interrupted = false; - state->finished = false; - state->interrupting_keycode = 0; - last_td = 0; +void reset_tap_dance(qk_tap_dance_state_t *state) { + active_td = 0; + process_tap_dance_action_on_reset((qk_tap_dance_action_t *)state); } diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index d9ffb1e73d..d97900d96b 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h @@ -22,30 +22,27 @@ # include <inttypes.h> typedef struct { + uint16_t interrupting_keycode; uint8_t count; - uint8_t oneshot_mods; uint8_t weak_mods; - uint16_t keycode; - uint16_t interrupting_keycode; - uint16_t timer; - bool interrupted; - bool pressed; - bool finished; +# ifndef NO_ACTION_ONESHOT + uint8_t oneshot_mods; +# endif + bool pressed : 1; + bool finished : 1; + bool interrupted : 1; } qk_tap_dance_state_t; -# define TD(n) (QK_TAP_DANCE | ((n)&0xFF)) - typedef void (*qk_tap_dance_user_fn_t)(qk_tap_dance_state_t *state, void *user_data); typedef struct { + qk_tap_dance_state_t state; struct { qk_tap_dance_user_fn_t on_each_tap; qk_tap_dance_user_fn_t on_dance_finished; qk_tap_dance_user_fn_t on_reset; } fn; - qk_tap_dance_state_t state; - uint16_t custom_tapping_term; - void * user_data; + void *user_data; } qk_tap_dance_action_t; typedef struct { @@ -62,31 +59,31 @@ typedef struct { # define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \ { .fn = {qk_tap_dance_pair_on_each_tap, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset}, .user_data = (void *)&((qk_tap_dance_pair_t){kc1, kc2}), } -# define ACTION_TAP_DANCE_DUAL_ROLE(kc, layer) \ +# define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) \ { .fn = {qk_tap_dance_dual_role_on_each_tap, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset}, .user_data = (void *)&((qk_tap_dance_dual_role_t){kc, layer, layer_move}), } # define ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer) \ { .fn = {NULL, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset}, .user_data = (void *)&((qk_tap_dance_dual_role_t){kc, layer, layer_invert}), } -# define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) ACTION_TAP_DANCE_DUAL_ROLE(kc, layer) - # define ACTION_TAP_DANCE_FN(user_fn) \ { .fn = {NULL, user_fn, NULL}, .user_data = NULL, } # define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) \ { .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset}, .user_data = NULL, } -# define ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) \ - { .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset}, .user_data = NULL, .custom_tapping_term = tap_specific_tapping_term, } +# define TD(n) (QK_TAP_DANCE | TD_INDEX(n)) +# define TD_INDEX(code) ((code)&0xFF) +# define TAP_DANCE_KEYCODE(state) TD(((qk_tap_dance_action_t *)state) - tap_dance_actions) extern qk_tap_dance_action_t tap_dance_actions[]; +void reset_tap_dance(qk_tap_dance_state_t *state); + /* To be used internally */ void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record); bool process_tap_dance(uint16_t keycode, keyrecord_t *record); void tap_dance_task(void); -void reset_tap_dance(qk_tap_dance_state_t *state); void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data); void qk_tap_dance_pair_finished(qk_tap_dance_state_t *state, void *user_data); diff --git a/quantum/process_keycode/process_terminal.c b/quantum/process_keycode/process_terminal.c deleted file mode 100644 index da1c4d506f..0000000000 --- a/quantum/process_keycode/process_terminal.c +++ /dev/null @@ -1,330 +0,0 @@ -/* Copyright 2017 Jack Humbert - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "process_terminal.h" -#include <string.h> -#include "version.h" -#include <stdio.h> -#include <math.h> - -#ifndef CMD_BUFF_SIZE -# define CMD_BUFF_SIZE 5 -#endif - -bool terminal_enabled = false; -char buffer[80] = ""; -char cmd_buffer[CMD_BUFF_SIZE][80]; -bool cmd_buffer_enabled = true; // replace with ifdef? -char newline[2] = "\n"; -char arguments[6][20]; -bool firstTime = true; - -short int current_cmd_buffer_pos = 0; // used for up/down arrows - keeps track of where you are in the command buffer - -__attribute__((weak)) const char terminal_prompt[8] = "> "; - -#ifdef AUDIO_ENABLE -# ifndef TERMINAL_SONG -# define TERMINAL_SONG SONG(TERMINAL_SOUND) -# endif -float terminal_song[][2] = TERMINAL_SONG; -# define TERMINAL_BELL() PLAY_SONG(terminal_song) -#else -# define TERMINAL_BELL() -#endif - -__attribute__((weak)) const char keycode_to_ascii_lut[58] = {0, 0, 0, 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0, 0, 0, '\t', ' ', '-', '=', '[', ']', '\\', 0, ';', '\'', '`', ',', '.', '/'}; - -__attribute__((weak)) const char shifted_keycode_to_ascii_lut[58] = {0, 0, 0, 0, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', 0, 0, 0, '\t', ' ', '_', '+', '{', '}', '|', 0, ':', '\'', '~', '<', '>', '?'}; - -struct stringcase { - char *string; - void (*func)(void); -} typedef stringcase; - -void enable_terminal(void) { - terminal_enabled = true; - strcpy(buffer, ""); - memset(cmd_buffer, 0, CMD_BUFF_SIZE * 80); - for (int i = 0; i < 6; i++) - strcpy(arguments[i], ""); - // select all text to start over - // SEND_STRING(SS_LCTL("a")); - send_string(terminal_prompt); -} - -void disable_terminal(void) { - terminal_enabled = false; - SEND_STRING("\n"); -} - -void push_to_cmd_buffer(void) { - if (cmd_buffer_enabled) { - if (cmd_buffer == NULL) { - return; - } else { - if (firstTime) { - firstTime = false; - strcpy(cmd_buffer[0], buffer); - return; - } - - for (int i = CMD_BUFF_SIZE - 1; i > 0; --i) { - strncpy(cmd_buffer[i], cmd_buffer[i - 1], 80); - } - - strcpy(cmd_buffer[0], buffer); - - return; - } - } -} - -void terminal_about(void) { - SEND_STRING("QMK Firmware\n"); - SEND_STRING(" v"); - SEND_STRING(QMK_VERSION); - SEND_STRING("\n" SS_TAP(X_HOME) " Built: "); - SEND_STRING(QMK_BUILDDATE); - send_string(newline); -#ifdef TERMINAL_HELP - if (strlen(arguments[1]) != 0) { - SEND_STRING("You entered: "); - send_string(arguments[1]); - send_string(newline); - } -#endif -} - -void terminal_help(void); - -extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; - -void terminal_keycode(void) { - if (strlen(arguments[1]) != 0 && strlen(arguments[2]) != 0 && strlen(arguments[3]) != 0) { - char keycode_dec[5]; - char keycode_hex[5]; - uint16_t layer = strtol(arguments[1], (char **)NULL, 10); - uint16_t row = strtol(arguments[2], (char **)NULL, 10); - uint16_t col = strtol(arguments[3], (char **)NULL, 10); - uint16_t keycode = pgm_read_word(&keymaps[layer][row][col]); - itoa(keycode, keycode_dec, 10); - itoa(keycode, keycode_hex, 16); - SEND_STRING("0x"); - send_string(keycode_hex); - SEND_STRING(" ("); - send_string(keycode_dec); - SEND_STRING(")\n"); - } else { -#ifdef TERMINAL_HELP - SEND_STRING("usage: keycode <layer> <row> <col>\n"); -#endif - } -} - -void terminal_keymap(void) { - if (strlen(arguments[1]) != 0) { - uint16_t layer = strtol(arguments[1], (char **)NULL, 10); - for (int r = 0; r < MATRIX_ROWS; r++) { - for (int c = 0; c < MATRIX_COLS; c++) { - uint16_t keycode = pgm_read_word(&keymaps[layer][r][c]); - char keycode_s[8]; - sprintf(keycode_s, "0x%04x,", keycode); - send_string(keycode_s); - } - send_string(newline); - } - } else { -#ifdef TERMINAL_HELP - SEND_STRING("usage: keymap <layer>\n"); -#endif - } -} - -void print_cmd_buff(void) { - /* without the below wait, a race condition can occur wherein the - buffer can be printed before it has been fully moved */ - wait_ms(250); - for (int i = 0; i < CMD_BUFF_SIZE; i++) { - char tmpChar = ' '; - itoa(i, &tmpChar, 10); - const char *tmpCnstCharStr = &tmpChar; // because sned_string wont take a normal char * - send_string(tmpCnstCharStr); - SEND_STRING(". "); - send_string(cmd_buffer[i]); - SEND_STRING("\n"); - } -} - -void flush_cmd_buffer(void) { - memset(cmd_buffer, 0, CMD_BUFF_SIZE * 80); - SEND_STRING("Buffer Cleared!\n"); -} - -stringcase terminal_cases[] = {{"about", terminal_about}, {"help", terminal_help}, {"keycode", terminal_keycode}, {"keymap", terminal_keymap}, {"flush-buffer", flush_cmd_buffer}, {"print-buffer", print_cmd_buff}, {"exit", disable_terminal}}; - -void terminal_help(void) { - SEND_STRING("commands available:\n "); - for (stringcase *case_p = terminal_cases; case_p != terminal_cases + sizeof(terminal_cases) / sizeof(terminal_cases[0]); case_p++) { - send_string(case_p->string); - SEND_STRING(" "); - } - send_string(newline); -} - -void command_not_found(void) { - wait_ms(50); // sometimes buffer isnt grabbed quick enough - SEND_STRING("command \""); - send_string(buffer); - SEND_STRING("\" not found\n"); -} - -void process_terminal_command(void) { - // we capture return bc of the order of events, so we need to manually send a newline - send_string(newline); - - char * pch; - uint8_t i = 0; - pch = strtok(buffer, " "); - while (pch != NULL) { - strcpy(arguments[i], pch); - pch = strtok(NULL, " "); - i++; - } - - bool command_found = false; - for (stringcase *case_p = terminal_cases; case_p != terminal_cases + sizeof(terminal_cases) / sizeof(terminal_cases[0]); case_p++) { - if (0 == strcmp(case_p->string, buffer)) { - command_found = true; - (*case_p->func)(); - break; - } - } - - if (!command_found) command_not_found(); - - if (terminal_enabled) { - strcpy(buffer, ""); - for (int i = 0; i < 6; i++) - strcpy(arguments[i], ""); - SEND_STRING(SS_TAP(X_HOME)); - send_string(terminal_prompt); - } -} -void check_pos(void) { - if (current_cmd_buffer_pos >= CMD_BUFF_SIZE) { // if over the top, move it back down to the top of the buffer so you can climb back down... - current_cmd_buffer_pos = CMD_BUFF_SIZE - 1; - } else if (current_cmd_buffer_pos < 0) { //...and if you fall under the bottom of the buffer, reset back to 0 so you can climb back up - current_cmd_buffer_pos = 0; - } -} - -bool process_terminal(uint16_t keycode, keyrecord_t *record) { - if (keycode == TERM_ON && record->event.pressed) { - enable_terminal(); - return false; - } - - if (terminal_enabled && record->event.pressed) { - if (keycode == TERM_OFF && record->event.pressed) { - disable_terminal(); - return false; - } - - if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { - keycode = keycode & 0xFF; - } - - if (keycode < 256) { - uint8_t str_len; - char char_to_add; - switch (keycode) { - case KC_ENTER: - case KC_KP_ENTER: - push_to_cmd_buffer(); - current_cmd_buffer_pos = 0; - process_terminal_command(); - return false; - break; - case KC_ESCAPE: - SEND_STRING("\n"); - enable_terminal(); - return false; - break; - case KC_BACKSPACE: - str_len = strlen(buffer); - if (str_len > 0) { - buffer[str_len - 1] = 0; - return true; - } else { - TERMINAL_BELL(); - return false; - } - break; - case KC_LEFT: - return false; - break; - case KC_RIGHT: - return false; - break; - case KC_UP: // 0 = recent - check_pos(); // check our current buffer position is valid - if (current_cmd_buffer_pos <= CMD_BUFF_SIZE - 1) { // once we get to the top, dont do anything - str_len = strlen(buffer); - for (int i = 0; i < str_len; ++i) { - send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already - // process_terminal(KC_BACKSPACE,record); - } - strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 80); - - send_string(buffer); - ++current_cmd_buffer_pos; // get ready to access the above cmd if up/down is pressed again - } - return false; - break; - case KC_DOWN: - check_pos(); - if (current_cmd_buffer_pos >= 0) { // once we get to the bottom, dont do anything - str_len = strlen(buffer); - for (int i = 0; i < str_len; ++i) { - send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already - // process_terminal(KC_BACKSPACE,record); - } - strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 79); - - send_string(buffer); - --current_cmd_buffer_pos; // get ready to access the above cmd if down/up is pressed again - } - return false; - break; - default: - if (keycode <= 58) { - char_to_add = 0; - if (get_mods() & (MOD_BIT(KC_LEFT_SHIFT) | MOD_BIT(KC_RIGHT_SHIFT))) { - char_to_add = shifted_keycode_to_ascii_lut[keycode]; - } else if (get_mods() == 0) { - char_to_add = keycode_to_ascii_lut[keycode]; - } - if (char_to_add != 0) { - strncat(buffer, &char_to_add, 1); - } - } - break; - } - } - } - return true; -} diff --git a/quantum/quantum.c b/quantum/quantum.c index 33121f6b95..d1cfb5fbe0 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -307,9 +307,6 @@ bool process_record_quantum(keyrecord_t *record) { #ifdef DYNAMIC_TAPPING_TERM_ENABLE process_dynamic_tapping_term(keycode, record) && #endif -#ifdef TERMINAL_ENABLE - process_terminal(keycode, record) && -#endif #ifdef SPACE_CADET_ENABLE process_space_cadet(keycode, record) && #endif diff --git a/quantum/quantum.h b/quantum/quantum.h index 92e1af1c40..8a7a20c706 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -141,12 +141,6 @@ extern layer_state_t layer_state; # include "process_key_lock.h" #endif -#ifdef TERMINAL_ENABLE -# include "process_terminal.h" -#else -# include "process_terminal_nop.h" -#endif - #ifdef SPACE_CADET_ENABLE # include "process_space_cadet.h" #endif diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 40355d799a..869826ce19 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -473,9 +473,9 @@ enum quantum_keycodes { // Lock Key KC_LOCK, // 5D2B - // Terminal - TERM_ON, // 5D2C - TERM_OFF, // 5D2D + // Unused slots + UNUSED_000, // 5D2C + UNUSED_001, // 5D2D // Sequencer SQ_ON, // 5D2E diff --git a/quantum/quantum_keycodes_legacy.h b/quantum/quantum_keycodes_legacy.h index ed9455ee74..51380d9c50 100644 --- a/quantum/quantum_keycodes_legacy.h +++ b/quantum/quantum_keycodes_legacy.h @@ -11,3 +11,6 @@ #define KC_GESC QK_GRAVE_ESCAPE #define EEP_RST QK_CLEAR_EEPROM + +#define TERM_ON _Static_assert(false, "The Terminal feature has been removed from QMK. Please remove use of TERM_ON/TERM_OFF from your keymap.") +#define TERM_OFF _Static_assert(false, "The Terminal feature has been removed from QMK.. Please remove use of TERM_ON/TERM_OFF from your keymap.")
\ No newline at end of file diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index 7d50adf758..48b9cce6d4 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c @@ -57,8 +57,9 @@ static uint8_t connection_errors = 0; volatile bool isLeftHand = true; #if defined(SPLIT_USB_DETECT) +_Static_assert((SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL) <= UINT16_MAX, "Please lower SPLIT_USB_TIMEOUT and/or increase SPLIT_USB_TIMEOUT_POLL."); static bool usbIsActive(void) { - for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) { + for (uint16_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) { // This will return true if a USB connection has been established if (usb_connected_state()) { return true; @@ -93,7 +94,6 @@ static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) { __attribute__((weak)) bool is_keyboard_left(void) { #if defined(SPLIT_HAND_PIN) // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand - setPinInput(SPLIT_HAND_PIN); # ifdef SPLIT_HAND_PIN_LOW_IS_LEFT return !readPin(SPLIT_HAND_PIN); # else @@ -132,6 +132,10 @@ __attribute__((weak)) bool is_keyboard_master(void) { // this code runs before the keyboard is fully initialized void split_pre_init(void) { +#if defined(SPLIT_HAND_PIN) + setPinInput(SPLIT_HAND_PIN); + wait_us(100); +#endif isLeftHand = is_keyboard_left(); #if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) diff --git a/quantum/via.c b/quantum/via.c index 320bd5546d..d2ef0862cc 100644 --- a/quantum/via.c +++ b/quantum/via.c @@ -64,6 +64,7 @@ void via_qmk_rgblight_get_value(uint8_t *data); #endif #if defined(VIA_QMK_RGB_MATRIX_ENABLE) +# include <lib/lib8tion/lib8tion.h> void via_qmk_rgb_matrix_set_value(uint8_t *data); void via_qmk_rgb_matrix_get_value(uint8_t *data); void eeconfig_update_rgb_matrix(void); @@ -421,7 +422,7 @@ void via_qmk_backlight_get_value(uint8_t *data) { switch (*value_id) { case id_qmk_backlight_brightness: { // level / BACKLIGHT_LEVELS * 255 - value_data[0] = ((uint16_t)get_backlight_level()) * 255 / BACKLIGHT_LEVELS; + value_data[0] = ((uint16_t)get_backlight_level() * UINT8_MAX) / BACKLIGHT_LEVELS; break; } case id_qmk_backlight_effect: { @@ -441,7 +442,7 @@ void via_qmk_backlight_set_value(uint8_t *data) { switch (*value_id) { case id_qmk_backlight_brightness: { // level / 255 * BACKLIGHT_LEVELS - backlight_level_noeeprom(((uint16_t)value_data[0]) * BACKLIGHT_LEVELS / 255); + backlight_level_noeeprom(((uint16_t)value_data[0] * BACKLIGHT_LEVELS) / UINT8_MAX); break; } case id_qmk_backlight_effect: { @@ -460,13 +461,16 @@ void via_qmk_backlight_set_value(uint8_t *data) { #endif // #if defined(VIA_QMK_BACKLIGHT_ENABLE) #if defined(VIA_QMK_RGBLIGHT_ENABLE) +# ifndef RGBLIGHT_LIMIT_VAL +# define RGBLIGHT_LIMIT_VAL 255 +# endif void via_qmk_rgblight_get_value(uint8_t *data) { uint8_t *value_id = &(data[0]); uint8_t *value_data = &(data[1]); switch (*value_id) { case id_qmk_rgblight_brightness: { - value_data[0] = rgblight_get_val(); + value_data[0] = ((uint16_t)rgblight_get_val() * UINT8_MAX) / RGBLIGHT_LIMIT_VAL; break; } case id_qmk_rgblight_effect: { @@ -490,7 +494,7 @@ void via_qmk_rgblight_set_value(uint8_t *data) { uint8_t *value_data = &(data[1]); switch (*value_id) { case id_qmk_rgblight_brightness: { - rgblight_sethsv_noeeprom(rgblight_get_hue(), rgblight_get_sat(), value_data[0]); + rgblight_sethsv_noeeprom(rgblight_get_hue(), rgblight_get_sat(), ((uint16_t)value_data[0] * RGBLIGHT_LIMIT_VAL) / UINT8_MAX); break; } case id_qmk_rgblight_effect: { @@ -517,6 +521,11 @@ void via_qmk_rgblight_set_value(uint8_t *data) { #if defined(VIA_QMK_RGB_MATRIX_ENABLE) +# if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX +# undef RGB_MATRIX_MAXIMUM_BRIGHTNESS +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS UINT8_MAX +# endif + // VIA supports only 4 discrete values for effect speed; map these to some // useful speed values for RGB Matrix. enum speed_values { @@ -557,7 +566,7 @@ void via_qmk_rgb_matrix_get_value(uint8_t *data) { uint8_t *value_data = &(data[1]); switch (*value_id) { case id_qmk_rgblight_brightness: - value_data[0] = rgb_matrix_get_val(); + value_data[0] = ((uint16_t)rgb_matrix_get_val() * UINT8_MAX) / RGB_MATRIX_MAXIMUM_BRIGHTNESS; break; case id_qmk_rgblight_effect: value_data[0] = rgb_matrix_get_mode(); @@ -577,7 +586,7 @@ void via_qmk_rgb_matrix_set_value(uint8_t *data) { uint8_t *value_data = &(data[1]); switch (*value_id) { case id_qmk_rgblight_brightness: - rgb_matrix_sethsv_noeeprom(rgb_matrix_get_hue(), rgb_matrix_get_sat(), value_data[0]); + rgb_matrix_sethsv_noeeprom(rgb_matrix_get_hue(), rgb_matrix_get_sat(), scale8(value_data[0], RGB_MATRIX_MAXIMUM_BRIGHTNESS)); break; case id_qmk_rgblight_effect: rgb_matrix_mode_noeeprom(value_data[0]); @@ -1,3 +1,7 @@ +# This is the `develop` branch! + +See the [Breaking Changes](https://docs.qmk.fm/#/breaking_changes) document for more information. + # Quantum Mechanical Keyboard Firmware [![Current Version](https://img.shields.io/github/tag/qmk/qmk_firmware.svg)](https://github.com/qmk/qmk_firmware/tags) diff --git a/quantum/process_keycode/process_terminal_nop.h b/tests/tapdance/config.h index 36e25320c5..6aada3efd3 100644 --- a/quantum/process_keycode/process_terminal_nop.h +++ b/tests/tapdance/config.h @@ -1,4 +1,4 @@ -/* Copyright 2017 Jack Humbert +/* Copyright 2022 Jouke Witteveen * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,4 @@ #pragma once -#include "quantum.h" - -#define TERM_ON KC_NO -#define TERM_OFF KC_NO +#include "test_common.h" diff --git a/tests/tapdance/examples.c b/tests/tapdance/examples.c new file mode 100644 index 0000000000..4a5be41b08 --- /dev/null +++ b/tests/tapdance/examples.c @@ -0,0 +1,199 @@ +/* Copyright 2022 Jouke Witteveen + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "quantum.h" +#include "examples.h" + +// Example code from the tap dance documentation, adapted for testing + +// clang-format off + +// Example 1 + +void dance_egg(qk_tap_dance_state_t *state, void *user_data) { + if (state->count >= 100) { + // SEND_STRING("Safety dance!"); + tap_code(KC_C); + reset_tap_dance(state); + } +} + + +// Example 2 + +void dance_flsh_each(qk_tap_dance_state_t *state, void *user_data) { + switch (state->count) { + case 1: + register_code(KC_3); + break; + case 2: + register_code(KC_2); + break; + case 3: + register_code(KC_1); + break; + case 4: + unregister_code(KC_3); + // wait_ms(50); + unregister_code(KC_2); + // wait_ms(50); + unregister_code(KC_1); + } +} + +void dance_flsh_finished(qk_tap_dance_state_t *state, void *user_data) { + if (state->count >= 4) { + // reset_keyboard(); + tap_code(KC_R); + } +} + +void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) { + unregister_code(KC_1); + // wait_ms(50); + unregister_code(KC_2); + // wait_ms(50); + unregister_code(KC_3); +} + + +// Example 3 + +typedef struct { + uint16_t tap; + uint16_t hold; + uint16_t held; +} tap_dance_tap_hold_t; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + qk_tap_dance_action_t *action; + + switch (keycode) { + case TD(CT_CLN): + action = &tap_dance_actions[TD_INDEX(keycode)]; + if (!record->event.pressed && action->state.count && !action->state.finished) { + tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)action->user_data; + tap_code16(tap_hold->tap); + } + } + return true; +} + +void tap_dance_tap_hold_finished(qk_tap_dance_state_t *state, void *user_data) { + tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data; + + if (state->pressed) { + if (state->count == 1 +#ifndef PERMISSIVE_HOLD + && !state->interrupted +#endif + ) { + register_code16(tap_hold->hold); + tap_hold->held = tap_hold->hold; + } else { + register_code16(tap_hold->tap); + tap_hold->held = tap_hold->tap; + } + } +} + +void tap_dance_tap_hold_reset(qk_tap_dance_state_t *state, void *user_data) { + tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data; + + if (tap_hold->held) { + unregister_code16(tap_hold->held); + tap_hold->held = 0; + } +} + +#define ACTION_TAP_DANCE_TAP_HOLD(tap, hold) \ + { .fn = {NULL, tap_dance_tap_hold_finished, tap_dance_tap_hold_reset}, .user_data = (void *)&((tap_dance_tap_hold_t){tap, hold, 0}), } + + +// Example 4 + +typedef enum { + TD_NONE, + TD_UNKNOWN, + TD_SINGLE_TAP, + TD_SINGLE_HOLD, + TD_DOUBLE_TAP, + TD_DOUBLE_HOLD, + TD_DOUBLE_SINGLE_TAP, + TD_TRIPLE_TAP, + TD_TRIPLE_HOLD +} td_state_t; + +typedef struct { + bool is_press_action; + td_state_t state; +} td_tap_t; + +td_state_t cur_dance(qk_tap_dance_state_t *state) { + if (state->count == 1) { + if (state->interrupted || !state->pressed) return TD_SINGLE_TAP; + else return TD_SINGLE_HOLD; + } else if (state->count == 2) { + if (state->interrupted) return TD_DOUBLE_SINGLE_TAP; + else if (state->pressed) return TD_DOUBLE_HOLD; + else return TD_DOUBLE_TAP; + } + + if (state->count == 3) { + if (state->interrupted || !state->pressed) return TD_TRIPLE_TAP; + else return TD_TRIPLE_HOLD; + } else return TD_UNKNOWN; +} + +static td_tap_t xtap_state = { + .is_press_action = true, + .state = TD_NONE +}; + +void x_finished(qk_tap_dance_state_t *state, void *user_data) { + xtap_state.state = cur_dance(state); + switch (xtap_state.state) { + case TD_SINGLE_TAP: register_code(KC_X); break; + case TD_SINGLE_HOLD: register_code(KC_LCTL); break; + case TD_DOUBLE_TAP: register_code(KC_ESC); break; + case TD_DOUBLE_HOLD: register_code(KC_LALT); break; + case TD_DOUBLE_SINGLE_TAP: tap_code(KC_X); register_code(KC_X); + default: break; // Not present in documentation + } +} + +void x_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (xtap_state.state) { + case TD_SINGLE_TAP: unregister_code(KC_X); break; + case TD_SINGLE_HOLD: unregister_code(KC_LCTL); break; + case TD_DOUBLE_TAP: unregister_code(KC_ESC); break; + case TD_DOUBLE_HOLD: unregister_code(KC_LALT); + case TD_DOUBLE_SINGLE_TAP: unregister_code(KC_X); + default: break; // Not present in documentation + } + xtap_state.state = TD_NONE; +} + + +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), + [CT_EGG] = ACTION_TAP_DANCE_FN(dance_egg), + [CT_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED(dance_flsh_each, dance_flsh_finished, dance_flsh_reset), + [CT_CLN] = ACTION_TAP_DANCE_TAP_HOLD(KC_COLN, KC_SCLN), + [X_CTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, x_finished, x_reset) +}; + +// clang-format on diff --git a/quantum/process_keycode/process_terminal.h b/tests/tapdance/examples.h index 0159131e5b..2622af6b2f 100644 --- a/quantum/process_keycode/process_terminal.h +++ b/tests/tapdance/examples.h @@ -1,4 +1,4 @@ -/* Copyright 2017 Jack Humbert +/* Copyright 2022 Jouke Witteveen * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,9 +16,18 @@ #pragma once -#include "quantum.h" +#ifdef __cplusplus +extern "C" { +#endif -extern const char keycode_to_ascii_lut[58]; -extern const char shifted_keycode_to_ascii_lut[58]; -extern const char terminal_prompt[8]; -bool process_terminal(uint16_t keycode, keyrecord_t *record); +enum { + TD_ESC_CAPS, + CT_EGG, + CT_FLSH, + CT_CLN, + X_CTL, +}; + +#ifdef __cplusplus +} +#endif diff --git a/tests/tapdance/test.mk b/tests/tapdance/test.mk new file mode 100644 index 0000000000..041d9b4dc9 --- /dev/null +++ b/tests/tapdance/test.mk @@ -0,0 +1,22 @@ +# Copyright 2022 Jouke Witteveen +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# -------------------------------------------------------------------------------- +# Keep this file, even if it is empty, as a marker that this folder contains tests +# -------------------------------------------------------------------------------- + +TAP_DANCE_ENABLE = yes + +SRC += examples.c diff --git a/tests/tapdance/test_examples.cpp b/tests/tapdance/test_examples.cpp new file mode 100644 index 0000000000..e67e6cb907 --- /dev/null +++ b/tests/tapdance/test_examples.cpp @@ -0,0 +1,319 @@ +/* Copyright 2022 Jouke Witteveen + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "keyboard_report_util.hpp" +#include "keycode.h" +#include "test_common.hpp" +#include "action_tapping.h" +#include "test_keymap_key.hpp" +#include "examples.h" + +using testing::_; +using testing::InSequence; + +class TapDance : public TestFixture {}; + +TEST_F(TapDance, DoubleTap) { + TestDriver driver; + InSequence s; + auto key_esc_caps = KeymapKey{0, 1, 0, TD(TD_ESC_CAPS)}; + + set_keymap({key_esc_caps}); + + /* The tap dance key does nothing on the first press */ + key_esc_caps.press(); + run_one_scan_loop(); + key_esc_caps.release(); + EXPECT_NO_REPORT(driver); + + /* We get the key press and the release on timeout */ + idle_for(TAPPING_TERM); + EXPECT_REPORT(driver, (KC_ESC)); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); + + /* Double tap gets us the second key */ + tap_key(key_esc_caps); + EXPECT_NO_REPORT(driver); + key_esc_caps.press(); + EXPECT_REPORT(driver, (KC_CAPS)); + run_one_scan_loop(); + key_esc_caps.release(); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); +} + +TEST_F(TapDance, DoubleTapWithMod) { + TestDriver driver; + InSequence s; + auto key_esc_caps = KeymapKey{0, 1, 0, TD(TD_ESC_CAPS)}; + auto key_shift = KeymapKey{0, 2, 0, KC_LSFT}; + + set_keymap({key_esc_caps, key_shift}); + + /* The tap dance key does nothing on the first press */ + key_shift.press(); + EXPECT_REPORT(driver, (KC_LSFT)); + run_one_scan_loop(); + key_esc_caps.press(); + run_one_scan_loop(); + + key_esc_caps.release(); + key_shift.release(); + EXPECT_EMPTY_REPORT(driver); + + /* We get the key press and the release */ + idle_for(TAPPING_TERM); + EXPECT_REPORT(driver, (KC_LSFT)); + EXPECT_REPORT(driver, (KC_LSFT, KC_ESC)); + EXPECT_REPORT(driver, (KC_LSFT)); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); + + /* Double tap gets us the second key */ + key_shift.press(); + EXPECT_REPORT(driver, (KC_LSFT)); + run_one_scan_loop(); + tap_key(key_esc_caps); + EXPECT_NO_REPORT(driver); + key_shift.release(); + key_esc_caps.press(); + EXPECT_REPORT(driver, (KC_LSFT, KC_CAPS)); + run_one_scan_loop(); + key_esc_caps.release(); + EXPECT_REPORT(driver, (KC_LSFT)); + run_one_scan_loop(); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); +} + +TEST_F(TapDance, DoubleTapInterrupted) { + TestDriver driver; + InSequence s; + auto key_esc_caps = KeymapKey{0, 1, 0, TD(TD_ESC_CAPS)}; + auto regular_key = KeymapKey(0, 2, 0, KC_A); + + set_keymap({key_esc_caps, regular_key}); + + /* Interrupted double tap */ + tap_key(key_esc_caps); + regular_key.press(); + /* Immediate tap of the first key */ + EXPECT_REPORT(driver, (KC_ESC)); + EXPECT_EMPTY_REPORT(driver); + /* Followed by the interrupting key */ + EXPECT_REPORT(driver, (KC_A)); + run_one_scan_loop(); + regular_key.release(); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); + + /* Second tap after being interrupted acts as a single tap */ + key_esc_caps.press(); + run_one_scan_loop(); + key_esc_caps.release(); + idle_for(TAPPING_TERM); + EXPECT_REPORT(driver, (KC_ESC)); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); +} + +TEST_F(TapDance, DanceFn) { + TestDriver driver; + InSequence s; + auto key_egg = KeymapKey(0, 1, 0, TD(CT_EGG)); + + set_keymap({key_egg}); + + /* 99 taps do nothing */ + for (int i = 0; i < 99; i++) { + run_one_scan_loop(); + key_egg.press(); + run_one_scan_loop(); + key_egg.release(); + } + idle_for(TAPPING_TERM); + EXPECT_NO_REPORT(driver); + run_one_scan_loop(); + + /* 100 taps trigger the action */ + for (int i = 0; i < 100; i++) { + run_one_scan_loop(); + key_egg.press(); + run_one_scan_loop(); + key_egg.release(); + } + idle_for(TAPPING_TERM); + EXPECT_REPORT(driver, (KC_C)); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); + + /* 250 taps act the same as 100 taps */ + /* Taps are counted in an uint8_t, so the count overflows after 255 taps */ + for (int i = 0; i < 250; i++) { + run_one_scan_loop(); + key_egg.press(); + run_one_scan_loop(); + key_egg.release(); + } + idle_for(TAPPING_TERM); + EXPECT_REPORT(driver, (KC_C)); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); +} + +TEST_F(TapDance, DanceFnAdvanced) { + TestDriver driver; + InSequence s; + auto key_flsh = KeymapKey(0, 1, 0, TD(CT_FLSH)); + + set_keymap({key_flsh}); + + /* Three taps don't trigger a reset */ + EXPECT_REPORT(driver, (KC_3)); + EXPECT_REPORT(driver, (KC_3, KC_2)); + EXPECT_REPORT(driver, (KC_3, KC_2, KC_1)); + for (int i = 0; i < 3; i++) { + run_one_scan_loop(); + key_flsh.press(); + run_one_scan_loop(); + key_flsh.release(); + } + idle_for(TAPPING_TERM); + EXPECT_REPORT(driver, (KC_3, KC_2)); + EXPECT_REPORT(driver, (KC_3)); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); + + /* Four taps trigger a reset */ + EXPECT_REPORT(driver, (KC_3)); + EXPECT_REPORT(driver, (KC_3, KC_2)); + EXPECT_REPORT(driver, (KC_3, KC_2, KC_1)); + EXPECT_REPORT(driver, (KC_2, KC_1)); + EXPECT_REPORT(driver, (KC_1)); + EXPECT_EMPTY_REPORT(driver); + for (int i = 0; i < 4; i++) { + run_one_scan_loop(); + key_flsh.press(); + run_one_scan_loop(); + key_flsh.release(); + } + idle_for(TAPPING_TERM); + EXPECT_REPORT(driver, (KC_R)); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); +} + +TEST_F(TapDance, TapHold) { + TestDriver driver; + InSequence s; + auto key_cln = KeymapKey{0, 1, 0, TD(CT_CLN)}; + + set_keymap({key_cln}); + + /* Short taps fire on release */ + key_cln.press(); + run_one_scan_loop(); + key_cln.release(); + EXPECT_REPORT(driver, (KC_LSFT)); + EXPECT_REPORT(driver, (KC_LSFT, KC_SCLN)); + EXPECT_REPORT(driver, (KC_LSFT)); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); + + /* Holds immediate following a tap apply to the tap key */ + key_cln.press(); + EXPECT_REPORT(driver, (KC_LSFT)); + EXPECT_REPORT(driver, (KC_LSFT, KC_SCLN)); + idle_for(TAPPING_TERM * 2); + key_cln.release(); + EXPECT_REPORT(driver, (KC_LSFT)); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); + + /* Holds trigger the hold key */ + key_cln.press(); + idle_for(TAPPING_TERM); + run_one_scan_loop(); + EXPECT_REPORT(driver, (KC_SCLN)); + run_one_scan_loop(); + key_cln.release(); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); +} + +TEST_F(TapDance, QuadFunction) { + TestDriver driver; + InSequence s; + auto key_quad = KeymapKey{0, 1, 0, TD(X_CTL)}; + auto regular_key = KeymapKey(0, 2, 0, KC_A); + + set_keymap({key_quad, regular_key}); + + /* Single tap */ + key_quad.press(); + run_one_scan_loop(); + key_quad.release(); + idle_for(TAPPING_TERM); + EXPECT_REPORT(driver, (KC_X)); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); + + /* Single hold */ + key_quad.press(); + run_one_scan_loop(); + idle_for(TAPPING_TERM); + EXPECT_REPORT(driver, (KC_LCTL)); + run_one_scan_loop(); + key_quad.release(); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); + + /* Double tap */ + tap_key(key_quad); + key_quad.press(); + run_one_scan_loop(); + key_quad.release(); + idle_for(TAPPING_TERM); + EXPECT_REPORT(driver, (KC_ESC)); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); + + /* Double tap and hold */ + tap_key(key_quad); + key_quad.press(); + run_one_scan_loop(); + idle_for(TAPPING_TERM); + EXPECT_REPORT(driver, (KC_LALT)); + run_one_scan_loop(); + key_quad.release(); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); + + /* Double single tap */ + tap_key(key_quad); + tap_key(key_quad); + regular_key.press(); + EXPECT_REPORT(driver, (KC_X)); + EXPECT_EMPTY_REPORT(driver); + EXPECT_REPORT(driver, (KC_X)); + EXPECT_EMPTY_REPORT(driver); + EXPECT_REPORT(driver, (KC_A)); + run_one_scan_loop(); + regular_key.release(); + EXPECT_EMPTY_REPORT(driver); + run_one_scan_loop(); +} diff --git a/tmk_core/protocol/host.c b/tmk_core/protocol/host.c index 053d2b79e3..3d8604d541 100644 --- a/tmk_core/protocol/host.c +++ b/tmk_core/protocol/host.c @@ -94,6 +94,11 @@ void host_mouse_send(report_mouse_t *report) { #ifdef MOUSE_SHARED_EP report->report_id = REPORT_ID_MOUSE; #endif +#ifdef MOUSE_EXTENDED_REPORT + // clip and copy to Boot protocol XY + report->boot_x = (report->x > 127) ? 127 : ((report->x < -127) ? -127 : report->x); + report->boot_y = (report->y > 127) ? 127 : ((report->y < -127) ? -127 : report->y); +#endif (*driver->send_mouse)(report); } diff --git a/tmk_core/protocol/report.h b/tmk_core/protocol/report.h index 7bbeb78af7..735ccdb4a1 100644 --- a/tmk_core/protocol/report.h +++ b/tmk_core/protocol/report.h @@ -201,15 +201,25 @@ typedef struct { uint32_t usage; } __attribute__((packed)) report_programmable_button_t; +#ifdef MOUSE_EXTENDED_REPORT +typedef int16_t mouse_xy_report_t; +#else +typedef int8_t mouse_xy_report_t; +#endif + typedef struct { #ifdef MOUSE_SHARED_EP uint8_t report_id; #endif uint8_t buttons; - int8_t x; - int8_t y; - int8_t v; - int8_t h; +#ifdef MOUSE_EXTENDED_REPORT + int8_t boot_x; + int8_t boot_y; +#endif + mouse_xy_report_t x; + mouse_xy_report_t y; + int8_t v; + int8_t h; } __attribute__((packed)) report_mouse_t; typedef struct { diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c index 063bd2c3f1..52e3276d35 100644 --- a/tmk_core/protocol/usb_descriptor.c +++ b/tmk_core/protocol/usb_descriptor.c @@ -126,14 +126,27 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = { HID_RI_REPORT_SIZE(8, 0x01), HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), - // X/Y position (2 bytes) +# ifdef MOUSE_EXTENDED_REPORT + // Boot protocol XY ignored in Report protocol + HID_RI_REPORT_COUNT(8, 0x02), + HID_RI_REPORT_SIZE(8, 0x08), + HID_RI_INPUT(8, HID_IOF_CONSTANT), +# endif + // X/Y position (2 or 4 bytes) HID_RI_USAGE_PAGE(8, 0x01), // Generic Desktop HID_RI_USAGE(8, 0x30), // X HID_RI_USAGE(8, 0x31), // Y +# ifndef MOUSE_EXTENDED_REPORT HID_RI_LOGICAL_MINIMUM(8, -127), HID_RI_LOGICAL_MAXIMUM(8, 127), HID_RI_REPORT_COUNT(8, 0x02), HID_RI_REPORT_SIZE(8, 0x08), +# else + HID_RI_LOGICAL_MINIMUM(16, -32767), + HID_RI_LOGICAL_MAXIMUM(16, 32767), + HID_RI_REPORT_COUNT(8, 0x02), + HID_RI_REPORT_SIZE(8, 0x10), +# endif HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), // Vertical wheel (1 byte) diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index ebde955d3b..d07cc0d27e 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c @@ -482,14 +482,28 @@ const PROGMEM uchar shared_hid_report[] = { 0x75, 0x01, // Report Size (1) 0x81, 0x02, // Input (Data, Variable, Absolute) - // X/Y position (2 bytes) +# ifdef MOUSE_EXTENDED_REPORT + // Boot protocol XY ignored in Report protocol + 0x95, 0x02, // Report Count (2) + 0x75, 0x08, // Report Size (8) + 0x81, 0x03, // Input (Constant) +# endif + + // X/Y position (2 or 4 bytes) 0x05, 0x01, // Usage Page (Generic Desktop) 0x09, 0x30, // Usage (X) 0x09, 0x31, // Usage (Y) +# ifndef MOUSE_EXTENDED_REPORT 0x15, 0x81, // Logical Minimum (-127) 0x25, 0x7F, // Logical Maximum (127) 0x95, 0x02, // Report Count (2) 0x75, 0x08, // Report Size (8) +# else + 0x16, 0x01, 0x80, // Logical Minimum (-32767) + 0x26, 0xFF, 0x7F, // Logical Maximum (32767) + 0x95, 0x02, // Report Count (2) + 0x75, 0x10, // Report Size (16) +# endif 0x81, 0x06, // Input (Data, Variable, Relative) // Vertical wheel (1 byte) diff --git a/users/bcat/rules.mk b/users/bcat/rules.mk index 1ad2ee0aa8..090f7474eb 100644 --- a/users/bcat/rules.mk +++ b/users/bcat/rules.mk @@ -47,7 +47,6 @@ endif COMMAND_ENABLE = no CONSOLE_ENABLE = no MOUSEKEY_ENABLE = no -TERMINAL_ENABLE = no # Disable unwanted hardware options on all keyboards. (Some keyboards turn # these features on by default even though they aren't actually required.) diff --git a/users/edvorakjp/edvorakjp_tap_dance.c b/users/edvorakjp/edvorakjp_tap_dance.c index cee10de693..69fcbac1ca 100644 --- a/users/edvorakjp/edvorakjp_tap_dance.c +++ b/users/edvorakjp/edvorakjp_tap_dance.c @@ -64,6 +64,15 @@ void td_raise_reset(qk_tap_dance_state_t *state, void *user_data) { } qk_tap_dance_action_t tap_dance_actions[] = { - [TD_EDVORAKJP_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_lower_finished, td_lower_reset, 150), - [TD_EDVORAKJP_RAISE] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_raise_finished, td_raise_reset, 150), + [TD_EDVORAKJP_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, td_lower_finished, td_lower_reset), + [TD_EDVORAKJP_RAISE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, td_raise_finished, td_raise_reset), }; + +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: + return 150; + default: + return TAPPING_TERM; + } +} diff --git a/users/gourdo1/gourdo1.c b/users/gourdo1/gourdo1.c index b964729be9..4e741ccc91 100644 --- a/users/gourdo1/gourdo1.c +++ b/users/gourdo1/gourdo1.c @@ -45,7 +45,7 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_LSFT_CAPSLOCK] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS), [TD_LSFT_CAPS_WIN] = ACTION_TAP_DANCE_FN_ADVANCED(dance_LSFT_each_tap, NULL, dance_LSFT_reset), // Tap once for Escape, twice to reset to base layer - [TD_ESC_BASELYR] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _BASE), + [TD_ESC_BASELYR] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _BASE), }; #endif // TD_LSFT_CAPSLOCK_ENABLE diff --git a/users/mnil/config.h b/users/mnil/config.h index 3547785ff7..b471b9a818 100644 --- a/users/mnil/config.h +++ b/users/mnil/config.h @@ -19,3 +19,4 @@ #define MK_3_SPEED #define MK_MOMENTARY_ACCEL #define PERMISSIVE_HOLD +#define TAPPING_TERM 250 diff --git a/users/mnil/mnil.c b/users/mnil/mnil.c index d5bd0ef0bb..00da6086ef 100644 --- a/users/mnil/mnil.c +++ b/users/mnil/mnil.c @@ -140,7 +140,7 @@ void aa_reset(qk_tap_dance_state_t *state, void *user_data) { // clang-format off qk_tap_dance_action_t tap_dance_actions[] = { - [AAE] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, ae_finished, ae_reset, 250), - [OAA] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, aa_finished, aa_reset, 250) + [AAE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ae_finished, ae_reset), + [OAA] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, aa_finished, aa_reset) }; // clang-format on diff --git a/users/ninjonas/config.h b/users/ninjonas/config.h index 025dbb541a..565e40e841 100644 --- a/users/ninjonas/config.h +++ b/users/ninjonas/config.h @@ -2,6 +2,7 @@ #undef TAPPING_TERM #define TAPPING_TERM 200 #endif +#define TAPPING_TERM_PER_KEY // Mouse Settings: Smoothing out mouse movement on keypress #ifndef MOUSEKEY_INTERVAL @@ -18,4 +19,4 @@ #undef COMBO_TERM #define COMBO_COUNT 5 #define COMBO_TERM 60 -#endif
\ No newline at end of file +#endif diff --git a/users/ninjonas/tap_dances.c b/users/ninjonas/tap_dances.c index 63e4d3ba47..3e4cec9133 100644 --- a/users/ninjonas/tap_dances.c +++ b/users/ninjonas/tap_dances.c @@ -107,6 +107,16 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_GUI_GUISPC] = ACTION_TAP_DANCE_DOUBLE(KC_LGUI, LGUI(KC_SPC)), // Advanced Tap Dances - [TD_COPY_PASTE_APP] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, copy_paste_app_finished, copy_paste_app_reset, 300), - [TD_Y_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, y_numpad_finished, y_numpad_reset, 300), -};
\ No newline at end of file + [TD_COPY_PASTE_APP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, copy_paste_app_finished, copy_paste_app_reset), + [TD_Y_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, y_numpad_finished, y_numpad_reset), +}; + +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_COPY_PASTE_APP): + case TD(TD_Y_NUMPAD): + return 300; + default: + return TAPPING_TERM; + } +} |