mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-19 14:12:01 +00:00
Merge branch 'develop' into gk87_q1
This commit is contained in:
commit
a6699d3288
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
@ -56,7 +56,7 @@ jobs:
|
||||
|
||||
- name: Deploy
|
||||
if: ${{ github.event_name == 'push' && github.repository == 'qmk/qmk_firmware' }}
|
||||
uses: JamesIves/github-pages-deploy-action@v4.6.8
|
||||
uses: JamesIves/github-pages-deploy-action@v4.6.9
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: gh-pages
|
||||
|
@ -129,13 +129,13 @@ ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
|
||||
MOUSE_ENABLE := yes
|
||||
VPATH += $(QUANTUM_DIR)/pointing_device
|
||||
SRC += $(QUANTUM_DIR)/pointing_device/pointing_device.c
|
||||
SRC += $(QUANTUM_DIR)/pointing_device/pointing_device_drivers.c
|
||||
SRC += $(QUANTUM_DIR)/pointing_device/pointing_device_auto_mouse.c
|
||||
ifneq ($(strip $(POINTING_DEVICE_DRIVER)), custom)
|
||||
SRC += drivers/sensors/$(strip $(POINTING_DEVICE_DRIVER)).c
|
||||
OPT_DEFS += -DPOINTING_DEVICE_DRIVER_$(strip $(shell echo $(POINTING_DEVICE_DRIVER) | tr '[:lower:]' '[:upper:]'))
|
||||
endif
|
||||
OPT_DEFS += -DPOINTING_DEVICE_DRIVER_$(strip $(POINTING_DEVICE_DRIVER))
|
||||
OPT_DEFS += -DPOINTING_DEVICE_DRIVER_NAME=$(strip $(POINTING_DEVICE_DRIVER))
|
||||
ifeq ($(strip $(POINTING_DEVICE_DRIVER)), adns9800)
|
||||
SPI_DRIVER_REQUIRED = yes
|
||||
else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), analog_joystick)
|
||||
@ -215,7 +215,7 @@ else
|
||||
COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/flash
|
||||
COMMON_VPATH += $(DRIVER_PATH)/flash
|
||||
SRC += eeprom_driver.c eeprom_legacy_emulated_flash.c legacy_flash_ops.c
|
||||
else ifneq ($(filter $(MCU_SERIES),STM32F1xx STM32F3xx STM32F4xx STM32L4xx STM32G4xx WB32F3G71xx WB32FQ95xx GD32VF103),)
|
||||
else ifneq ($(filter $(MCU_SERIES),STM32F1xx STM32F3xx STM32F4xx STM32L4xx STM32G4xx WB32F3G71xx WB32FQ95xx AT32F415 GD32VF103),)
|
||||
# Wear-leveling EEPROM implementation, backed by MCU flash
|
||||
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_WEAR_LEVELING
|
||||
SRC += eeprom_driver.c eeprom_wear_leveling.c
|
||||
@ -456,6 +456,10 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
|
||||
COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations
|
||||
COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations/runners
|
||||
POST_CONFIG_H += $(QUANTUM_DIR)/rgb_matrix/post_config.h
|
||||
|
||||
# TODO: Remove this
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_underglow.c
|
||||
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_rgb_matrix.c
|
||||
SRC += $(QUANTUM_DIR)/color.c
|
||||
SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix.c
|
||||
|
@ -39,8 +39,15 @@ export default defineConfig(({ mode }) => {
|
||||
provider: "local",
|
||||
},
|
||||
|
||||
editLink: {
|
||||
pattern: 'https://github.com/qmk/qmk_firmware/edit/master/docs/:path'
|
||||
},
|
||||
lastUpdated: true,
|
||||
|
||||
sidebar: sidebar,
|
||||
|
||||
externalLinkIcon: true,
|
||||
|
||||
socialLinks: [
|
||||
{ icon: { svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="50px" height="50px"><path d="M 29 3 C 28.0625 3 27.164063 3.382813 26.5 4 C 25.835938 4.617188 25.363281 5.433594 25 6.40625 C 24.355469 8.140625 24.085938 10.394531 24.03125 13.03125 C 19.234375 13.179688 14.820313 14.421875 11.28125 16.46875 C 10.214844 15.46875 8.855469 14.96875 7.5 14.96875 C 6.089844 14.96875 4.675781 15.511719 3.59375 16.59375 C 1.425781 18.761719 1.425781 22.238281 3.59375 24.40625 L 3.84375 24.65625 C 3.3125 26.035156 3 27.488281 3 29 C 3 33.527344 5.566406 37.585938 9.5625 40.4375 C 13.558594 43.289063 19.007813 45 25 45 C 30.992188 45 36.441406 43.289063 40.4375 40.4375 C 44.433594 37.585938 47 33.527344 47 29 C 47 27.488281 46.6875 26.035156 46.15625 24.65625 L 46.40625 24.40625 C 48.574219 22.238281 48.574219 18.761719 46.40625 16.59375 C 45.324219 15.511719 43.910156 14.96875 42.5 14.96875 C 41.144531 14.96875 39.785156 15.46875 38.71875 16.46875 C 35.195313 14.433594 30.800781 13.191406 26.03125 13.03125 C 26.09375 10.546875 26.363281 8.46875 26.875 7.09375 C 27.164063 6.316406 27.527344 5.757813 27.875 5.4375 C 28.222656 5.117188 28.539063 5 29 5 C 29.460938 5 29.683594 5.125 30.03125 5.40625 C 30.378906 5.6875 30.785156 6.148438 31.3125 6.6875 C 32.253906 7.652344 33.695313 8.714844 36.09375 8.9375 C 36.539063 11.238281 38.574219 13 41 13 C 43.75 13 46 10.75 46 8 C 46 5.25 43.75 3 41 3 C 38.605469 3 36.574219 4.710938 36.09375 6.96875 C 34.3125 6.796875 33.527344 6.109375 32.75 5.3125 C 32.300781 4.851563 31.886719 4.3125 31.3125 3.84375 C 30.738281 3.375 29.9375 3 29 3 Z M 41 5 C 42.667969 5 44 6.332031 44 8 C 44 9.667969 42.667969 11 41 11 C 39.332031 11 38 9.667969 38 8 C 38 6.332031 39.332031 5 41 5 Z M 25 15 C 30.609375 15 35.675781 16.613281 39.28125 19.1875 C 42.886719 21.761719 45 25.226563 45 29 C 45 32.773438 42.886719 36.238281 39.28125 38.8125 C 35.675781 41.386719 30.609375 43 25 43 C 19.390625 43 14.324219 41.386719 10.71875 38.8125 C 7.113281 36.238281 5 32.773438 5 29 C 5 25.226563 7.113281 21.761719 10.71875 19.1875 C 14.324219 16.613281 19.390625 15 25 15 Z M 7.5 16.9375 C 8.203125 16.9375 8.914063 17.148438 9.53125 17.59375 C 7.527344 19.03125 5.886719 20.769531 4.75 22.71875 C 3.582031 21.296875 3.660156 19.339844 5 18 C 5.714844 17.285156 6.609375 16.9375 7.5 16.9375 Z M 42.5 16.9375 C 43.390625 16.9375 44.285156 17.285156 45 18 C 46.339844 19.339844 46.417969 21.296875 45.25 22.71875 C 44.113281 20.769531 42.472656 19.03125 40.46875 17.59375 C 41.085938 17.148438 41.796875 16.9375 42.5 16.9375 Z M 17 22 C 14.800781 22 13 23.800781 13 26 C 13 28.199219 14.800781 30 17 30 C 19.199219 30 21 28.199219 21 26 C 21 23.800781 19.199219 22 17 22 Z M 33 22 C 30.800781 22 29 23.800781 29 26 C 29 28.199219 30.800781 30 33 30 C 35.199219 30 37 28.199219 37 26 C 37 23.800781 35.199219 22 33 22 Z M 17 24 C 18.117188 24 19 24.882813 19 26 C 19 27.117188 18.117188 28 17 28 C 15.882813 28 15 27.117188 15 26 C 15 24.882813 15.882813 24 17 24 Z M 33 24 C 34.117188 24 35 24.882813 35 26 C 35 27.117188 34.117188 28 33 28 C 31.882813 28 31 27.117188 31 26 C 31 24.882813 31.882813 24 33 24 Z M 34.15625 33.84375 C 34.101563 33.851563 34.050781 33.859375 34 33.875 C 33.683594 33.9375 33.417969 34.144531 33.28125 34.4375 C 33.28125 34.4375 32.757813 35.164063 31.4375 36 C 30.117188 36.835938 28.058594 37.6875 25 37.6875 C 21.941406 37.6875 19.882813 36.835938 18.5625 36 C 17.242188 35.164063 16.71875 34.4375 16.71875 34.4375 C 16.492188 34.082031 16.066406 33.90625 15.65625 34 C 15.332031 34.082031 15.070313 34.316406 14.957031 34.632813 C 14.84375 34.945313 14.894531 35.292969 15.09375 35.5625 C 15.09375 35.5625 15.863281 36.671875 17.46875 37.6875 C 19.074219 38.703125 21.558594 39.6875 25 39.6875 C 28.441406 39.6875 30.925781 38.703125 32.53125 37.6875 C 34.136719 36.671875 34.90625 35.5625 34.90625 35.5625 C 35.207031 35.273438 35.296875 34.824219 35.128906 34.441406 C 34.960938 34.058594 34.574219 33.820313 34.15625 33.84375 Z"/></svg>' }, link: "https://reddit.com/r/olkb" },
|
||||
{ icon: "discord", link: "https://discord.gg/qmk" },
|
||||
|
@ -36,6 +36,7 @@ GENERIC_FEATURES = \
|
||||
HAPTIC \
|
||||
KEY_LOCK \
|
||||
KEY_OVERRIDE \
|
||||
LAYER_LOCK \
|
||||
LEADER \
|
||||
MAGIC \
|
||||
MOUSEKEY \
|
||||
|
@ -84,7 +84,7 @@
|
||||
"group": "midi",
|
||||
"key": "QK_MIDI_NOTE_G_SHARP_0",
|
||||
"aliases": [
|
||||
"MI_Gs"
|
||||
"MI_Gs",
|
||||
"MI_Ab"
|
||||
]
|
||||
},
|
||||
@ -99,7 +99,7 @@
|
||||
"group": "midi",
|
||||
"key": "QK_MIDI_NOTE_A_SHARP_0",
|
||||
"aliases": [
|
||||
"MI_As"
|
||||
"MI_As",
|
||||
"MI_Bb"
|
||||
]
|
||||
},
|
||||
|
@ -2,131 +2,131 @@
|
||||
"keycodes": {
|
||||
"0x7E00": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_0",
|
||||
"key": "QK_KB_0"
|
||||
},
|
||||
"0x7E01": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_1",
|
||||
"key": "QK_KB_1"
|
||||
},
|
||||
"0x7E02": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_2",
|
||||
"key": "QK_KB_2"
|
||||
},
|
||||
"0x7E03": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_3",
|
||||
"key": "QK_KB_3"
|
||||
},
|
||||
"0x7E04": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_4",
|
||||
"key": "QK_KB_4"
|
||||
},
|
||||
"0x7E05": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_5",
|
||||
"key": "QK_KB_5"
|
||||
},
|
||||
"0x7E06": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_6",
|
||||
"key": "QK_KB_6"
|
||||
},
|
||||
"0x7E07": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_7",
|
||||
"key": "QK_KB_7"
|
||||
},
|
||||
"0x7E08": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_8",
|
||||
"key": "QK_KB_8"
|
||||
},
|
||||
"0x7E09": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_9",
|
||||
"key": "QK_KB_9"
|
||||
},
|
||||
"0x7E0A": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_10",
|
||||
"key": "QK_KB_10"
|
||||
},
|
||||
"0x7E0B": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_11",
|
||||
"key": "QK_KB_11"
|
||||
},
|
||||
"0x7E0C": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_12",
|
||||
"key": "QK_KB_12"
|
||||
},
|
||||
"0x7E0D": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_13",
|
||||
"key": "QK_KB_13"
|
||||
},
|
||||
"0x7E0E": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_14",
|
||||
"key": "QK_KB_14"
|
||||
},
|
||||
"0x7E0F": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_15",
|
||||
"key": "QK_KB_15"
|
||||
},
|
||||
"0x7E10": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_16",
|
||||
"key": "QK_KB_16"
|
||||
},
|
||||
"0x7E11": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_17",
|
||||
"key": "QK_KB_17"
|
||||
},
|
||||
"0x7E12": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_18",
|
||||
"key": "QK_KB_18"
|
||||
},
|
||||
"0x7E13": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_19",
|
||||
"key": "QK_KB_19"
|
||||
},
|
||||
"0x7E14": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_20",
|
||||
"key": "QK_KB_20"
|
||||
},
|
||||
"0x7E15": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_21",
|
||||
"key": "QK_KB_21"
|
||||
},
|
||||
"0x7E16": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_22",
|
||||
"key": "QK_KB_22"
|
||||
},
|
||||
"0x7E17": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_23",
|
||||
"key": "QK_KB_23"
|
||||
},
|
||||
"0x7E18": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_24",
|
||||
"key": "QK_KB_24"
|
||||
},
|
||||
"0x7E19": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_25",
|
||||
"key": "QK_KB_25"
|
||||
},
|
||||
"0x7E1A": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_26",
|
||||
},
|
||||
"key": "QK_KB_26"
|
||||
},
|
||||
"0x7E1B": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_27",
|
||||
"key": "QK_KB_27"
|
||||
},
|
||||
"0x7E1C": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_28",
|
||||
"key": "QK_KB_28"
|
||||
},
|
||||
"0x7E1D": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_29",
|
||||
"key": "QK_KB_29"
|
||||
},
|
||||
"0x7E1E": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_30",
|
||||
"key": "QK_KB_30"
|
||||
},
|
||||
"0x7E1F": {
|
||||
"group": "kb",
|
||||
"key": "QK_KB_31",
|
||||
},
|
||||
"key": "QK_KB_31"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@
|
||||
"group": "midi",
|
||||
"key": "QK_MIDI_NOTE_G_SHARP_0",
|
||||
"aliases": [
|
||||
"MI_Gs"
|
||||
"MI_Gs",
|
||||
"MI_Ab"
|
||||
]
|
||||
},
|
||||
@ -101,7 +101,7 @@
|
||||
"group": "midi",
|
||||
"key": "QK_MIDI_NOTE_A_SHARP_0",
|
||||
"aliases": [
|
||||
"MI_As"
|
||||
"MI_As",
|
||||
"MI_Bb"
|
||||
]
|
||||
},
|
||||
|
@ -2,131 +2,131 @@
|
||||
"keycodes": {
|
||||
"0x7E40": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_0",
|
||||
"key": "QK_USER_0"
|
||||
},
|
||||
"0x7E41": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_1",
|
||||
"key": "QK_USER_1"
|
||||
},
|
||||
"0x7E42": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_2",
|
||||
"key": "QK_USER_2"
|
||||
},
|
||||
"0x7E43": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_3",
|
||||
"key": "QK_USER_3"
|
||||
},
|
||||
"0x7E44": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_4",
|
||||
"key": "QK_USER_4"
|
||||
},
|
||||
"0x7E45": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_5",
|
||||
"key": "QK_USER_5"
|
||||
},
|
||||
"0x7E46": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_6",
|
||||
"key": "QK_USER_6"
|
||||
},
|
||||
"0x7E47": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_7",
|
||||
"key": "QK_USER_7"
|
||||
},
|
||||
"0x7E48": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_8",
|
||||
"key": "QK_USER_8"
|
||||
},
|
||||
"0x7E49": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_9",
|
||||
"key": "QK_USER_9"
|
||||
},
|
||||
"0x7E4A": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_10",
|
||||
"key": "QK_USER_10"
|
||||
},
|
||||
"0x7E4B": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_11",
|
||||
"key": "QK_USER_11"
|
||||
},
|
||||
"0x7E4C": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_12",
|
||||
"key": "QK_USER_12"
|
||||
},
|
||||
"0x7E4D": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_13",
|
||||
"key": "QK_USER_13"
|
||||
},
|
||||
"0x7E4E": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_14",
|
||||
"key": "QK_USER_14"
|
||||
},
|
||||
"0x7E4F": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_15",
|
||||
"key": "QK_USER_15"
|
||||
},
|
||||
"0x7E50": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_16",
|
||||
"key": "QK_USER_16"
|
||||
},
|
||||
"0x7E51": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_17",
|
||||
"key": "QK_USER_17"
|
||||
},
|
||||
"0x7E52": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_18",
|
||||
"key": "QK_USER_18"
|
||||
},
|
||||
"0x7E53": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_19",
|
||||
"key": "QK_USER_19"
|
||||
},
|
||||
"0x7E54": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_20",
|
||||
"key": "QK_USER_20"
|
||||
},
|
||||
"0x7E55": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_21",
|
||||
"key": "QK_USER_21"
|
||||
},
|
||||
"0x7E56": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_22",
|
||||
"key": "QK_USER_22"
|
||||
},
|
||||
"0x7E57": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_23",
|
||||
"key": "QK_USER_23"
|
||||
},
|
||||
"0x7E58": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_24",
|
||||
"key": "QK_USER_24"
|
||||
},
|
||||
"0x7E59": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_25",
|
||||
"key": "QK_USER_25"
|
||||
},
|
||||
"0x7E5A": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_26",
|
||||
},
|
||||
"key": "QK_USER_26"
|
||||
},
|
||||
"0x7E5B": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_27",
|
||||
"key": "QK_USER_27"
|
||||
},
|
||||
"0x7E5C": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_28",
|
||||
"key": "QK_USER_28"
|
||||
},
|
||||
"0x7E5D": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_29",
|
||||
"key": "QK_USER_29"
|
||||
},
|
||||
"0x7E5E": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_30",
|
||||
"key": "QK_USER_30"
|
||||
},
|
||||
"0x7E5F": {
|
||||
"group": "user",
|
||||
"key": "QK_USER_31",
|
||||
},
|
||||
"key": "QK_USER_31"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,41 +7,47 @@
|
||||
"keycodes": {
|
||||
"0x7780": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_NEXT",
|
||||
"key": "QK_OUTPUT_AUTO",
|
||||
"aliases": [
|
||||
"OU_NEXT",
|
||||
"OU_AUTO"
|
||||
]
|
||||
},
|
||||
"0x7781": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_NEXT",
|
||||
"aliases": [
|
||||
"OU_NEXT"
|
||||
]
|
||||
},
|
||||
"0x7782": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_PREV",
|
||||
"aliases": [
|
||||
"OU_PREV"
|
||||
]
|
||||
},
|
||||
"0x7782": {
|
||||
"0x7783": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_NONE",
|
||||
"aliases": [
|
||||
"OU_NONE"
|
||||
]
|
||||
},
|
||||
"0x7783": {
|
||||
"0x7784": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_USB",
|
||||
"aliases": [
|
||||
"OU_USB"
|
||||
]
|
||||
},
|
||||
"0x7784": {
|
||||
"0x7785": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_2P4GHZ",
|
||||
"aliases": [
|
||||
"OU_2P4G"
|
||||
]
|
||||
},
|
||||
"0x7785": {
|
||||
"0x7786": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_BLUETOOTH",
|
||||
"aliases": [
|
||||
|
@ -3,5 +3,12 @@
|
||||
"0x7C20": "!delete!", // old QK_OUTPUT_AUTO
|
||||
"0x7C21": "!delete!", // old QK_OUTPUT_USB
|
||||
"0x7C22": "!delete!", // old QK_OUTPUT_BLUETOOTH
|
||||
"0x7C7B": {
|
||||
"group": "quantum",
|
||||
"key": "QK_LAYER_LOCK",
|
||||
"aliases": [
|
||||
"QK_LLCK"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,9 @@
|
||||
"WEAR_LEVELING_BACKING_SIZE": {"info_key": "eeprom.wear_leveling.backing_size", "value_type": "int", "to_json": false},
|
||||
"WEAR_LEVELING_LOGICAL_SIZE": {"info_key": "eeprom.wear_leveling.logical_size", "value_type": "int", "to_json": false},
|
||||
|
||||
// Layer locking
|
||||
"LAYER_LOCK_IDLE_TIMEOUT": {"info_key": "layer_lock.timeout", "value_type": "int"},
|
||||
|
||||
// Indicators
|
||||
"LED_CAPS_LOCK_PIN": {"info_key": "indicators.caps_lock"},
|
||||
"LED_NUM_LOCK_PIN": {"info_key": "indicators.num_lock"},
|
||||
|
@ -92,6 +92,7 @@
|
||||
"GD32VF103",
|
||||
"WB32F3G71",
|
||||
"WB32FQ95",
|
||||
"AT32F415",
|
||||
"atmega16u2",
|
||||
"atmega32u2",
|
||||
"atmega16u4",
|
||||
@ -216,6 +217,7 @@
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"apm32-dfu",
|
||||
"at32-dfu",
|
||||
"atmel-dfu",
|
||||
"bootloadhid",
|
||||
"caterina",
|
||||
@ -373,6 +375,12 @@
|
||||
}
|
||||
},
|
||||
"keycodes": {"$ref": "qmk.definitions.v1#/keycode_decl_array"},
|
||||
"layer_lock": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"}
|
||||
}
|
||||
},
|
||||
"layout_aliases": {
|
||||
"type": "object",
|
||||
"additionalProperties": {"$ref": "qmk.definitions.v1#/layout_macro"}
|
||||
|
@ -16,6 +16,8 @@
|
||||
"/tutorial": "/newbs",
|
||||
"/unicode": "/feature_unicode",
|
||||
|
||||
"/features/bluetooth": "/features/wireless",
|
||||
|
||||
"/adc_driver": "/drivers/adc",
|
||||
"/apa102_driver": "/drivers/apa102",
|
||||
"/audio_driver": "/drivers/audio",
|
||||
@ -24,7 +26,7 @@
|
||||
"/feature_auto_shift": "/features/auto_shift",
|
||||
"/feature_autocorrect": "/features/autocorrect",
|
||||
"/feature_backlight": "/features/backlight",
|
||||
"/feature_bluetooth": "/features/bluetooth",
|
||||
"/feature_bluetooth": "/features/wireless",
|
||||
"/feature_bootmagic": "/features/bootmagic",
|
||||
"/feature_caps_word": "/features/caps_word",
|
||||
"/feature_combo": "/features/combo",
|
||||
|
@ -123,6 +123,7 @@
|
||||
{ "text": "Key Lock", "link": "/features/key_lock" },
|
||||
{ "text": "Key Overrides", "link": "/features/key_overrides" },
|
||||
{ "text": "Layers", "link": "/feature_layers" },
|
||||
{ "text": "Layer Lock", "link": "/features/layer_lock" },
|
||||
{ "text": "One Shot Keys", "link": "/one_shot_keys" },
|
||||
{ "text": "OS Detection", "link": "/features/os_detection" },
|
||||
{ "text": "Raw HID", "link": "/features/rawhid" },
|
||||
@ -166,7 +167,6 @@
|
||||
]
|
||||
},
|
||||
{ "text": "Audio", "link": "/features/audio" },
|
||||
{ "text": "Bluetooth", "link": "/features/bluetooth" },
|
||||
{ "text": "Bootmagic", "link": "/features/bootmagic" },
|
||||
{ "text": "Converters", "link": "/feature_converters" },
|
||||
{ "text": "Custom Matrix", "link": "/custom_matrix" },
|
||||
@ -179,7 +179,8 @@
|
||||
{ "text": "Pointing Device", "link": "/features/pointing_device" },
|
||||
{ "text": "PS/2 Mouse", "link": "/features/ps2_mouse" },
|
||||
{ "text": "Split Keyboard", "link": "/features/split_keyboard" },
|
||||
{ "text": "Stenography", "link": "/features/stenography" }
|
||||
{ "text": "Stenography", "link": "/features/stenography" },
|
||||
{ "text": "Wireless", "link": "/features/wireless" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ This page attempts to introduce developers to the QMK Compiler. It does not go i
|
||||
|
||||
# Overview
|
||||
|
||||
The QMK Compile API consists of a few movings parts:
|
||||
The QMK Compile API consists of a few moving parts:
|
||||
|
||||

|
||||
|
||||
|
@ -153,20 +153,26 @@ qmk cd
|
||||
|
||||
This command allows for searching through keyboard/keymap targets, filtering by specific criteria. `info.json` and `rules.mk` files contribute to the search data, as well as keymap configurations, and the results can be filtered using "dotty" syntax matching the overall `info.json` file format.
|
||||
|
||||
For example, one could search for all keyboards using STM32F411:
|
||||
For example, one could search for all keyboards powered by the STM32F411 microcontroller:
|
||||
|
||||
```
|
||||
qmk find -f 'processor=STM32F411'
|
||||
qmk find -f 'processor==STM32F411'
|
||||
```
|
||||
|
||||
...and one can further constrain the list to keyboards using STM32F411 as well as rgb_matrix support:
|
||||
The list can be further constrained by passing additional filter expressions:
|
||||
|
||||
```
|
||||
qmk find -f 'processor=STM32F411' -f 'features.rgb_matrix=true'
|
||||
qmk find -f 'processor==STM32F411' -f 'features.rgb_matrix==true'
|
||||
```
|
||||
|
||||
The following filter expressions are also supported:
|
||||
The following filter expressions are supported:
|
||||
|
||||
- `key == value`: Match targets where `key` is equal to `value`. May include wildcards such as `*` and `?`.
|
||||
- `key != value`: Match targets where `key` is not `value`. May include wildcards such as `*` and `?`.
|
||||
- `key < value`: Match targets where `key` is a number less than `value`.
|
||||
- `key > value`: Match targets where `key` is a number greater than `value`.
|
||||
- `key <= value`: Match targets where `key` is a number less than or equal to `value`.
|
||||
- `key >= value`: Match targets where `key` is a number greater than or equal to `value`.
|
||||
- `exists(key)`: Match targets where `key` is present.
|
||||
- `absent(key)`: Match targets where `key` is not present.
|
||||
- `contains(key, value)`: Match targets where `key` contains `value`. Can be used for strings, arrays and object keys.
|
||||
@ -175,7 +181,7 @@ The following filter expressions are also supported:
|
||||
You can also list arbitrary values for each matched target with `--print`:
|
||||
|
||||
```
|
||||
qmk find -f 'processor=STM32F411' -p 'keyboard_name' -p 'features.rgb_matrix'
|
||||
qmk find -f 'processor==STM32F411' -p 'keyboard_name' -p 'features.rgb_matrix'
|
||||
```
|
||||
|
||||
**Usage**:
|
||||
|
@ -57,6 +57,10 @@ You can also use any ARM chip with USB that [ChibiOS](https://www.chibios.org) s
|
||||
* [WB32F3G71xx](http://www.westberrytech.com)
|
||||
* [WB32FQ95xx](http://www.westberrytech.com)
|
||||
|
||||
### Artery (AT32)
|
||||
|
||||
* [AT32F415](https://www.arterychip.com/en/product/AT32F415.jsp)
|
||||
|
||||
### NXP (Kinetis)
|
||||
|
||||
* [MKL26Z64](https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/kl-series-cortex-m0-plus/kinetis-kl2x-72-96-mhz-usb-ultra-low-power-microcontrollers-mcus-based-on-arm-cortex-m0-plus-core:KL2x)
|
||||
|
@ -98,6 +98,7 @@ The device name here is the name that appears in Zadig, and may not be what the
|
||||
|`bootloadhid` |HIDBoot |`16C0:05DF` |HidUsb |
|
||||
|`usbasploader`|USBasp |`16C0:05DC` |libusbK|
|
||||
|`apm32-dfu` |APM32 DFU ISP Mode |`314B:0106` |WinUSB |
|
||||
|`at32-dfu` |AT32 Bootloader DFU |`2E3C:DF11` |WinUSB |
|
||||
|`stm32-dfu` |STM32 BOOTLOADER |`0483:DF11` |WinUSB |
|
||||
|`gd32v-dfu` |GD32V BOOTLOADER |`28E9:0189` |WinUSB |
|
||||
|`kiibohd` |Kiibohd DFU Bootloader |`1C11:B007` |WinUSB |
|
||||
|
@ -57,27 +57,32 @@ This driver needs one Timer per enabled/used DAC channel, to trigger conversion;
|
||||
|
||||
Additionally, in the board config, you'll want to make changes to enable the DACs, GPT for Timers 6, 7 and 8:
|
||||
|
||||
```c
|
||||
//halconf.h:
|
||||
#define HAL_USE_DAC TRUE
|
||||
#define HAL_USE_GPT TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_DAC TRUE // [!code focus]
|
||||
#define HAL_USE_GPT TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
```c
|
||||
// mcuconf.h:
|
||||
#include_next <mcuconf.h>
|
||||
#undef STM32_DAC_USE_DAC1_CH1
|
||||
#define STM32_DAC_USE_DAC1_CH1 TRUE
|
||||
#undef STM32_DAC_USE_DAC1_CH2
|
||||
#define STM32_DAC_USE_DAC1_CH2 TRUE
|
||||
#undef STM32_GPT_USE_TIM6
|
||||
#define STM32_GPT_USE_TIM6 TRUE
|
||||
#undef STM32_GPT_USE_TIM7
|
||||
#define STM32_GPT_USE_TIM7 TRUE
|
||||
#undef STM32_GPT_USE_TIM8
|
||||
#define STM32_GPT_USE_TIM8 TRUE
|
||||
|
||||
#undef STM32_DAC_USE_DAC1_CH1 // [!code focus]
|
||||
#define STM32_DAC_USE_DAC1_CH1 TRUE // [!code focus]
|
||||
#undef STM32_DAC_USE_DAC1_CH2 // [!code focus]
|
||||
#define STM32_DAC_USE_DAC1_CH2 TRUE // [!code focus]
|
||||
#undef STM32_GPT_USE_TIM6 // [!code focus]
|
||||
#define STM32_GPT_USE_TIM6 TRUE // [!code focus]
|
||||
#undef STM32_GPT_USE_TIM7 // [!code focus]
|
||||
#define STM32_GPT_USE_TIM7 TRUE // [!code focus]
|
||||
#undef STM32_GPT_USE_TIM8 // [!code focus]
|
||||
#define STM32_GPT_USE_TIM8 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
::: tip
|
||||
Note: DAC1 (A4) uses TIM6, DAC2 (A5) uses TIM7, and the audio state timer uses TIM8 (configurable).
|
||||
@ -95,23 +100,28 @@ only needs one timer (GPTD6, Tim6) to trigger the DAC unit to do a conversion; t
|
||||
|
||||
Additionally, in the board config, you'll want to make changes to enable the DACs, GPT for Timer 6:
|
||||
|
||||
```c
|
||||
//halconf.h:
|
||||
#define HAL_USE_DAC TRUE
|
||||
#define HAL_USE_GPT TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_DAC TRUE // [!code focus]
|
||||
#define HAL_USE_GPT TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
```c
|
||||
// mcuconf.h:
|
||||
#include_next <mcuconf.h>
|
||||
#undef STM32_DAC_USE_DAC1_CH1
|
||||
#define STM32_DAC_USE_DAC1_CH1 TRUE
|
||||
#undef STM32_DAC_USE_DAC1_CH2
|
||||
#define STM32_DAC_USE_DAC1_CH2 TRUE
|
||||
#undef STM32_GPT_USE_TIM6
|
||||
#define STM32_GPT_USE_TIM6 TRUE
|
||||
|
||||
#undef STM32_DAC_USE_DAC1_CH1 // [!code focus]
|
||||
#define STM32_DAC_USE_DAC1_CH1 TRUE // [!code focus]
|
||||
#undef STM32_DAC_USE_DAC1_CH2 // [!code focus]
|
||||
#define STM32_DAC_USE_DAC1_CH2 TRUE // [!code focus]
|
||||
#undef STM32_GPT_USE_TIM6 // [!code focus]
|
||||
#define STM32_GPT_USE_TIM6 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
### DAC Config
|
||||
|
||||
@ -170,19 +180,25 @@ This driver uses the ChibiOS-PWM system to produce a square-wave on specific out
|
||||
The hardware directly toggles the pin via its alternate function. See your MCU's data-sheet for which pin can be driven by what timer - looking for TIMx_CHy and the corresponding alternate function.
|
||||
|
||||
A configuration example for the STM32F103C8 would be:
|
||||
```c
|
||||
//halconf.h:
|
||||
#define HAL_USE_PWM TRUE
|
||||
#define HAL_USE_PAL TRUE
|
||||
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_PWM TRUE // [!code focus]
|
||||
#define HAL_USE_PAL TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
```c
|
||||
// mcuconf.h:
|
||||
#include_next <mcuconf.h>
|
||||
#undef STM32_PWM_USE_TIM1
|
||||
#define STM32_PWM_USE_TIM1 TRUE
|
||||
|
||||
#undef STM32_PWM_USE_TIM1 // [!code focus]
|
||||
#define STM32_PWM_USE_TIM1 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
If we now target pin A8, looking through the data-sheet of the STM32F103C8, for the timers and alternate functions
|
||||
- TIM1_CH1 = PA8 <- alternate0
|
||||
|
@ -54,18 +54,25 @@ The ATmega16/32U2 does not possess I2C functionality, and so cannot use this dri
|
||||
|
||||
You'll need to determine which pins can be used for I2C -- a an example, STM32 parts generally have multiple I2C peripherals, labeled I2C1, I2C2, I2C3 etc.
|
||||
|
||||
To enable I2C, modify your board's `halconf.h` to enable I2C:
|
||||
To enable I2C, modify your board's `halconf.h` to enable I2C, then modify your board's `mcuconf.h` to enable the peripheral you've chosen:
|
||||
|
||||
```c
|
||||
#define HAL_USE_I2C TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_I2C TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
Then, modify your board's `mcuconf.h` to enable the peripheral you've chosen, for example:
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
```c
|
||||
#undef STM32_I2C_USE_I2C2
|
||||
#define STM32_I2C_USE_I2C2 TRUE
|
||||
#undef STM32_I2C_USE_I2C2 // [!code focus]
|
||||
#define STM32_I2C_USE_I2C2 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
|`mcuconf.h` Setting |Description |Default|
|
||||
|----------------------------|----------------------------------------------------------------------------------|-------|
|
||||
|
@ -12,8 +12,6 @@ The Serial driver powers the [Split Keyboard](../features/split_keyboard) featur
|
||||
Serial in this context should be read as **sending information one bit at a time**, rather than implementing UART/USART/RS485/RS232 standards.
|
||||
:::
|
||||
|
||||
<hr>
|
||||
|
||||
## Bitbang
|
||||
|
||||
This is the Default driver, absence of configuration assumes this driver. It works by [bit banging](https://en.wikipedia.org/wiki/Bit_banging) a GPIO pin using the CPU. It is therefore not as efficient as a dedicated hardware peripheral, which the Half-duplex and Full-duplex drivers use.
|
||||
@ -53,11 +51,15 @@ SERIAL_DRIVER = bitbang
|
||||
#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
|
||||
```
|
||||
|
||||
3. On ARM platforms you must turn on ChibiOS `PAL_USE_CALLBACKS` feature:
|
||||
3. On ARM platforms you must turn on ChibiOS PAL callbacks:
|
||||
|
||||
* In `halconf.h` add the line `#define PAL_USE_CALLBACKS TRUE`.
|
||||
```c
|
||||
#pragma once
|
||||
|
||||
<hr>
|
||||
#define PAL_USE_CALLBACKS TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
|
||||
## USART Half-duplex
|
||||
|
||||
@ -117,8 +119,6 @@ For STM32 MCUs several GPIO configuration options can be changed as well. See th
|
||||
|
||||
4. Decide either for `SERIAL`, `SIO`, or `PIO` subsystem. See section ["Choosing a driver subsystem"](#choosing-a-driver-subsystem).
|
||||
|
||||
<hr>
|
||||
|
||||
## USART Full-duplex
|
||||
|
||||
Targeting ARM boards based on ChibiOS where communication is offloaded to an USART hardware device. The advantages over bitbanging are fast, accurate timings and reduced CPU usage; therefore it is advised to choose this driver over all others where possible. Due to its internal design Full-duplex is slightly more efficient than the Half-duplex driver, but Full-duplex should be primarily chosen if Half-duplex operation is not supported by the controller's USART peripheral.
|
||||
@ -179,38 +179,46 @@ For STM32 MCUs several GPIO configuration options, including the ability for `TX
|
||||
|
||||
4. Decide either for `SERIAL`, `SIO`, or `PIO` subsystem. See section ["Choosing a driver subsystem"](#choosing-a-driver-subsystem).
|
||||
|
||||
<hr>
|
||||
|
||||
## Choosing a driver subsystem
|
||||
|
||||
### The `SERIAL` driver
|
||||
|
||||
The `SERIAL` Subsystem is supported for the majority of ChibiOS MCUs and should be used whenever supported. Follow these steps in order to activate it:
|
||||
|
||||
1. In your keyboards `halconf.h` add:
|
||||
1. Enable the SERIAL subsystem in the ChibiOS HAL.
|
||||
|
||||
```c
|
||||
#define HAL_USE_SERIAL TRUE
|
||||
```
|
||||
Add the following to your keyboard's `halconf.h`, creating it if necessary:
|
||||
|
||||
2. In your keyboards `mcuconf.h`: activate the USART peripheral that is used on your MCU. The shown example is for an STM32 MCU, so this will not work on MCUs by other manufacturers. You can find the correct names in the `mcuconf.h` files of your MCU that ship with ChibiOS.
|
||||
|
||||
Just below `#include_next <mcuconf.h>` add:
|
||||
```c
|
||||
#pragma once
|
||||
|
||||
```c
|
||||
#include_next <mcuconf.h>
|
||||
#define HAL_USE_SERIAL TRUE // [!code focus]
|
||||
|
||||
#undef STM32_SERIAL_USE_USARTn
|
||||
#define STM32_SERIAL_USE_USARTn TRUE
|
||||
```
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
|
||||
Where 'n' matches the peripheral number of your selected USART on the MCU.
|
||||
2. Activate the USART peripheral that is used on your MCU. The shown example is for an STM32 MCU, so this will not work on MCUs by other manufacturers. You can find the correct names in the `mcuconf.h` files of your MCU that ship with ChibiOS.
|
||||
|
||||
3. In you keyboards `config.h`: override the default USART `SERIAL` driver if you use a USART peripheral that does not belong to the default selected `SD1` driver. For instance, if you selected `STM32_SERIAL_USE_USART3` the matching driver would be `SD3`.
|
||||
Add the following to your keyboard's `mcuconf.h`, creating it if necessary:
|
||||
|
||||
```c
|
||||
#define SERIAL_USART_DRIVER SD3
|
||||
```
|
||||
```c
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_SERIAL_USE_USARTn // [!code focus]
|
||||
#define STM32_SERIAL_USE_USARTn TRUE // [!code focus]
|
||||
```
|
||||
|
||||
Where *n* matches the peripheral number of your selected USART on the MCU.
|
||||
|
||||
3. Override the default USART `SERIAL` driver if you use a USART peripheral that does not belong to the default selected `SD1` driver. For instance, if you selected `STM32_SERIAL_USE_USART3` the matching driver would be `SD3`.
|
||||
|
||||
Add the following to your keyboard's `config.h`:
|
||||
|
||||
```c
|
||||
#define SERIAL_USART_DRIVER SD3
|
||||
```
|
||||
|
||||
### The `SIO` driver
|
||||
|
||||
@ -218,31 +226,41 @@ The `SIO` Subsystem was added to ChibiOS with the 21.11 release and is only supp
|
||||
|
||||
Follow these steps in order to activate it:
|
||||
|
||||
1. In your keyboards `halconf.h` add:
|
||||
1. Enable the SIO subsystem in the ChibiOS HAL.
|
||||
|
||||
```c
|
||||
#define HAL_USE_SIO TRUE
|
||||
```
|
||||
Add the following to your keyboard's `halconf.h`, creating it if necessary:
|
||||
|
||||
2. In your keyboards `mcuconf.h:` activate the USART peripheral that is used on your MCU. The shown example is for an STM32 MCU, so this will not work on MCUs by other manufacturers. You can find the correct names in the `mcuconf.h` files of your MCU that ship with ChibiOS.
|
||||
|
||||
Just below `#include_next <mcuconf.h>` add:
|
||||
```c
|
||||
#pragma once
|
||||
|
||||
```c
|
||||
#include_next <mcuconf.h>
|
||||
#define HAL_USE_SIO TRUE // [!code focus]
|
||||
|
||||
#undef STM32_SIO_USE_USARTn
|
||||
#define STM32_SIO_USE_USARTn TRUE
|
||||
```
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
|
||||
Where 'n' matches the peripheral number of your selected USART on the MCU.
|
||||
2. Activate the USART peripheral that is used on your MCU. The shown example is for an STM32 MCU, so this will not work on MCUs by other manufacturers. You can find the correct names in the `mcuconf.h` files of your MCU that ship with ChibiOS.
|
||||
|
||||
3. In the keyboard's `config.h` file: override the default USART `SIO` driver if you use a USART peripheral that does not belong to the default selected `SIOD1` driver. For instance, if you selected `STM32_SERIAL_USE_USART3` the matching driver would be `SIOD3`.
|
||||
Add the following to your keyboard's `mcuconf.h`, creating it if necessary:
|
||||
|
||||
```c
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_SIO_USE_USARTn // [!code focus]
|
||||
#define STM32_SIO_USE_USARTn TRUE // [!code focus]
|
||||
```
|
||||
|
||||
Where *n* matches the peripheral number of your selected USART on the MCU.
|
||||
|
||||
3. Override the default USART `SIO` driver if you use a USART peripheral that does not belong to the default selected `SIOD1` driver. For instance, if you selected `STM32_SERIAL_USE_USART3` the matching driver would be `SIOD3`.
|
||||
|
||||
Add the following to your keyboard's `config.h`:
|
||||
|
||||
```c
|
||||
#define SERIAL_USART_DRIVER SIOD3
|
||||
```
|
||||
|
||||
```c
|
||||
#define SERIAL_USART_DRIVER SIOD3
|
||||
```
|
||||
|
||||
### The `PIO` driver
|
||||
|
||||
The `PIO` subsystem is a Raspberry Pi RP2040 specific implementation, using an integrated PIO peripheral and is therefore only available on this MCU. Because of the flexible nature of PIO peripherals, **any** GPIO pin can be used as a `TX` or `RX` pin. Half-duplex and Full-duplex operation modes are fully supported with this driver. Half-duplex uses the built-in pull-ups and GPIO manipulation of the RP2040 to drive the line high by default, thus an external pull-up resistor **is not required**.
|
||||
@ -254,8 +272,6 @@ Optionally, the PIO peripheral utilized for split communication can be changed w
|
||||
|
||||
The Serial PIO program uses 2 state machines, 13 instructions and the complete interrupt handler of the PIO peripheral it is running on.
|
||||
|
||||
<hr>
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
There are several advanced configuration options that can be defined in your keyboards `config.h` file:
|
||||
@ -265,9 +281,11 @@ There are several advanced configuration options that can be defined in your key
|
||||
If you're having issues or need a higher baudrate with serial communication, you can change the baudrate which in turn controls the communication speed for serial. You want to lower the baudrate if you experience failed transactions.
|
||||
|
||||
```c
|
||||
#define SELECT_SOFT_SERIAL_SPEED {#}
|
||||
#define SELECT_SOFT_SERIAL_SPEED n
|
||||
```
|
||||
|
||||
Where *n* is one of:
|
||||
|
||||
| Speed | Bitbang | Half-duplex and Full-duplex |
|
||||
| ----- | -------------------------- | --------------------------- |
|
||||
| `0` | 189000 baud (experimental) | 460800 baud |
|
||||
@ -287,8 +305,6 @@ This is the default time window in milliseconds in which a successful communicat
|
||||
#define SERIAL_USART_TIMEOUT 20 // USART driver timeout. default 20
|
||||
```
|
||||
|
||||
<hr>
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you're having issues withe serial communication, you can enable debug messages that will give you insights which part of the communication failed. The enable these messages add to your keyboards `config.h` file:
|
||||
|
@ -32,20 +32,27 @@ You may use more than one slave select pin, not just the `SS` pin. This is usefu
|
||||
|
||||
You'll need to determine which pins can be used for SPI -- as an example, STM32 parts generally have multiple SPI peripherals, labeled SPI1, SPI2, SPI3 etc.
|
||||
|
||||
To enable SPI, modify your board's `halconf.h` to enable SPI:
|
||||
To enable SPI, modify your board's `halconf.h` to enable SPI, then modify your board's `mcuconf.h` to enable the peripheral you've chosen:
|
||||
|
||||
```c
|
||||
#define HAL_USE_SPI TRUE
|
||||
#define SPI_USE_WAIT TRUE
|
||||
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_SPI TRUE // [!code focus]
|
||||
#define SPI_USE_WAIT TRUE // [!code focus]
|
||||
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
Then, modify your board's `mcuconf.h` to enable the peripheral you've chosen, for example:
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
```c
|
||||
#undef STM32_SPI_USE_SPI2
|
||||
#define STM32_SPI_USE_SPI2 TRUE
|
||||
#undef STM32_SPI_USE_SPI2 // [!code focus]
|
||||
#define STM32_SPI_USE_SPI2 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
Configuration-wise, you'll need to set up the peripheral as per your MCU's datasheet -- the defaults match the pins for a Proton-C, i.e. STM32F303.
|
||||
|
||||
|
@ -35,8 +35,12 @@ You'll need to determine which pins can be used for UART -- as an example, STM32
|
||||
To enable UART, modify your board's `mcuconf.h` to enable the peripheral you've chosen, for example:
|
||||
|
||||
```c
|
||||
#undef STM32_SERIAL_USE_USART2
|
||||
#define STM32_SERIAL_USE_USART2 TRUE
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_SERIAL_USE_USART2 // [!code focus]
|
||||
#define STM32_SERIAL_USE_USART2 TRUE // [!code focus]
|
||||
```
|
||||
|
||||
Configuration-wise, you'll need to set up the peripheral as per your MCU's datasheet -- the defaults match the pins for a Proton-C, i.e. STM32F303.
|
||||
|
@ -160,15 +160,23 @@ To configure the DI pin for open drain configuration, add the following to your
|
||||
|
||||
Depending on the ChibiOS board configuration, you may need to enable SPI at the keyboard level. For STM32, this would look like:
|
||||
|
||||
`halconf.h`:
|
||||
```c
|
||||
#define HAL_USE_SPI TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_SPI TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
`mcuconf.h`:
|
||||
```c
|
||||
#undef STM32_SPI_USE_SPI1
|
||||
#define STM32_SPI_USE_SPI1 TRUE
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_SPI_USE_SPI1 // [!code focus]
|
||||
#define STM32_SPI_USE_SPI1 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
The following `define`s apply only to the `spi` driver:
|
||||
|
||||
@ -213,15 +221,23 @@ The following `#define`s apply only to the PIO driver:
|
||||
|
||||
Depending on the ChibiOS board configuration, you may need to enable PWM at the keyboard level. For STM32, this would look like:
|
||||
|
||||
`halconf.h`:
|
||||
```c
|
||||
#define HAL_USE_PWM TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_PWM TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
`mcuconf.h`:
|
||||
```c
|
||||
#undef STM32_PWM_USE_TIM2
|
||||
#define STM32_PWM_USE_TIM2 TRUE
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_PWM_USE_TIM2 // [!code focus]
|
||||
#define STM32_PWM_USE_TIM2 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
The following `#define`s apply only to the `pwm` driver:
|
||||
|
||||
|
@ -11,7 +11,7 @@ These allow you to combine a modifier with a keycode. When pressed, the keydown
|
||||
|`RCTL(kc)`| |Hold Right Control and press `kc` |
|
||||
|`RSFT(kc)`| |Hold Right Shift and press `kc` |
|
||||
|`RALT(kc)`|`ROPT(kc)`, `ALGR(kc)` |Hold Right Alt and press `kc` |
|
||||
|`RGUI(kc)`|`RCMD(kc)`, `LWIN(kc)` |Hold Right GUI and press `kc` |
|
||||
|`RGUI(kc)`|`RCMD(kc)`, `RWIN(kc)` |Hold Right GUI and press `kc` |
|
||||
|`LSG(kc)` |`SGUI(kc)`, `SCMD(kc)`, `SWIN(kc)`|Hold Left Shift and GUI and press `kc` |
|
||||
|`LAG(kc)` | |Hold Left Alt and Left GUI and press `kc` |
|
||||
|`RSG(kc)` | |Hold Right Shift and Right GUI and press `kc` |
|
||||
|
@ -17,6 +17,9 @@ These functions allow you to activate layers in various ways. Note that layers a
|
||||
* `TO(layer)` - activates *layer* and de-activates all other layers (except your default layer). This function is special, because instead of just adding/removing one layer to your active layer stack, it will completely replace your current active layers, uniquely allowing you to replace higher layers with a lower one. This is activated on keydown (as soon as the key is pressed).
|
||||
* `TT(layer)` - Layer Tap-Toggle. If you hold the key down, *layer* is activated, and then is de-activated when you let go (like `MO`). If you repeatedly tap it, the layer will be toggled on or off (like `TG`). It needs 5 taps by default, but you can change this by defining `TAPPING_TOGGLE` -- for example, `#define TAPPING_TOGGLE 2` to toggle on just two taps.
|
||||
|
||||
See also the [Layer Lock key](features/layer_lock), which locks the highest
|
||||
active layer until pressed again.
|
||||
|
||||
### Caveats {#caveats}
|
||||
|
||||
Currently, the `layer` argument of `LT()` is limited to layers 0-15, and the `kc` argument to the [Basic Keycode set](keycodes_basic), meaning you can't use keycodes like `LCTL()`, `KC_TILD`, or anything greater than `0xFF`. This is because QMK uses 16-bit keycodes, of which 4 bits are used for the function identifier and 4 bits for the layer, leaving only 8 bits for the keycode.
|
||||
|
@ -42,38 +42,7 @@ You can define up to 32 macros in a `keymap.json` file, as used by [Configurator
|
||||
|
||||
### Selecting Your Host Keyboard Layout
|
||||
|
||||
If you type in a language other than English, or use a non-QWERTY layout like Colemak, Dvorak, or Workman, you may have set your computer's input language to match this layout. This presents a challenge when creating macros - you may need to type different keys to get the same letters! To address this you can add the `host_language` key to your `keymap.json`, like so:
|
||||
|
||||
```json
|
||||
{
|
||||
"keyboard": "handwired/my_macropad",
|
||||
"keymap": "my_keymap",
|
||||
"host_language": "dvorak",
|
||||
"macros": [
|
||||
["Hello, World!"]
|
||||
],
|
||||
"layout": "LAYOUT_all",
|
||||
"layers": [
|
||||
["QK_MACRO_0"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The current list of available languages is:
|
||||
|
||||
| belgian | bepo | br_abnt2 | canadian_multilingual |
|
||||
|:-------:|:----:|:--------:|:---------------------:|
|
||||
| **colemak** | **croatian** | **czech** | **danish** |
|
||||
| **dvorak_fr** | **dvorak** | **dvp** | **estonian** |
|
||||
| **finnish** | **fr_ch** | **french_afnor** | **french** |
|
||||
| **french_osx** | **german_ch** | **german** | **german_osx** |
|
||||
| **hungarian** | **icelandic** | **italian** | **italian_osx_ansi** |
|
||||
| **italian_osx_iso** | **jis** | **latvian** | **lithuanian_azerty** |
|
||||
| **lithuanian_qwerty** | **norman** | **norwegian** | **portuguese** |
|
||||
| **portuguese_osx_iso** | **romanian** | **serbian_latin** | **slovak** |
|
||||
| **slovenian** | **spanish_dvorak** | **spanish_latin_america** | **spanish** |
|
||||
| **swedish** | **turkish_f** | **turkish_q** | **uk** |
|
||||
| **us_international** | **workman** | **workman_zxcvm** |
|
||||
If you type in a language other than English, or use a non-QWERTY layout like Colemak, Dvorak, or Workman, you may have set your computer's input language to match this layout. This presents a challenge when creating macros — you may need to type different keys to get the same letters! To address this you can use [language-specific keycodes](reference_keymap_extras).
|
||||
|
||||
### Macro Basics
|
||||
|
||||
|
@ -161,15 +161,23 @@ Note that the choice of timer may conflict with the [Audio](audio) feature.
|
||||
|
||||
Depending on the ChibiOS board configuration, you may need to enable PWM at the keyboard level. For STM32, this would look like:
|
||||
|
||||
`halconf.h`:
|
||||
```c
|
||||
#define HAL_USE_PWM TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_PWM TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
`mcuconf.h`:
|
||||
```c
|
||||
#undef STM32_PWM_USE_TIM4
|
||||
#define STM32_PWM_USE_TIM4 TRUE
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_PWM_USE_TIM4 // [!code focus]
|
||||
#define STM32_PWM_USE_TIM4 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
The following `#define`s apply only to the `pwm` driver:
|
||||
|
||||
@ -187,15 +195,23 @@ Refer to the ST datasheet for your particular MCU to determine these values. For
|
||||
|
||||
Depending on the ChibiOS board configuration, you may need to enable general-purpose timers at the keyboard level. For STM32, this would look like:
|
||||
|
||||
`halconf.h`:
|
||||
```c
|
||||
#define HAL_USE_GPT TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_GPT TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
`mcuconf.h`:
|
||||
```c
|
||||
#undef STM32_GPT_USE_TIM15
|
||||
#define STM32_GPT_USE_TIM15 TRUE
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_GPT_USE_TIM15 // [!code focus]
|
||||
#define STM32_GPT_USE_TIM15 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
The following `#define`s apply only to the `timer` driver:
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Joystick {#joystick}
|
||||
|
||||
This feature provides game controller input as a joystick device supporting up to 6 axes and 32 buttons. Axes can be read either from an [ADC-capable input pin](../drivers/adc), or can be virtual, so that its value is provided by your code.
|
||||
This feature provides game controller input as a joystick device supporting up to 6 axes, 32 buttons and a hat switch. Axes can be read either from an [ADC-capable input pin](../drivers/adc), or can be virtual, so that its value is provided by your code.
|
||||
|
||||
An analog device such as a [potentiometer](https://en.wikipedia.org/wiki/Potentiometer) found on an analog joystick's axes is based on a voltage divider, where adjusting the movable wiper controls the output voltage which can then be read by the microcontroller's ADC.
|
||||
|
||||
@ -37,6 +37,42 @@ By default, two axes and eight buttons are defined, with a reported resolution o
|
||||
You must define at least one button or axis. Also note that the maximum ADC resolution of the supported AVR MCUs is 10-bit, and 12-bit for most STM32 MCUs.
|
||||
:::
|
||||
|
||||
### Hat Switch {#hat-switch}
|
||||
|
||||
To enable the 8-way hat switch, add the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define JOYSTICK_HAS_HAT
|
||||
````
|
||||
|
||||
The position can be set by calling `joystick_set_hat(value)`. The range of values moves clockwise from the top (ie. north), with the default "center" position represented by a value of `-1`:
|
||||
|
||||
```
|
||||
0
|
||||
7 N 1
|
||||
NW .--'--. NE
|
||||
/ \
|
||||
6 W | -1 | E 2
|
||||
\ /
|
||||
SW '--.--' SE
|
||||
5 S 3
|
||||
4
|
||||
```
|
||||
|
||||
Alternatively you can use these predefined names:
|
||||
|
||||
|Define |Value|Angle|
|
||||
|------------------------|-----|-----|
|
||||
|`JOYSTICK_HAT_CENTER` |`-1` | |
|
||||
|`JOYSTICK_HAT_NORTH` |`0` |0° |
|
||||
|`JOYSTICK_HAT_NORTHEAST`|`1` |45° |
|
||||
|`JOYSTICK_HAT_EAST` |`2` |90° |
|
||||
|`JOYSTICK_HAT_SOUTHEAST`|`3` |135° |
|
||||
|`JOYSTICK_HAT_SOUTH` |`4` |180° |
|
||||
|`JOYSTICK_HAT_SOUTHWEST`|`5` |225° |
|
||||
|`JOYSTICK_HAT_WEST` |`6` |270° |
|
||||
|`JOYSTICK_HAT_NORTHWEST`|`7` |315° |
|
||||
|
||||
### Axes {#axes}
|
||||
|
||||
When defining axes for your joystick, you must provide a definition array typically in your `keymap.c`.
|
||||
@ -149,6 +185,8 @@ Contains the state of the joystick.
|
||||
A bit-packed array containing the joystick button states. The size is calculated as `(JOYSTICK_BUTTON_COUNT - 1) / 8 + 1`.
|
||||
- `int16_t axes[]`
|
||||
An array of analog values for each defined axis.
|
||||
- `int8_t hat`
|
||||
The hat switch position.
|
||||
- `bool dirty`
|
||||
Whether the current state needs to be sent to the host.
|
||||
|
||||
@ -222,3 +260,14 @@ Set the value of the given axis.
|
||||
The axis to set the value of.
|
||||
- `int16_t value`
|
||||
The value to set.
|
||||
|
||||
---
|
||||
|
||||
### `void joystick_set_hat(int8_t value)` {#api-joystick-set-hat}
|
||||
|
||||
Set the position of the hat switch.
|
||||
|
||||
#### Arguments {#api-joystick-set-hat-arguments}
|
||||
|
||||
- `int8_t value`
|
||||
The hat switch position to set.
|
||||
|
139
docs/features/layer_lock.md
Normal file
139
docs/features/layer_lock.md
Normal file
@ -0,0 +1,139 @@
|
||||
# Layer Lock
|
||||
|
||||
Some [layer switches](../feature_layers#switching-and-toggling-layers) access
|
||||
the layer by holding the key, including momentary layer `MO(layer)` and layer
|
||||
tap `LT(layer, key)` keys. You may sometimes need to stay on the layer for a
|
||||
long period of time. Layer Lock "locks" the current layer to stay on, supposing
|
||||
it was accessed by one of:
|
||||
|
||||
* `MO(layer)` momentary layer switch
|
||||
* `LT(layer, key)` layer tap
|
||||
* `OSL(layer)` one-shot layer
|
||||
* `TT(layer)` layer tap toggle
|
||||
* `LM(layer, mod)` layer-mod key (the layer is locked, but not the mods)
|
||||
|
||||
Press the Layer Lock key again to unlock the layer. Additionally, when a layer
|
||||
is locked, layer switch keys that turn off the layer such as `TO(other_layer)`
|
||||
will unlock it.
|
||||
|
||||
|
||||
## How do I enable Layer Lock
|
||||
|
||||
In your rules.mk, add:
|
||||
|
||||
```make
|
||||
LAYER_LOCK_ENABLE = yes
|
||||
```
|
||||
|
||||
Pick a key in your keymap on a layer you intend to lock, and assign it the
|
||||
keycode `QK_LAYER_LOCK` (short alias `QK_LLCK`). Note that locking the base
|
||||
layer has no effect, so typically, this key is used on layers above the base
|
||||
layer.
|
||||
|
||||
|
||||
## Example use
|
||||
|
||||
Consider a keymap with the following base layer.
|
||||
|
||||

|
||||
|
||||
The highlighted key is a momentary layer switch `MO(NAV)`. Holding it accesses a
|
||||
navigation layer.
|
||||
|
||||

|
||||
|
||||
|
||||
Holding the NAV key is fine for brief use, but awkward to continue holding when
|
||||
using navigation functions continuously. The Layer Lock key comes to the rescue:
|
||||
|
||||
1. Hold the NAV key, activating the navigation layer.
|
||||
2. Tap Layer Lock.
|
||||
3. Release NAV. The navigation layer stays on.
|
||||
4. Make use of the arrow keys, etc.
|
||||
5. Tap Layer Lock or NAV again to turn the navigation layer back off.
|
||||
|
||||
A variation that would also work is to put the Layer Lock key on the base layer
|
||||
and make other layers transparent (`KC_TRNS`) in that position. Pressing the
|
||||
Layer Lock key locks (or unlocks) the highest active layer, regardless of which
|
||||
layer the Layer Lock key is on.
|
||||
|
||||
|
||||
## Idle timeout
|
||||
|
||||
Optionally, Layer Lock may be configured to unlock if the keyboard is idle
|
||||
for some time. In config.h, define `LAYER_LOCK_IDLE_TIMEOUT` in units of
|
||||
milliseconds:
|
||||
|
||||
```c
|
||||
#define LAYER_LOCK_IDLE_TIMEOUT 60000 // Turn off after 60 seconds.
|
||||
```
|
||||
|
||||
|
||||
## Functions
|
||||
|
||||
Use the following functions to query and manipulate the layer lock state.
|
||||
|
||||
| Function | Description |
|
||||
|----------------------------|------------------------------------|
|
||||
| `is_layer_locked(layer)` | Checks whether `layer` is locked. |
|
||||
| `layer_lock_on(layer)` | Locks and turns on `layer`. |
|
||||
| `layer_lock_off(layer)` | Unlocks and turns off `layer`. |
|
||||
| `layer_lock_invert(layer)` | Toggles whether `layer` is locked. |
|
||||
|
||||
|
||||
## Representing the current Layer Lock state
|
||||
|
||||
There is an optional callback `layer_lock_set_user()` that gets called when a
|
||||
layer is locked or unlocked. This is useful to represent the current lock state
|
||||
for instance by setting an LED. In keymap.c, define
|
||||
|
||||
```c
|
||||
bool layer_lock_set_user(layer_state_t locked_layers) {
|
||||
// Do something like `set_led(is_layer_locked(NAV));`
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
The argument `locked_layers` is a bitfield in which the kth bit is on if the kth
|
||||
layer is locked. Alternatively, you can use `is_layer_locked(layer)` to check if
|
||||
a given layer is locked.
|
||||
|
||||
|
||||
## Combine Layer Lock with a mod-tap
|
||||
|
||||
It is possible to create a [mod-tap MT key](../mod_tap) that acts as a modifier
|
||||
on hold and Layer Lock on tap. Since Layer Lock is not a [basic
|
||||
keycode](../keycodes_basic), attempting `MT(mod, QK_LLCK)` is invalid does not
|
||||
work directly, yet this effect can be achieved through [changing the tap
|
||||
function](../mod_tap#changing-tap-function). For example, the following
|
||||
implements a `SFTLLCK` key that acts as Shift on hold and Layer Lock on tap:
|
||||
|
||||
```c
|
||||
#define SFTLLCK LSFT_T(KC_0)
|
||||
|
||||
// Use SFTLLCK in your keymap...
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case SFTLLCK:
|
||||
if (record->tap.count) {
|
||||
if (record->event.pressed) {
|
||||
// Toggle the lock on the highest layer.
|
||||
layer_lock_invert(get_highest_layer(layer_state));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
// Other macros...
|
||||
}
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
In the above, `KC_0` is an arbitrary placeholder for the tapping keycode. This
|
||||
keycode will never be sent, so any basic keycode will do. In
|
||||
`process_record_user()`, the tap press event is changed to toggle the lock on
|
||||
the highest layer. Layer Lock can be combined with a [layer-tap LT
|
||||
key](../feature_layers#switching-and-toggling-layers) similarly.
|
||||
|
@ -90,18 +90,22 @@ PS2_ENABLE = yes
|
||||
PS2_DRIVER = interrupt
|
||||
```
|
||||
|
||||
In your keyboard config.h:
|
||||
In your keyboard `config.h`:
|
||||
|
||||
```c
|
||||
#define PS2_CLOCK_PIN A8
|
||||
#define PS2_DATA_PIN A9
|
||||
```
|
||||
|
||||
And in the chibios specifig halconf.h:
|
||||
```c
|
||||
#define PAL_USE_CALLBACKS TRUE
|
||||
```
|
||||
And in the ChibiOS specific `halconf.h`:
|
||||
|
||||
```c
|
||||
#pragma once
|
||||
|
||||
#define PAL_USE_CALLBACKS TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
|
||||
### USART Version {#usart-version}
|
||||
|
||||
|
@ -59,6 +59,10 @@ Changing the **Value** sets the overall brightness.<br>
|
||||
|
||||
## Keycodes
|
||||
|
||||
::: warning
|
||||
These keycodes also simultaneously control [RGB Matrix](rgb_matrix), if enabled. This behaviour is in the process of being deprecated, so during this time it is recommended to additionally include the dedicated RGB Matrix keycodes to your keymap, and add `#define RGB_MATRIX_DISABLE_SHARED_KEYCODES` to `config.h`.
|
||||
:::
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|------------------------------|----------|---------------------------------------------------------------------|
|
||||
|`QK_UNDERGLOW_TOGGLE` |`UG_TOGG` |Toggle RGB lighting on or off |
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Bluetooth
|
||||
# Wireless / Bluetooth
|
||||
|
||||
## Bluetooth Known Supported Hardware
|
||||
|
||||
@ -39,8 +39,20 @@ BLUETOOTH_DRIVER = bluefruit_le # or rn42
|
||||
|
||||
This is used when multiple keyboard outputs can be selected. Currently this only allows for switching between USB and Bluetooth on keyboards that support both.
|
||||
|
||||
| Key | Aliases | Description |
|
||||
|-----------------------|----------------------|------------------------------------------------|
|
||||
| `QK_OUTPUT_NEXT` | `OU_NEXT`, `OU_AUTO` | Automatically switch between USB and Bluetooth |
|
||||
| `QK_OUTPUT_USB` | `OU_USB` | USB only |
|
||||
| `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Bluetooth only |
|
||||
| Key | Aliases | Description |
|
||||
|-----------------------------|-----------|-----------------------------------------------------------------------------------------------|
|
||||
| `QK_OUTPUT_AUTO` | `OU_AUTO` | Automatically switch to USB when plugged in, otherwise use wireless |
|
||||
| `QK_OUTPUT_NEXT` | `OU_NEXT` | Cycle forwards through USB, Bluetooth, and 2.4GHz (when available) **(not yet implemented)** |
|
||||
| `QK_OUTPUT_PREV` | `OU_PREV` | Cycle backwards through USB, Bluetooth, and 2.4GHz (when available) **(not yet implemented)** |
|
||||
| `QK_OUTPUT_NONE` | `OU_NONE` | Disable all output **(not yet implemented)** |
|
||||
| `QK_OUTPUT_USB` | `OU_USB` | Output to USB only |
|
||||
| `QK_OUTPUT_2P4GHZ` | `OU_2P4G` | Output to 2.4GHz only **(not yet implemented)** |
|
||||
| `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Output to Bluetooth only |
|
||||
| `QK_BLUETOOTH_PROFILE_NEXT` | `BT_NEXT` | Move to the next Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE_PREV` | `BT_PREV` | Move to the previous Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_UNPAIR` | `BT_UNPR` | Un-pair the current Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE1` | `BT_PRF1` | Swap to Bluetooth profile #1 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE2` | `BT_PRF2` | Swap to Bluetooth profile #2 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE3` | `BT_PRF3` | Swap to Bluetooth profile #3 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE4` | `BT_PRF4` | Swap to Bluetooth profile #4 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE5` | `BT_PRF5` | Swap to Bluetooth profile #5 **(not yet implemented)** |
|
@ -345,6 +345,39 @@ Flashing sequence:
|
||||
3. Flash a .bin file
|
||||
4. Reset the device into application mode (may be done automatically)
|
||||
|
||||
## AT32 DFU
|
||||
|
||||
All AT32 MCUs come preloaded with a factory bootloader that cannot be modified nor deleted.
|
||||
|
||||
To ensure compatibility with the AT32-DFU bootloader, make sure this block is present in your `rules.mk`:
|
||||
|
||||
```make
|
||||
# Bootloader selection
|
||||
BOOTLOADER = at32-dfu
|
||||
```
|
||||
|
||||
Compatible flashers:
|
||||
|
||||
* [dfu-util](https://dfu-util.sourceforge.net/) / `:dfu-util` target in QMK (recommended command line)
|
||||
```
|
||||
dfu-util -a 0 -d 2E3C:DF11 -s 0x8000000:leave -D <filename>
|
||||
```
|
||||
|
||||
Flashing sequence:
|
||||
|
||||
1. Enter the bootloader using any of the following methods:
|
||||
* Tap the `QK_BOOT` keycode
|
||||
* If a reset circuit is present, tap the `RESET` button on the PCB; some boards may also have a toggle switch that must be flipped
|
||||
* Otherwise, you need to bridge `BOOT0` to VCC (via `BOOT0` button or jumper), short `RESET` to GND (via `RESET` button or jumper), and then let go of the `BOOT0` bridge
|
||||
2. Wait for the OS to detect the device
|
||||
3. Flash a .bin file
|
||||
4. Reset the device into application mode (may be done automatically)
|
||||
|
||||
### `make` Targets
|
||||
|
||||
* `:dfu-util`: Waits until an AT32 bootloader device is available, and then flashes the firmware.
|
||||
* `:dfu-util-split-left` and `:dfu-util-split-right`: Flashes the firmware as with `:dfu-util`, but also sets the handedness setting in EEPROM.
|
||||
|
||||
## tinyuf2
|
||||
|
||||
Keyboards may opt into supporting the tinyuf2 bootloader. This is currently only supported on F303/F401/F411.
|
||||
|
@ -290,15 +290,27 @@ See also: [Backlighting](features/backlight)
|
||||
| `QK_BACKLIGHT_DOWN` | `BL_DOWN` | Decrease the backlight level |
|
||||
| `QK_BACKLIGHT_TOGGLE_BREATHING` | `BL_BRTG` | Toggle backlight breathing |
|
||||
|
||||
## Bluetooth {#bluetooth}
|
||||
## Wireless/Bluetooth {#bluetooth}
|
||||
|
||||
See also: [Bluetooth](features/bluetooth)
|
||||
See also: [Wireless](features/wireless)
|
||||
|
||||
| Key | Aliases | Description |
|
||||
|-----------------------|----------------------|------------------------------------------------|
|
||||
| `QK_OUTPUT_NEXT` | `OU_NEXT`, `OU_AUTO` | Automatically switch between USB and Bluetooth |
|
||||
| `QK_OUTPUT_USB` | `OU_USB` | USB only |
|
||||
| `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Bluetooth only |
|
||||
| Key | Aliases | Description |
|
||||
|-----------------------------|-----------|-----------------------------------------------------------------------------------------------|
|
||||
| `QK_OUTPUT_AUTO` | `OU_AUTO` | Automatically switch to USB when plugged in, otherwise use wireless |
|
||||
| `QK_OUTPUT_NEXT` | `OU_NEXT` | Cycle forwards through USB, Bluetooth, and 2.4GHz (when available) **(not yet implemented)** |
|
||||
| `QK_OUTPUT_PREV` | `OU_PREV` | Cycle backwards through USB, Bluetooth, and 2.4GHz (when available) **(not yet implemented)** |
|
||||
| `QK_OUTPUT_NONE` | `OU_NONE` | Disable all output **(not yet implemented)** |
|
||||
| `QK_OUTPUT_USB` | `OU_USB` | Output to USB only |
|
||||
| `QK_OUTPUT_2P4GHZ` | `OU_2P4G` | Output to 2.4GHz only **(not yet implemented)** |
|
||||
| `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Output to Bluetooth only |
|
||||
| `QK_BLUETOOTH_PROFILE_NEXT` | `BT_NEXT` | Move to the next Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE_PREV` | `BT_PREV` | Move to the previous Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_UNPAIR` | `BT_UNPR` | Un-pair the current Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE1` | `BT_PRF1` | Swap to Bluetooth profile #1 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE2` | `BT_PRF2` | Swap to Bluetooth profile #2 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE3` | `BT_PRF3` | Swap to Bluetooth profile #3 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE4` | `BT_PRF4` | Swap to Bluetooth profile #4 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE5` | `BT_PRF5` | Swap to Bluetooth profile #5 **(not yet implemented)** |
|
||||
|
||||
## Caps Word {#caps-word}
|
||||
|
||||
@ -375,6 +387,14 @@ See also: [Key Lock](features/key_lock)
|
||||
|---------|--------------------------------------------------------------|
|
||||
|`QK_LOCK`|Hold down the next key pressed, until the key is pressed again|
|
||||
|
||||
## Layer Lock {#layer-lock}
|
||||
|
||||
See also: [Layer Lock](features/layer_lock)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|---------------|---------|----------------------------------|
|
||||
|`QK_LAYER_LOCK`|`QK_LLCK`|Locks or unlocks the highest layer|
|
||||
|
||||
## Layer Switching {#layer-switching}
|
||||
|
||||
See also: [Layer Switching](feature_layers#switching-and-toggling-layers)
|
||||
|
@ -4,7 +4,7 @@ Your computer keyboard has a processor inside of it, similar to the one inside y
|
||||
|
||||
QMK tries to put a lot of power into your hands by making easy things easy, and hard things possible. You don't have to know how to program to create powerful keymaps — you only have to follow a few simple syntax rules.
|
||||
|
||||
Not sure if your keyboard can run QMK? If it's a mechanical keyboard you built yourself chances are good it can. We support a [large number of hobbyist boards](https://qmk.fm/keyboards/). If your current keyboard can't run QMK there are a lot of choices out there for boards that do.
|
||||
Not sure if your keyboard can run QMK? If it's a mechanical keyboard you built yourself chances are good it can. We support a [large number of hobbyist boards](https://browse.qmk.fm/). If your current keyboard can't run QMK there are a lot of choices out there for boards that do.
|
||||
|
||||
::: tip Is This Guide For Me?
|
||||
If the thought of programming intimidates you, please [take a look at our online GUI](newbs_building_firmware_configurator) instead.
|
||||
|
@ -4,52 +4,51 @@ This page describes the support for [Compatible Microcontrollers](compatible_mic
|
||||
|
||||
If you have not yet you should read the [Keyboard Guidelines](hardware_keyboard_guidelines) to get a sense of how keyboards fit into QMK.
|
||||
|
||||
|
||||
QMK has a number of features to simplify working with keyboards. For most, you don't have to write a single line of code. To get started, run `qmk new-keyboard`:
|
||||
|
||||
```
|
||||
$ qmk new-keyboard
|
||||
Ψ Generating a new QMK keyboard directory
|
||||
|
||||
Name Your Keyboard Project
|
||||
For more infomation, see:
|
||||
https://docs.qmk.fm/hardware_keyboard_guidelines#naming-your-keyboardproject
|
||||
Ψ Name Your Keyboard Project
|
||||
Ψ For more information, see:
|
||||
https://docs.qmk.fm/hardware_keyboard_guidelines#naming-your-keyboard-project
|
||||
Keyboard Name? mycoolkeeb
|
||||
Ψ Attribution
|
||||
Ψ Used for maintainer, copyright, etc.
|
||||
Your GitHub Username? [jsmith]
|
||||
Ψ More Attribution
|
||||
Ψ Used for maintainer, copyright, etc.
|
||||
Your Real Name? [John Smith]
|
||||
Ψ Pick Base Layout
|
||||
Ψ As a starting point, one of the common layouts can be used to
|
||||
bootstrap the process
|
||||
Default Layout?
|
||||
1. 60_abnt2
|
||||
...
|
||||
65. none of the above
|
||||
Please enter your choice: [65]
|
||||
Ψ What Powers Your Project
|
||||
Ψ Is your board using a separate development board, such as a Pro Micro,
|
||||
or is the microcontroller integrated onto the PCB?
|
||||
|
||||
keyboard Name? mycoolkeeb
|
||||
|
||||
Attribution
|
||||
Used for maintainer, copyright, etc
|
||||
|
||||
Your GitHub Username? [jsmith]
|
||||
|
||||
More Attribution
|
||||
Used for maintainer, copyright, etc
|
||||
|
||||
Your Real Name? [John Smith]
|
||||
|
||||
Pick Base Layout
|
||||
As a starting point, one of the common layouts can be used to bootstrap the process
|
||||
|
||||
Default Layout?
|
||||
1. 60_ansi
|
||||
...
|
||||
50. tkl_iso
|
||||
51. none of the above
|
||||
Please enter your choice: [51]
|
||||
|
||||
What Powers Your Project
|
||||
For more infomation, see:
|
||||
https://docs.qmk.fm/#/compatible_microcontrollers
|
||||
|
||||
MCU?
|
||||
1. atmega32u4
|
||||
...
|
||||
22. STM32F303
|
||||
Please enter your choice: [12]
|
||||
For more information, see:
|
||||
https://docs.qmk.fm/compatible_microcontrollers
|
||||
Using a Development Board? [y/n] y
|
||||
Ψ Select Development Board
|
||||
Ψ For more information, see:
|
||||
https://docs.qmk.fm/compatible_microcontrollers
|
||||
Development Board?
|
||||
1. bit_c_pro
|
||||
...
|
||||
14. promicro
|
||||
...
|
||||
18. svlinky
|
||||
Please enter your choice: [14]
|
||||
Ψ Created a new keyboard called mycoolkeeb.
|
||||
Ψ To start working on things, `cd` into keyboards/mycoolkeeb,
|
||||
Ψ or open the directory in your preferred text editor.
|
||||
Ψ And build with qmk compile -kb mycoolkeeb -km default.
|
||||
Ψ Build Command: qmk compile -kb mycoolkeeb -km default.
|
||||
Ψ Project Location: /Users/jsmith/qmk_firmware/keyboards/mycoolkeeb.
|
||||
Ψ Now update the config files to match the hardware!
|
||||
```
|
||||
|
||||
This will create all the files needed to support your new keyboard, and populate the settings with default values. Now you just need to customize it for your keyboard.
|
||||
@ -58,13 +57,13 @@ This will create all the files needed to support your new keyboard, and populate
|
||||
|
||||
This is where you'll describe your keyboard. Please follow the [Keyboard Readme Template](documentation_templates#keyboard-readmemd-template) when writing your `readme.md`. You're encouraged to place an image at the top of your `readme.md`, please use an external service such as [Imgur](https://imgur.com) to host the images.
|
||||
|
||||
## `info.json`
|
||||
## `keyboard.json`
|
||||
|
||||
The `info.json` file is where you configure the hardware and feature set for your keyboard. There are a lot of options that can be placed in that file, too many to list here. For a complete overview of available options see the [Data Driven Configuration Options](reference_info_json) page.
|
||||
The `keyboard.json` file is where you configure the hardware and feature set for your keyboard. There are a lot of options that can be placed in that file, too many to list here. For a complete overview of available options see the [Data Driven Configuration Options](reference_info_json) page.
|
||||
|
||||
### Hardware Configuration
|
||||
|
||||
At the top of the `info.json` you'll find USB related settings. These control how your keyboard appears to the Operating System. If you don't have a good reason to change you should leave the `usb.vid` as `0xFEED`. For the `usb.pid` you should pick a number that is not yet in use.
|
||||
At the top of the `keyboard.json` you'll find USB related settings. These control how your keyboard appears to the Operating System. If you don't have a good reason to change you should leave the `usb.vid` as `0xFEED`. For the `usb.pid` you should pick a number that is not yet in use.
|
||||
|
||||
Do change the `manufacturer` and `keyboard_name` lines to accurately reflect your keyboard.
|
||||
|
||||
@ -82,10 +81,11 @@ Do change the `manufacturer` and `keyboard_name` lines to accurately reflect you
|
||||
Windows and macOS will display the `manufacturer` and `keyboard_name` in the list of USB devices. `lsusb` on Linux instead prefers the values in the list maintained by the [USB ID Repository](http://www.linux-usb.org/usb-ids.html). By default, it will only use `manufacturer` and `keyboard_name` if the list does not contain that `usb.vid` / `usb.pid`. `sudo lsusb -v` will show the values reported by the device, and they are also present in kernel logs after plugging it in.
|
||||
:::
|
||||
|
||||
|
||||
### Matrix Configuration
|
||||
|
||||
The next section of the `info` file deals with your keyboard's matrix. The first thing you should define is which pins on your MCU are connected to rows and columns. To do so simply specify the names of those pins:
|
||||
The next section of the `keyboard.json` deals with your keyboard's matrix. The first thing you should define is which pins on your MCU are connected to rows and columns. To do so simply specify the names of those pins:
|
||||
|
||||
#### Diode Matrix
|
||||
|
||||
```json
|
||||
"matrix_pins": {
|
||||
@ -94,7 +94,7 @@ The next section of the `info` file deals with your keyboard's matrix. The first
|
||||
},
|
||||
```
|
||||
|
||||
The size of the `matrix_pins.cols` and `matrix_pins.rows` arrays infer the size of the matrix (previously `MATRIX_ROWS` and `MATRIX_COLS`).
|
||||
The matrix dimensions are inferred from the length of the `matrix_pins.cols` and `matrix_pins.rows` arrays (previously specified explicitly in `config.h` with `MATRIX_ROWS` and `MATRIX_COLS`).
|
||||
|
||||
Finally, you can specify the direction your diodes point. This can be `COL2ROW` or `ROW2COL`.
|
||||
|
||||
@ -103,54 +103,56 @@ Finally, you can specify the direction your diodes point. This can be `COL2ROW`
|
||||
```
|
||||
|
||||
#### Direct Pin Matrix
|
||||
To configure a keyboard where each switch is connected to a separate pin and ground instead of sharing row and column pins, use `matrix_pins.direct`. The mapping defines the pins of each switch in rows and columns, from left to right. The size of the `matrix_pins.direct` array infers the size of the matrix. Use `NO_PIN` to fill in blank spaces. Overrides the behaviour of `diode_direction`, `matrix_pins.cols` and `matrix_pins.rows`.
|
||||
|
||||
To configure a keyboard where each switch is connected to a separate pin and ground instead of sharing row and column pins, use `matrix_pins.direct`. This overrides the behaviour of `diode_direction`, `matrix_pins.cols` and `matrix_pins.rows`, and they should not be specified together.
|
||||
|
||||
```json
|
||||
"matrix_pins": {
|
||||
"direct": [
|
||||
["F1", "E6", "B0", "B2", "B3" ],
|
||||
["F5", "F0", "B1", "B7", "D2" ],
|
||||
["F6", "F7", "C7", "D5", "D3" ],
|
||||
["B5", "C6", "B6", "NO_PIN", "NO_PIN"]
|
||||
["F1", "E6", "B0", "B2", "B3"],
|
||||
["F5", "F0", "B1", "B7", "D2"],
|
||||
["F6", "F7", "C7", "D5", "D3"],
|
||||
["B5", "C6", "B6", null, null]
|
||||
]
|
||||
},
|
||||
```
|
||||
|
||||
### Layout macros
|
||||
Here, the matrix dimensions are inferred directly from the dimensions of the `matrix_pins.direct` array. Since there are no row or column pins to prescribe the matrix dimensions, you can arrange it however you like. Each "row" must contain the same number of "column"s; use `null` to fill in blank spaces, but try to minimize them.
|
||||
|
||||
Next is configuring Layout Macro(s). These define the physical arrangement of keys, and its position within the matrix that a switch are connected to. This allows you to have a physical arrangement of keys that differs from the wiring matrix.
|
||||
### Layout Macros
|
||||
|
||||
Next is configuring layout macro(s). These define the physical arrangement of keys, and their position within the matrix that switches are connected to. This allows you to have a physical arrangement of keys that differs from the wiring matrix.
|
||||
|
||||
```json
|
||||
"layouts": {
|
||||
"LAYOUT_ortho_4x4": {
|
||||
"layout": [
|
||||
{ "matrix": [0, 0], "x": 0, "y": 0 },
|
||||
{ "matrix": [0, 1], "x": 1, "y": 0 },
|
||||
{ "matrix": [0, 2], "x": 2, "y": 0 },
|
||||
{ "matrix": [0, 3], "x": 3, "y": 0 },
|
||||
{ "matrix": [1, 0], "x": 0, "y": 1 },
|
||||
{ "matrix": [1, 1], "x": 1, "y": 1 },
|
||||
{ "matrix": [1, 2], "x": 2, "y": 1 },
|
||||
{ "matrix": [1, 3], "x": 3, "y": 1 },
|
||||
{ "matrix": [2, 0], "x": 0, "y": 2 },
|
||||
{ "matrix": [2, 1], "x": 1, "y": 2 },
|
||||
{ "matrix": [2, 2], "x": 2, "y": 2 },
|
||||
{ "matrix": [2, 3], "x": 3, "y": 2 },
|
||||
{ "matrix": [3, 0], "x": 0, "y": 3 },
|
||||
{ "matrix": [3, 1], "x": 1, "y": 3 },
|
||||
{ "matrix": [3, 2], "x": 2, "y": 3 },
|
||||
{ "matrix": [3, 3], "x": 3, "y": 3 }
|
||||
{"matrix": [0, 0], "x": 0, "y": 0},
|
||||
{"matrix": [0, 1], "x": 1, "y": 0},
|
||||
{"matrix": [0, 2], "x": 2, "y": 0},
|
||||
{"matrix": [0, 3], "x": 3, "y": 0},
|
||||
{"matrix": [1, 0], "x": 0, "y": 1},
|
||||
{"matrix": [1, 1], "x": 1, "y": 1},
|
||||
{"matrix": [1, 2], "x": 2, "y": 1},
|
||||
{"matrix": [1, 3], "x": 3, "y": 1},
|
||||
{"matrix": [2, 0], "x": 0, "y": 2},
|
||||
{"matrix": [2, 1], "x": 1, "y": 2},
|
||||
{"matrix": [2, 2], "x": 2, "y": 2},
|
||||
{"matrix": [2, 3], "x": 3, "y": 2},
|
||||
{"matrix": [3, 0], "x": 0, "y": 3},
|
||||
{"matrix": [3, 1], "x": 1, "y": 3},
|
||||
{"matrix": [3, 2], "x": 2, "y": 3},
|
||||
{"matrix": [3, 3], "x": 3, "y": 3}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
In the above example,
|
||||
In the above example,
|
||||
|
||||
* `LAYOUT_ortho_4x4` defines the name of the layout macro
|
||||
* It must conform to the [layout guidelines](hardware_keyboard_guidelines#keyboard-name-h)
|
||||
* `"matrix": [0, 0]` defines the electrical position
|
||||
* `"matrix": [0, 0]` defines the matrix row and column that the key is associated with
|
||||
|
||||
::: tip
|
||||
See also: [Split Keyboard Layout Macro](features/split_keyboard#layout-macro) and [Matrix to Physical Layout](understanding_qmk#matrix-to-physical-layout-map).
|
||||
@ -158,9 +160,10 @@ See also: [Split Keyboard Layout Macro](features/split_keyboard#layout-macro) an
|
||||
|
||||
## Additional Configuration
|
||||
|
||||
There are a lot of features that can be turned on or off, configured or tuned. Some of these have yet to be migrated over to [Data Driven Configuration](data_driven_config). The following sections cover the process for when an `info.json` option is unavailable.
|
||||
There are a lot of features that can be turned on or off, configured or tuned. Some of these have yet to be migrated over to [Data Driven Configuration](data_driven_config). The following sections cover the process for when a data-driven option is unavailable.
|
||||
|
||||
### Configuration Options
|
||||
|
||||
For available options for `config.h`, you should see the [Config Options](config_options#the-configh-file) page for more details.
|
||||
|
||||
### Build Options
|
||||
|
@ -156,25 +156,25 @@ For more on the `info.json` files, see [`info.json` Format](reference_info_json)
|
||||
|
||||
The Configurator's API uses the layout macro and the JSON file we've given it to create a visual representation of the keyboard that has each visual object tied to a specific key, in sequence:
|
||||
|
||||
key in layout macro | JSON object used
|
||||
:---: | :----
|
||||
k00 | {"label":"Num Lock", "x":0, "y":0}
|
||||
k01 | {"label":"/", "x":1, "y":0}
|
||||
k02 | {"label":"*", "x":2, "y":0}
|
||||
k03 | {"label":"-", "x":3, "y":0}
|
||||
k10 | {"label":"7", "x":0, "y":1}
|
||||
k11 | {"label":"8", "x":1, "y":1}
|
||||
k12 | {"label":"9", "x":2, "y":1}
|
||||
k13 | {"label":"+", "x":3, "y":1, "h":2}
|
||||
k20 | {"label":"4", "x":0, "y":2}
|
||||
k21 | {"label":"5", "x":1, "y":2}
|
||||
k22 | {"label":"6", "x":2, "y":2}
|
||||
k30 | {"label":"1", "x":0, "y":3}
|
||||
k31 | {"label":"2", "x":1, "y":3}
|
||||
k32 | {"label":"3", "x":2, "y":3}
|
||||
k33 | {"label":"Enter", "x":3, "y":3, "h":2}
|
||||
k40 | {"label":"0", "x":0, "y":4, "w":2}
|
||||
k42 | {"label":".", "x":2, "y":4}
|
||||
| Key in layout macro | JSON object used |
|
||||
| ------------------- | ---------------------------------------- |
|
||||
| k00 | `{"label":"Num Lock", "x":0, "y":0}` |
|
||||
| k01 | `{"label":"/", "x":1, "y":0}` |
|
||||
| k02 | `{"label":"*", "x":2, "y":0}` |
|
||||
| k03 | `{"label":"-", "x":3, "y":0}` |
|
||||
| k10 | `{"label":"7", "x":0, "y":1}` |
|
||||
| k11 | `{"label":"8", "x":1, "y":1}` |
|
||||
| k12 | `{"label":"9", "x":2, "y":1}` |
|
||||
| k13 | `{"label":"+", "x":3, "y":1, "h":2}` |
|
||||
| k20 | `{"label":"4", "x":0, "y":2}` |
|
||||
| k21 | `{"label":"5", "x":1, "y":2}` |
|
||||
| k22 | `{"label":"6", "x":2, "y":2}` |
|
||||
| k30 | `{"label":"1", "x":0, "y":3}` |
|
||||
| k31 | `{"label":"2", "x":1, "y":3}` |
|
||||
| k32 | `{"label":"3", "x":2, "y":3}` |
|
||||
| k33 | `{"label":"Enter", "x":3, "y":3, "h":2}` |
|
||||
| k40 | `{"label":"0", "x":0, "y":4, "w":2}` |
|
||||
| k42 | `{"label":".", "x":2, "y":4}` |
|
||||
|
||||
When a user selects the top-left key in the Configurator, and assigns Num Lock to it, the Configurator builds a keymap file with `KC_NUM` as the first key, and so on as the keymap is built. The `label` keys are not used; they are only for the user's reference in identifying specific keys when debugging the `info.json` file.
|
||||
|
||||
|
@ -16,7 +16,7 @@ You can create `info.json` files at every level under `qmk_firmware/keyboards/<k
|
||||
* A free-form text string describing the keyboard's manufacturer. This will be used as the USB manufacturer string. Can include Unicode characters, escaped to ASCII eg. `\u03A8` (Ψ).
|
||||
* Example: `"Clueboard"`
|
||||
* `url` <Badge type="info">String</Badge> <Badge>Required</Badge>
|
||||
* A URL to the keyboard's product page, [QMK.fm/keyboards](https://qmk.fm/keyboards) page, or other page describing information about the keyboard.
|
||||
* A URL to the keyboard's product page, [QMK Keyboards](https://browse.qmk.fm/) page, or other page describing information about the keyboard.
|
||||
* Example: `"https://clueboard.co"`
|
||||
* `bootloader_instructions` <Badge type="info">String</Badge>
|
||||
* Instructions for putting the keyboard into a mode that allows for firmware flashing.
|
||||
@ -177,9 +177,9 @@ Configures the [Backlight](features/backlight) feature.
|
||||
* `pins` <Badge type="info">Array: Pin</Badge>
|
||||
* A list of GPIO pins connected to the backlight LEDs (`software` and `timer` drivers only).
|
||||
|
||||
## Bluetooth {#bluetooth}
|
||||
## Wireless/Bluetooth {#bluetooth}
|
||||
|
||||
Configures the [Bluetooth](features/bluetooth) feature.
|
||||
Configures the [Wireless](features/wireless) feature.
|
||||
|
||||
* `bluetooth`
|
||||
* `driver` <Badge type="info">String</Badge>
|
||||
|
@ -2,9 +2,31 @@
|
||||
|
||||
Keyboards are able to support a wide range of languages. However, this support is not actually achieved within the keyboard itself - instead, it sends numerical codes, which the operating system maps to the appropriate characters depending on the user's configured keyboard layout. By default (and per the HID spec), this is the US ANSI layout. For example, when a Swedish person presses the key with the `å` character printed on it, the keyboard is *actually* sending the keycode for `[`.
|
||||
|
||||
Obviously, this can get confusing, so QMK provides language-specific keycode aliases for many keyboard layouts. These won't do much on their own - you still have to set the matching keyboard layout in your OS settings. Think of them more as keycap labels for your keymap.
|
||||
Obviously, this can get confusing, so QMK provides language-specific keycode aliases for many keyboard layouts. These are used in place of the `KC_` prefixed ones. They won't do much on their own - you still have to set the matching keyboard layout in your OS settings. Think of them more as keycap labels for your keymap. The language-specific keycode aliases are defined in the files listed in the [Keycodes Header](#header-files) column below.
|
||||
|
||||
Simply `#include` one of the keycode headers below at the top of your `keymap.c`, and assign the keycodes defined in the header in place of the `KC_` prefixed ones.
|
||||
## Selecting Your Host Keyboard Layout
|
||||
|
||||
To select a host keyboard layout, simply `#include` one of the [keycode headers](#header-files) below at the top of your `keymap.c`. Example:
|
||||
|
||||
```c
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "keymap_japanese.h" // [!code focus]
|
||||
```
|
||||
|
||||
Alternatively, if using `keymap.json`, add the `host_language` key as shown in the following example. The available languages are those with a _Sendstring LUT Header_ entry in one of the [Header Files](#header-files) tables.
|
||||
|
||||
```json
|
||||
{
|
||||
"keyboard": "handwired/my_macropad",
|
||||
"keymap": "my_keymap",
|
||||
"host_language": "swedish", // [!code focus]
|
||||
"layout": "LAYOUT_all",
|
||||
"layers": [
|
||||
["SE_ARNG"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Sendstring Support
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "wait.h"
|
||||
#include "debug.h"
|
||||
#include "gpio.h"
|
||||
#include "pointing_device_internal.h"
|
||||
|
||||
// Registers
|
||||
// clang-format off
|
||||
@ -45,6 +46,13 @@
|
||||
#define REG_MOTION_BURST 0x63
|
||||
// clang-format on
|
||||
|
||||
const pointing_device_driver_t adns5050_pointing_device_driver = {
|
||||
.init = adns5050_init,
|
||||
.get_report = adns5050_get_report,
|
||||
.set_cpi = adns5050_set_cpi,
|
||||
.get_cpi = adns5050_get_cpi,
|
||||
};
|
||||
|
||||
static bool powered_down = false;
|
||||
|
||||
void adns5050_init(void) {
|
||||
@ -226,3 +234,15 @@ void adns5050_power_down(void) {
|
||||
adns5050_write_reg(REG_MOUSE_CONTROL, 0b10);
|
||||
}
|
||||
}
|
||||
|
||||
report_mouse_t adns5050_get_report(report_mouse_t mouse_report) {
|
||||
report_adns5050_t data = adns5050_read_burst();
|
||||
|
||||
if (data.dx != 0 || data.dy != 0) {
|
||||
pd_dprintf("Raw ] X: %d, Y: %d\n", data.dx, data.dy);
|
||||
mouse_report.x = (mouse_xy_report_t)data.dx;
|
||||
mouse_report.y = (mouse_xy_report_t)data.dy;
|
||||
}
|
||||
|
||||
return mouse_report;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "pointing_device.h"
|
||||
|
||||
// CPI values
|
||||
// clang-format off
|
||||
@ -69,6 +70,8 @@ typedef struct {
|
||||
int8_t dy;
|
||||
} report_adns5050_t;
|
||||
|
||||
const pointing_device_driver_t adns5050_pointing_device_driver;
|
||||
|
||||
// A bunch of functions to implement the ADNS5050-specific serial protocol.
|
||||
// Note that the "serial.h" driver is insufficient, because it does not
|
||||
// manually manipulate a serial clock signal.
|
||||
@ -84,3 +87,4 @@ uint16_t adns5050_get_cpi(void);
|
||||
int8_t convert_twoscomp(uint8_t data);
|
||||
bool adns5050_check_signature(void);
|
||||
void adns5050_power_down(void);
|
||||
report_mouse_t adns5050_get_report(report_mouse_t mouse_report);
|
||||
|
@ -77,6 +77,13 @@
|
||||
#define MSB1 0x80
|
||||
// clang-format on
|
||||
|
||||
const pointing_device_driver_t adns9800_pointing_device_driver = {
|
||||
.init = adns9800_init,
|
||||
.get_report = adns9800_get_report_driver,
|
||||
.set_cpi = adns9800_set_cpi,
|
||||
.get_cpi = adns9800_get_cpi,
|
||||
};
|
||||
|
||||
uint16_t __attribute__((weak)) adns9800_srom_get_length(void) {
|
||||
return 0;
|
||||
}
|
||||
@ -236,3 +243,12 @@ report_adns9800_t adns9800_get_report(void) {
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
report_mouse_t adns9800_get_report_driver(report_mouse_t mouse_report) {
|
||||
report_adns9800_t sensor_report = adns9800_get_report();
|
||||
|
||||
mouse_report.x = CONSTRAIN_HID_XY(sensor_report.x);
|
||||
mouse_report.y = CONSTRAIN_HID_XY(sensor_report.y);
|
||||
|
||||
return mouse_report;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "pointing_device.h"
|
||||
|
||||
#ifndef ADNS9800_CPI
|
||||
# define ADNS9800_CPI 1600
|
||||
@ -60,6 +61,8 @@ typedef struct {
|
||||
int16_t y;
|
||||
} report_adns9800_t;
|
||||
|
||||
const pointing_device_driver_t adns9800_pointing_device_driver;
|
||||
|
||||
void adns9800_init(void);
|
||||
config_adns9800_t adns9800_get_config(void);
|
||||
void adns9800_set_config(config_adns9800_t);
|
||||
@ -67,3 +70,4 @@ uint16_t adns9800_get_cpi(void);
|
||||
void adns9800_set_cpi(uint16_t cpi);
|
||||
/* Reads and clears the current delta values on the ADNS sensor */
|
||||
report_adns9800_t adns9800_get_report(void);
|
||||
report_mouse_t adns9800_get_report_driver(report_mouse_t mouse_report);
|
||||
|
@ -20,6 +20,14 @@
|
||||
#include "wait.h"
|
||||
#include "timer.h"
|
||||
#include <stdlib.h>
|
||||
#include "pointing_device_internal.h"
|
||||
|
||||
const pointing_device_driver_t analog_joystick_pointing_device_driver = {
|
||||
.init = analog_joystick_init,
|
||||
.get_report = analog_joystick_get_report,
|
||||
.set_cpi = NULL,
|
||||
.get_cpi = NULL,
|
||||
};
|
||||
|
||||
// Set Parameters
|
||||
#ifndef ANALOG_JOYSTICK_AUTO_AXIS
|
||||
@ -145,3 +153,16 @@ void analog_joystick_init(void) {
|
||||
maxAxisValues[1] = yOrigin + 100;
|
||||
#endif
|
||||
}
|
||||
|
||||
report_mouse_t analog_joystick_get_report(report_mouse_t mouse_report) {
|
||||
report_analog_joystick_t data = analog_joystick_read();
|
||||
|
||||
pd_dprintf("Raw ] X: %d, Y: %d\n", data.x, data.y);
|
||||
|
||||
mouse_report.x = data.x;
|
||||
mouse_report.y = data.y;
|
||||
|
||||
mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, data.button, POINTING_DEVICE_BUTTON1);
|
||||
|
||||
return mouse_report;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "pointing_device.h"
|
||||
|
||||
#ifndef ANALOG_JOYSTICK_X_AXIS_PIN
|
||||
# error No pin specified for X Axis
|
||||
@ -42,6 +43,8 @@
|
||||
# define ANALOG_JOYSTICK_SPEED_MAX 2
|
||||
#endif
|
||||
|
||||
const pointing_device_driver_t analog_joystick_pointing_device_driver;
|
||||
|
||||
typedef struct {
|
||||
int8_t x;
|
||||
int8_t y;
|
||||
@ -49,3 +52,4 @@ typedef struct {
|
||||
} report_analog_joystick_t;
|
||||
report_analog_joystick_t analog_joystick_read(void);
|
||||
void analog_joystick_init(void);
|
||||
report_mouse_t analog_joystick_get_report(report_mouse_t mouse_report);
|
||||
|
@ -98,6 +98,13 @@
|
||||
#define AZOTEQ_IQS5XX_INCH_TO_RESOLUTION_Y(inch) (DIVIDE_UNSIGNED_ROUND((inch) * (uint32_t)AZOTEQ_IQS5XX_HEIGHT_MM * 10, 254))
|
||||
#define AZOTEQ_IQS5XX_RESOLUTION_Y_TO_INCH(px) (DIVIDE_UNSIGNED_ROUND((px) * (uint32_t)254, AZOTEQ_IQS5XX_HEIGHT_MM * 10))
|
||||
|
||||
const pointing_device_driver_t azoteq_iqs5xx_pointing_device_driver = {
|
||||
.init = azoteq_iqs5xx_init,
|
||||
.get_report = azoteq_iqs5xx_get_report,
|
||||
.set_cpi = azoteq_iqs5xx_set_cpi,
|
||||
.get_cpi = azoteq_iqs5xx_get_cpi,
|
||||
};
|
||||
|
||||
static uint16_t azoteq_iqs5xx_product_number = AZOTEQ_IQS5XX_UNKNOWN;
|
||||
|
||||
static struct {
|
||||
@ -312,3 +319,105 @@ void azoteq_iqs5xx_setup_resolution(void) {
|
||||
azoteq_iqs5xx_device_resolution_t.resolution_y = AZOTEQ_IQS5XX_RESOLUTION_Y;
|
||||
#endif
|
||||
}
|
||||
|
||||
static i2c_status_t azoteq_iqs5xx_init_status = 1;
|
||||
|
||||
void azoteq_iqs5xx_init(void) {
|
||||
i2c_init();
|
||||
azoteq_iqs5xx_wake();
|
||||
azoteq_iqs5xx_reset_suspend(true, false, true);
|
||||
wait_ms(100);
|
||||
azoteq_iqs5xx_wake();
|
||||
if (azoteq_iqs5xx_get_product() != AZOTEQ_IQS5XX_UNKNOWN) {
|
||||
azoteq_iqs5xx_setup_resolution();
|
||||
azoteq_iqs5xx_init_status = azoteq_iqs5xx_set_report_rate(AZOTEQ_IQS5XX_REPORT_RATE, AZOTEQ_IQS5XX_ACTIVE, false);
|
||||
azoteq_iqs5xx_init_status |= azoteq_iqs5xx_set_event_mode(false, false);
|
||||
azoteq_iqs5xx_init_status |= azoteq_iqs5xx_set_reati(true, false);
|
||||
#if defined(AZOTEQ_IQS5XX_ROTATION_90)
|
||||
azoteq_iqs5xx_init_status |= azoteq_iqs5xx_set_xy_config(false, true, true, true, false);
|
||||
#elif defined(AZOTEQ_IQS5XX_ROTATION_180)
|
||||
azoteq_iqs5xx_init_status |= azoteq_iqs5xx_set_xy_config(true, true, false, true, false);
|
||||
#elif defined(AZOTEQ_IQS5XX_ROTATION_270)
|
||||
azoteq_iqs5xx_init_status |= azoteq_iqs5xx_set_xy_config(true, false, true, true, false);
|
||||
#else
|
||||
azoteq_iqs5xx_init_status |= azoteq_iqs5xx_set_xy_config(false, false, false, true, false);
|
||||
#endif
|
||||
azoteq_iqs5xx_init_status |= azoteq_iqs5xx_set_gesture_config(true);
|
||||
wait_ms(AZOTEQ_IQS5XX_REPORT_RATE + 1);
|
||||
}
|
||||
};
|
||||
|
||||
report_mouse_t azoteq_iqs5xx_get_report(report_mouse_t mouse_report) {
|
||||
report_mouse_t temp_report = {0};
|
||||
static uint8_t previous_button_state = 0;
|
||||
static uint8_t read_error_count = 0;
|
||||
|
||||
if (azoteq_iqs5xx_init_status == I2C_STATUS_SUCCESS) {
|
||||
azoteq_iqs5xx_base_data_t base_data = {0};
|
||||
#if !defined(POINTING_DEVICE_MOTION_PIN)
|
||||
azoteq_iqs5xx_wake();
|
||||
#endif
|
||||
i2c_status_t status = azoteq_iqs5xx_get_base_data(&base_data);
|
||||
bool ignore_movement = false;
|
||||
|
||||
if (status == I2C_STATUS_SUCCESS) {
|
||||
// pd_dprintf("IQS5XX - previous cycle time: %d \n", base_data.previous_cycle_time);
|
||||
read_error_count = 0;
|
||||
if (base_data.gesture_events_0.single_tap || base_data.gesture_events_0.press_and_hold) {
|
||||
pd_dprintf("IQS5XX - Single tap/hold.\n");
|
||||
temp_report.buttons = pointing_device_handle_buttons(temp_report.buttons, true, POINTING_DEVICE_BUTTON1);
|
||||
} else if (base_data.gesture_events_1.two_finger_tap) {
|
||||
pd_dprintf("IQS5XX - Two finger tap.\n");
|
||||
temp_report.buttons = pointing_device_handle_buttons(temp_report.buttons, true, POINTING_DEVICE_BUTTON2);
|
||||
} else if (base_data.gesture_events_0.swipe_x_neg) {
|
||||
pd_dprintf("IQS5XX - X-.\n");
|
||||
temp_report.buttons = pointing_device_handle_buttons(temp_report.buttons, true, POINTING_DEVICE_BUTTON4);
|
||||
ignore_movement = true;
|
||||
} else if (base_data.gesture_events_0.swipe_x_pos) {
|
||||
pd_dprintf("IQS5XX - X+.\n");
|
||||
temp_report.buttons = pointing_device_handle_buttons(temp_report.buttons, true, POINTING_DEVICE_BUTTON5);
|
||||
ignore_movement = true;
|
||||
} else if (base_data.gesture_events_0.swipe_y_neg) {
|
||||
pd_dprintf("IQS5XX - Y-.\n");
|
||||
temp_report.buttons = pointing_device_handle_buttons(temp_report.buttons, true, POINTING_DEVICE_BUTTON6);
|
||||
ignore_movement = true;
|
||||
} else if (base_data.gesture_events_0.swipe_y_pos) {
|
||||
pd_dprintf("IQS5XX - Y+.\n");
|
||||
temp_report.buttons = pointing_device_handle_buttons(temp_report.buttons, true, POINTING_DEVICE_BUTTON3);
|
||||
ignore_movement = true;
|
||||
} else if (base_data.gesture_events_1.zoom) {
|
||||
if (AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.x.h, base_data.x.l) < 0) {
|
||||
pd_dprintf("IQS5XX - Zoom out.\n");
|
||||
temp_report.buttons = pointing_device_handle_buttons(temp_report.buttons, true, POINTING_DEVICE_BUTTON7);
|
||||
} else if (AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.x.h, base_data.x.l) > 0) {
|
||||
pd_dprintf("IQS5XX - Zoom in.\n");
|
||||
temp_report.buttons = pointing_device_handle_buttons(temp_report.buttons, true, POINTING_DEVICE_BUTTON8);
|
||||
}
|
||||
} else if (base_data.gesture_events_1.scroll) {
|
||||
pd_dprintf("IQS5XX - Scroll.\n");
|
||||
temp_report.h = CONSTRAIN_HID(AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.x.h, base_data.x.l));
|
||||
temp_report.v = CONSTRAIN_HID(AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.y.h, base_data.y.l));
|
||||
}
|
||||
if (base_data.number_of_fingers == 1 && !ignore_movement) {
|
||||
temp_report.x = CONSTRAIN_HID_XY(AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.x.h, base_data.x.l));
|
||||
temp_report.y = CONSTRAIN_HID_XY(AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.y.h, base_data.y.l));
|
||||
}
|
||||
|
||||
previous_button_state = temp_report.buttons;
|
||||
|
||||
} else {
|
||||
if (read_error_count > 10) {
|
||||
read_error_count = 0;
|
||||
previous_button_state = 0;
|
||||
} else {
|
||||
read_error_count++;
|
||||
}
|
||||
temp_report.buttons = previous_button_state;
|
||||
pd_dprintf("IQS5XX - get report failed: %d \n", status);
|
||||
}
|
||||
} else {
|
||||
pd_dprintf("IQS5XX - Init failed: %d \n", azoteq_iqs5xx_init_status);
|
||||
}
|
||||
|
||||
return temp_report;
|
||||
}
|
||||
|
@ -176,6 +176,8 @@ typedef struct {
|
||||
# define POINTING_DEVICE_TASK_THROTTLE_MS AZOTEQ_IQS5XX_REPORT_RATE
|
||||
#endif
|
||||
|
||||
const pointing_device_driver_t azoteq_iqs5xx_pointing_device_driver;
|
||||
|
||||
void azoteq_iqs5xx_init(void);
|
||||
i2c_status_t azoteq_iqs5xx_wake(void);
|
||||
report_mouse_t azoteq_iqs5xx_get_report(report_mouse_t mouse_report);
|
||||
|
@ -4,6 +4,7 @@
|
||||
// refer to documentation: Gen2 and Gen3 (Pinnacle ASIC) at https://www.cirque.com/documentation
|
||||
|
||||
#include "cirque_pinnacle.h"
|
||||
#include "cirque_pinnacle_gestures.h"
|
||||
#include "wait.h"
|
||||
#include "timer.h"
|
||||
|
||||
@ -350,3 +351,144 @@ pinnacle_data_t cirque_pinnacle_read_data(void) {
|
||||
result.valid = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
|
||||
static bool cursor_glide_enable = true;
|
||||
|
||||
static cursor_glide_context_t glide = {.config = {
|
||||
.coef = 102, /* Good default friction coef */
|
||||
.interval = 10, /* 100sps */
|
||||
.trigger_px = 10, /* Default threshold in case of hover, set to 0 if you'd like */
|
||||
}};
|
||||
|
||||
void cirque_pinnacle_enable_cursor_glide(bool enable) {
|
||||
cursor_glide_enable = enable;
|
||||
}
|
||||
|
||||
void cirque_pinnacle_configure_cursor_glide(float trigger_px) {
|
||||
glide.config.trigger_px = trigger_px;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CIRQUE_PINNACLE_POSITION_MODE
|
||||
|
||||
# ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
|
||||
static bool is_touch_down;
|
||||
|
||||
bool auto_mouse_activation(report_mouse_t mouse_report) {
|
||||
return is_touch_down || mouse_report.x != 0 || mouse_report.y != 0 || mouse_report.h != 0 || mouse_report.v != 0 || mouse_report.buttons;
|
||||
}
|
||||
# endif
|
||||
|
||||
report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) {
|
||||
uint16_t scale = cirque_pinnacle_get_scale();
|
||||
pinnacle_data_t touchData = cirque_pinnacle_read_data();
|
||||
mouse_xy_report_t report_x = 0, report_y = 0;
|
||||
static uint16_t x = 0, y = 0, last_scale = 0;
|
||||
|
||||
# if defined(CIRQUE_PINNACLE_TAP_ENABLE)
|
||||
mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, false, POINTING_DEVICE_BUTTON1);
|
||||
# endif
|
||||
# ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
|
||||
cursor_glide_t glide_report = {0};
|
||||
|
||||
if (cursor_glide_enable) {
|
||||
glide_report = cursor_glide_check(&glide);
|
||||
}
|
||||
# endif
|
||||
|
||||
if (!touchData.valid) {
|
||||
# ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
|
||||
if (cursor_glide_enable && glide_report.valid) {
|
||||
report_x = glide_report.dx;
|
||||
report_y = glide_report.dy;
|
||||
goto mouse_report_update;
|
||||
}
|
||||
# endif
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
if (touchData.touchDown) {
|
||||
pd_dprintf("cirque_pinnacle touchData x=%4d y=%4d z=%2d\n", touchData.xValue, touchData.yValue, touchData.zValue);
|
||||
}
|
||||
|
||||
# ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
|
||||
is_touch_down = touchData.touchDown;
|
||||
# endif
|
||||
|
||||
// Scale coordinates to arbitrary X, Y resolution
|
||||
cirque_pinnacle_scale_data(&touchData, scale, scale);
|
||||
|
||||
if (!cirque_pinnacle_gestures(&mouse_report, touchData)) {
|
||||
if (last_scale && scale == last_scale && x && y && touchData.xValue && touchData.yValue) {
|
||||
report_x = CONSTRAIN_HID_XY((int16_t)(touchData.xValue - x));
|
||||
report_y = CONSTRAIN_HID_XY((int16_t)(touchData.yValue - y));
|
||||
}
|
||||
x = touchData.xValue;
|
||||
y = touchData.yValue;
|
||||
last_scale = scale;
|
||||
|
||||
# ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
|
||||
if (cursor_glide_enable) {
|
||||
if (touchData.touchDown) {
|
||||
cursor_glide_update(&glide, report_x, report_y, touchData.zValue);
|
||||
} else if (!glide_report.valid) {
|
||||
glide_report = cursor_glide_start(&glide);
|
||||
if (glide_report.valid) {
|
||||
report_x = glide_report.dx;
|
||||
report_y = glide_report.dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
# ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
|
||||
mouse_report_update:
|
||||
# endif
|
||||
mouse_report.x = report_x;
|
||||
mouse_report.y = report_y;
|
||||
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
uint16_t cirque_pinnacle_get_cpi(void) {
|
||||
return CIRQUE_PINNACLE_PX_TO_INCH(cirque_pinnacle_get_scale());
|
||||
}
|
||||
void cirque_pinnacle_set_cpi(uint16_t cpi) {
|
||||
cirque_pinnacle_set_scale(CIRQUE_PINNACLE_INCH_TO_PX(cpi));
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
const pointing_device_driver_t cirque_pinnacle_pointing_device_driver = {
|
||||
.init = cirque_pinnacle_init,
|
||||
.get_report = cirque_pinnacle_get_report,
|
||||
.set_cpi = cirque_pinnacle_set_cpi,
|
||||
.get_cpi = cirque_pinnacle_get_cpi
|
||||
};
|
||||
// clang-format on
|
||||
#else
|
||||
report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) {
|
||||
pinnacle_data_t touchData = cirque_pinnacle_read_data();
|
||||
|
||||
// Scale coordinates to arbitrary X, Y resolution
|
||||
cirque_pinnacle_scale_data(&touchData, cirque_pinnacle_get_scale(), cirque_pinnacle_get_scale());
|
||||
|
||||
if (touchData.valid) {
|
||||
mouse_report.buttons = touchData.buttons;
|
||||
mouse_report.x = CONSTRAIN_HID_XY(touchData.xDelta);
|
||||
mouse_report.y = CONSTRAIN_HID_XY(touchData.yDelta);
|
||||
mouse_report.v = touchData.wheelCount;
|
||||
}
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
const pointing_device_driver_t cirque_pinnacle_pointing_device_driver = {
|
||||
.init = cirque_pinnacle_init,
|
||||
.get_report = cirque_pinnacle_get_report,
|
||||
.set_cpi = cirque_pinnacle_set_scale,
|
||||
.get_cpi = cirque_pinnacle_get_scale
|
||||
};
|
||||
// clang-format on
|
||||
#endif
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "pointing_device_internal.h"
|
||||
#include "pointing_device.h"
|
||||
|
||||
#ifndef CIRQUE_PINNACLE_TIMEOUT
|
||||
# define CIRQUE_PINNACLE_TIMEOUT 20 // I2C timeout in milliseconds
|
||||
@ -109,6 +110,10 @@ typedef struct {
|
||||
#endif
|
||||
} pinnacle_data_t;
|
||||
|
||||
#define cirque_pinnacle_i2c_pointing_device_driver cirque_pinnacle_pointing_device_driver
|
||||
#define cirque_pinnacle_spi_pointing_device_driver cirque_pinnacle_pointing_device_driver
|
||||
const pointing_device_driver_t cirque_pinnacle_pointing_device_driver;
|
||||
|
||||
void cirque_pinnacle_init(void);
|
||||
void cirque_pinnacle_calibrate(void);
|
||||
void cirque_pinnacle_cursor_smoothing(bool enable);
|
||||
@ -116,3 +121,6 @@ pinnacle_data_t cirque_pinnacle_read_data(void);
|
||||
void cirque_pinnacle_scale_data(pinnacle_data_t* coordinates, uint16_t xResolution, uint16_t yResolution);
|
||||
uint16_t cirque_pinnacle_get_scale(void);
|
||||
void cirque_pinnacle_set_scale(uint16_t scale);
|
||||
uint16_t cirque_pinnacle_get_cpi(void);
|
||||
void cirque_pinnacle_set_cpi(uint16_t cpi);
|
||||
report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "wait.h"
|
||||
#include "debug.h"
|
||||
#include "gpio.h"
|
||||
#include "pointing_device_internal.h"
|
||||
|
||||
#define REG_PID1 0x00
|
||||
#define REG_PID2 0x01
|
||||
@ -50,6 +51,13 @@ void paw3204_serial_write(uint8_t reg_addr);
|
||||
uint8_t paw3204_read_reg(uint8_t reg_addr);
|
||||
void paw3204_write_reg(uint8_t reg_addr, uint8_t data);
|
||||
|
||||
const pointing_device_driver_t paw3204_pointing_device_driver = {
|
||||
.init = paw3204_init,
|
||||
.get_report = paw3204_get_report,
|
||||
.set_cpi = paw3204_set_cpi,
|
||||
.get_cpi = paw3204_get_cpi,
|
||||
};
|
||||
|
||||
void paw3204_init(void) {
|
||||
gpio_set_pin_output(PAW3204_SCLK_PIN); // setclockpin to output
|
||||
gpio_set_pin_input_high(PAW3204_SDIO_PIN); // set datapin input high
|
||||
@ -170,3 +178,15 @@ uint16_t paw3204_get_cpi(void) {
|
||||
uint8_t read_pid_paw3204(void) {
|
||||
return paw3204_read_reg(REG_PID1);
|
||||
}
|
||||
|
||||
report_mouse_t paw3204_get_report(report_mouse_t mouse_report) {
|
||||
report_paw3204_t data = paw3204_read();
|
||||
if (data.isMotion) {
|
||||
pd_dprintf("Raw ] X: %d, Y: %d\n", data.x, data.y);
|
||||
|
||||
mouse_report.x = data.x;
|
||||
mouse_report.y = data.y;
|
||||
}
|
||||
|
||||
return mouse_report;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "pointing_device.h"
|
||||
|
||||
#ifndef PAW3204_SCLK_PIN
|
||||
# ifdef POINTING_DEVICE_SCLK_PIN
|
||||
@ -40,6 +41,8 @@ typedef struct {
|
||||
bool isMotion;
|
||||
} report_paw3204_t;
|
||||
|
||||
const pointing_device_driver_t paw3204_pointing_device_driver;
|
||||
|
||||
/**
|
||||
* @brief Initializes the sensor so it is in a working state and ready to
|
||||
* be polled for data.
|
||||
@ -74,3 +77,5 @@ void paw3204_set_cpi(uint16_t cpi);
|
||||
* @return uint16_t Current CPI value of the sensor
|
||||
*/
|
||||
uint16_t paw3204_get_cpi(void);
|
||||
|
||||
report_mouse_t paw3204_get_report(report_mouse_t mouse_report);
|
||||
|
@ -33,6 +33,13 @@
|
||||
|
||||
static uint16_t precision = 128;
|
||||
|
||||
const pointing_device_driver_t pimoroni_trackball_pointing_device_driver = {
|
||||
.init = pimoroni_trackball_device_init,
|
||||
.get_report = pimoroni_trackball_get_report,
|
||||
.set_cpi = pimoroni_trackball_set_cpi,
|
||||
.get_cpi = pimoroni_trackball_get_cpi,
|
||||
};
|
||||
|
||||
uint16_t pimoroni_trackball_get_cpi(void) {
|
||||
return (precision * 125);
|
||||
}
|
||||
@ -61,8 +68,8 @@ void pimoroni_trackball_set_rgbw(uint8_t r, uint8_t g, uint8_t b, uint8_t w) {
|
||||
pd_dprintf("Trackball RGBW i2c_status_t: %d\n", status);
|
||||
}
|
||||
|
||||
i2c_status_t read_pimoroni_trackball(pimoroni_data_t* data) {
|
||||
i2c_status_t status = i2c_read_register(PIMORONI_TRACKBALL_ADDRESS << 1, PIMORONI_TRACKBALL_REG_LEFT, (uint8_t*)data, sizeof(*data), PIMORONI_TRACKBALL_TIMEOUT);
|
||||
i2c_status_t read_pimoroni_trackball(pimoroni_data_t *data) {
|
||||
i2c_status_t status = i2c_read_register(PIMORONI_TRACKBALL_ADDRESS << 1, PIMORONI_TRACKBALL_REG_LEFT, (uint8_t *)data, sizeof(*data), PIMORONI_TRACKBALL_TIMEOUT);
|
||||
|
||||
#ifdef POINTING_DEVICE_DEBUG
|
||||
static uint16_t d_timer;
|
||||
@ -92,3 +99,50 @@ 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);
|
||||
}
|
||||
|
||||
mouse_xy_report_t pimoroni_trackball_adapt_values(xy_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 xy_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);
|
||||
|
||||
if (status == I2C_STATUS_SUCCESS) {
|
||||
error_count = 0;
|
||||
|
||||
if (!(pimoroni_data.click & 128)) {
|
||||
mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, false, POINTING_DEVICE_BUTTON1);
|
||||
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);
|
||||
mouse_report.x = pimoroni_trackball_adapt_values(&x_offset);
|
||||
mouse_report.y = pimoroni_trackball_adapt_values(&y_offset);
|
||||
} else {
|
||||
debounce--;
|
||||
}
|
||||
} else {
|
||||
mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, true, POINTING_DEVICE_BUTTON1);
|
||||
debounce = PIMORONI_TRACKBALL_DEBOUNCE_CYCLES;
|
||||
}
|
||||
} else {
|
||||
error_count++;
|
||||
}
|
||||
}
|
||||
return mouse_report;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <stdint.h>
|
||||
#include "report.h"
|
||||
#include "i2c_master.h"
|
||||
#include "pointing_device.h"
|
||||
|
||||
#ifndef PIMORONI_TRACKBALL_ADDRESS
|
||||
# define PIMORONI_TRACKBALL_ADDRESS 0x0A
|
||||
@ -49,9 +50,12 @@ typedef struct {
|
||||
uint8_t click;
|
||||
} pimoroni_data_t;
|
||||
|
||||
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);
|
||||
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);
|
||||
const pointing_device_driver_t pimoroni_trackball_pointing_device_driver;
|
||||
|
||||
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);
|
||||
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);
|
||||
report_mouse_t pimoroni_trackball_get_report(report_mouse_t mouse_report);
|
||||
|
@ -21,6 +21,14 @@
|
||||
#include "wait.h"
|
||||
#include "debug.h"
|
||||
#include "gpio.h"
|
||||
#include "pointing_device_internal.h"
|
||||
|
||||
const pointing_device_driver_t pmw3320_pointing_device_drivera = {
|
||||
.init = pmw3320_init,
|
||||
.get_report = pmw3320_get_report,
|
||||
.set_cpi = pmw3320_set_cpi,
|
||||
.get_cpi = pmw3320_get_cpi,
|
||||
};
|
||||
|
||||
void pmw3320_init(void) {
|
||||
// Initialize sensor serial pins.
|
||||
@ -190,3 +198,15 @@ bool pmw3320_check_signature(void) {
|
||||
|
||||
return (pid == 0x3b && pid2 == 0xc4);
|
||||
}
|
||||
|
||||
report_mouse_t pmw3320_get_report(report_mouse_t mouse_report) {
|
||||
report_pmw3320_t data = pmw3320_read_burst();
|
||||
|
||||
if (data.dx != 0 || data.dy != 0) {
|
||||
pd_dprintf("Raw ] X: %d, Y: %d\n", data.dx, data.dy);
|
||||
mouse_report.x = (mouse_xy_report_t)data.dx;
|
||||
mouse_report.y = (mouse_xy_report_t)data.dy;
|
||||
}
|
||||
|
||||
return mouse_report;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "pointing_device.h"
|
||||
|
||||
#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
|
||||
|
||||
@ -54,6 +55,8 @@ typedef struct {
|
||||
int8_t dy;
|
||||
} report_pmw3320_t;
|
||||
|
||||
const pointing_device_driver_t pmw3320_pointing_device_driver;
|
||||
|
||||
// A bunch of functions to implement the PMW3320-specific serial protocol.
|
||||
// Mostly taken from ADNS5050 driver.
|
||||
// Note that the "serial.h" driver is insufficient, because it does not
|
||||
@ -69,6 +72,7 @@ void pmw3320_set_cpi(uint16_t cpi);
|
||||
uint16_t pmw3320_get_cpi(void);
|
||||
int8_t convert_twoscomp(uint8_t data);
|
||||
bool pmw3320_check_signature(void);
|
||||
report_mouse_t pmw3320_get_report(report_mouse_t mouse_report);
|
||||
|
||||
#if !defined(PMW3320_CPI)
|
||||
# define PMW3320_CPI 1000
|
||||
|
@ -26,6 +26,13 @@ static bool in_burst_right[ARRAY_SIZE(cs_pins_right)] = {0};
|
||||
bool __attribute__((cold)) pmw33xx_upload_firmware(uint8_t sensor);
|
||||
bool __attribute__((cold)) pmw33xx_check_signature(uint8_t sensor);
|
||||
|
||||
const pointing_device_driver_t pmw33xx_pointing_device_driver = {
|
||||
.init = pmw33xx_init_wrapper,
|
||||
.get_report = pmw33xx_get_report,
|
||||
.set_cpi = pmw33xx_set_cpi_wrapper,
|
||||
.get_cpi = pmw33xx_get_cpi_wrapper,
|
||||
};
|
||||
|
||||
uint16_t __attribute__((weak)) pmw33xx_srom_get_length(void) {
|
||||
return 0;
|
||||
}
|
||||
@ -228,3 +235,38 @@ pmw33xx_report_t pmw33xx_read_burst(uint8_t sensor) {
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
void pmw33xx_init_wrapper(void) {
|
||||
pmw33xx_init(0);
|
||||
}
|
||||
|
||||
void pmw33xx_set_cpi_wrapper(uint16_t cpi) {
|
||||
pmw33xx_set_cpi(0, cpi);
|
||||
}
|
||||
|
||||
uint16_t pmw33xx_get_cpi_wrapper(void) {
|
||||
return pmw33xx_get_cpi(0);
|
||||
}
|
||||
|
||||
report_mouse_t pmw33xx_get_report(report_mouse_t mouse_report) {
|
||||
pmw33xx_report_t report = pmw33xx_read_burst(0);
|
||||
static bool in_motion = false;
|
||||
|
||||
if (report.motion.b.is_lifted) {
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
if (!report.motion.b.is_motion) {
|
||||
in_motion = false;
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
if (!in_motion) {
|
||||
in_motion = true;
|
||||
pd_dprintf("PWM3360 (0): starting motion\n");
|
||||
}
|
||||
|
||||
mouse_report.x = CONSTRAIN_HID_XY(report.delta_x);
|
||||
mouse_report.y = CONSTRAIN_HID_XY(report.delta_y);
|
||||
return mouse_report;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <stdint.h>
|
||||
#include "spi_master.h"
|
||||
#include "util.h"
|
||||
#include "pointing_device.h"
|
||||
|
||||
#if defined(POINTING_DEVICE_DRIVER_pmw3360)
|
||||
# include "pmw3360.h"
|
||||
@ -102,6 +103,10 @@ _Static_assert(sizeof((pmw33xx_report_t){0}.motion) == 1, "pmw33xx_report_t.moti
|
||||
|
||||
#define CONSTRAIN(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
|
||||
|
||||
#define pmw3360_pointing_device_driver pmw33xx_pointing_device_driver;
|
||||
#define pmw3389_pointing_device_driver pmw33xx_pointing_device_driver;
|
||||
const pointing_device_driver_t pmw33xx_pointing_device_driver;
|
||||
|
||||
/**
|
||||
* @brief Initializes the given sensor so it is in a working state and ready to
|
||||
* be polled for data.
|
||||
@ -170,3 +175,8 @@ uint8_t pmw33xx_read(uint8_t sensor, uint8_t reg_addr);
|
||||
* @return false Write failed, do not proceed operation
|
||||
*/
|
||||
bool pmw33xx_write(uint8_t sensor, uint8_t reg_addr, uint8_t data);
|
||||
|
||||
void pmw33xx_init_wrapper(void);
|
||||
void pmw33xx_set_cpi_wrapper(uint16_t cpi);
|
||||
uint16_t pmw33xx_get_cpi_wrapper(void);
|
||||
report_mouse_t pmw33xx_get_report(report_mouse_t mouse_report);
|
||||
|
@ -29,7 +29,6 @@
|
||||
#define WS2812_EXTERNAL_PULLUP
|
||||
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
|
||||
#define WS2812_PWM_DMA_CHANNEL 3
|
||||
#define WS2812_PWM_TARGET_PERIOD 800000
|
||||
|
||||
/* Serial configuration for split keyboard. */
|
||||
#define SERIAL_USART_TX_PIN A9
|
||||
|
@ -27,7 +27,6 @@
|
||||
#define WS2812_EXTERNAL_PULLUP
|
||||
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
|
||||
#define WS2812_PWM_DMA_CHANNEL 3
|
||||
#define WS2812_PWM_TARGET_PERIOD 800000
|
||||
|
||||
/* Serial configuration for split keyboard. */
|
||||
#define SERIAL_USART_TX_PIN A9
|
||||
|
@ -29,7 +29,6 @@
|
||||
#define WS2812_EXTERNAL_PULLUP
|
||||
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
|
||||
#define WS2812_PWM_DMA_CHANNEL 3
|
||||
#define WS2812_PWM_TARGET_PERIOD 800000
|
||||
|
||||
/* Serial configuration for split keyboard. */
|
||||
#define SERIAL_USART_TX_PIN A9
|
||||
|
@ -393,7 +393,6 @@ bool shutdown_kb(bool jump_to_bootloader) {
|
||||
rgblight_setrgb(RGB_RED);
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
void rgb_matrix_update_pwm_buffers(void);
|
||||
rgb_matrix_set_color_all(RGB_RED);
|
||||
rgb_matrix_update_pwm_buffers();
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
|
@ -354,7 +354,6 @@ bool shutdown_kb(bool jump_to_bootloader) {
|
||||
rgblight_setrgb(RGB_RED);
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
void rgb_matrix_update_pwm_buffers(void);
|
||||
rgb_matrix_set_color_all(RGB_RED);
|
||||
rgb_matrix_update_pwm_buffers();
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
|
@ -29,7 +29,6 @@
|
||||
#define WS2812_EXTERNAL_PULLUP
|
||||
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
|
||||
#define WS2812_PWM_DMA_CHANNEL 3
|
||||
#define WS2812_PWM_TARGET_PERIOD 800000
|
||||
|
||||
/* Serial configuration for split keyboard. */
|
||||
#define SERIAL_USART_TX_PIN A9
|
||||
|
@ -29,7 +29,6 @@
|
||||
#define WS2812_EXTERNAL_PULLUP
|
||||
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
|
||||
#define WS2812_PWM_DMA_CHANNEL 3
|
||||
#define WS2812_PWM_TARGET_PERIOD 800000
|
||||
|
||||
/* Serial configuration for split keyboard. */
|
||||
#define SERIAL_USART_TX_PIN A9
|
||||
|
@ -29,7 +29,6 @@
|
||||
#define WS2812_EXTERNAL_PULLUP
|
||||
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
|
||||
#define WS2812_PWM_DMA_CHANNEL 3
|
||||
#define WS2812_PWM_TARGET_PERIOD 800000
|
||||
|
||||
/* Serial configuration for split keyboard. */
|
||||
#define SERIAL_USART_TX_PIN A9
|
||||
|
@ -60,6 +60,14 @@
|
||||
"resync": true
|
||||
}
|
||||
},
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2}
|
||||
]
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT_default": {
|
||||
"layout": [
|
||||
|
@ -44,3 +44,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||
)
|
||||
};
|
||||
|
||||
#if defined(ENCODER_MAP_ENABLE)
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[0] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN), ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(UG_HUED, UG_HUEU), ENCODER_CCW_CW(UG_SATD, UG_SATU) },
|
||||
[1] = { ENCODER_CCW_CW(UG_VALD, UG_VALU), ENCODER_CCW_CW(UG_SPDD, UG_SPDU), ENCODER_CCW_CW(UG_PREV, UG_NEXT), ENCODER_CCW_CW(KC_RIGHT, KC_LEFT) },
|
||||
};
|
||||
#endif
|
||||
|
@ -0,0 +1,2 @@
|
||||
ENCODER_ENABLE = yes
|
||||
ENCODER_MAP_ENABLE = yes
|
40
keyboards/cannonkeys/sagittarius/sagittarius.c
Normal file
40
keyboards/cannonkeys/sagittarius/sagittarius.c
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright 2024 Nick Brassel (@tzarc)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#if defined(ENCODER_ENABLE) || defined(ENCODER_MAP_ENABLE)
|
||||
|
||||
# if !defined(ENCODER_SETTLE_PIN_STATE_DELAY_US)
|
||||
# define ENCODER_SETTLE_PIN_STATE_DELAY_US 2
|
||||
# endif
|
||||
|
||||
static pin_t matrix_row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
|
||||
void encoder_driver_task(void) {
|
||||
// Set all relevant rows to output, which is different to the matrix expectations
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
gpio_set_pin_output(matrix_row_pins[i]);
|
||||
}
|
||||
|
||||
// Read each encoder
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
// Set the row pin low for the corresponding encoder...
|
||||
for (uint8_t j = 0; j < 4; j++) {
|
||||
gpio_write_pin(matrix_row_pins[j], (i == j) ? 0 : 1);
|
||||
}
|
||||
// ...and let them settle.
|
||||
wait_us(ENCODER_SETTLE_PIN_STATE_DELAY_US);
|
||||
|
||||
// Run the normal encoder handling
|
||||
extern void encoder_quadrature_handle_read(uint8_t index, uint8_t pin_a_state, uint8_t pin_b_state);
|
||||
extern uint8_t encoder_quadrature_read_pin(uint8_t index, bool pad_b);
|
||||
encoder_quadrature_handle_read(i, encoder_quadrature_read_pin(i, false), encoder_quadrature_read_pin(i, true));
|
||||
}
|
||||
|
||||
// Set all rows back to input-high as per matrix expectations
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
gpio_set_pin_input_high(matrix_row_pins[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // defined(ENCODER_ENABLE) || defined(ENCODER_MAP_ENABLE)
|
@ -112,9 +112,9 @@
|
||||
{"matrix": [5, 1], "x": 1.25, "y": 5.25, "w": 1.25},
|
||||
{"matrix": [5, 2], "x": 2.5, "y": 5.25, "w": 1.25},
|
||||
{"matrix": [5, 6], "x": 3.75, "y": 5.25, "w": 6.25},
|
||||
{"matrix": [5, 10], "x": 10, "y": 5.25, "w": 1},
|
||||
{"matrix": [5, 11], "x": 11, "y": 5.25, "w": 1},
|
||||
{"matrix": [5, 9], "x": 12, "y": 5.25, "w": 1},
|
||||
{"matrix": [5, 10], "x": 10, "y": 5.25},
|
||||
{"matrix": [5, 11], "x": 11, "y": 5.25},
|
||||
{"matrix": [5, 9], "x": 12, "y": 5.25},
|
||||
{"matrix": [5, 12], "x": 13.25, "y": 5.5},
|
||||
{"matrix": [5, 13], "x": 14.25, "y": 5.5},
|
||||
{"matrix": [5, 14], "x": 15.25, "y": 5.5}
|
||||
|
@ -2,3 +2,7 @@ CUSTOM_MATRIX = lite
|
||||
ANALOG_DRIVER_REQUIRED = yes
|
||||
VPATH += keyboards/cipulot/common
|
||||
SRC += matrix.c ec_board.c ec_switch_matrix.c
|
||||
|
||||
ifeq ($(strip $(VIA_ENABLE)), yes)
|
||||
SRC += via_ec.c
|
||||
endif
|
@ -17,6 +17,10 @@
|
||||
#include "ec_switch_matrix.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
# include "transactions.h"
|
||||
#endif
|
||||
|
||||
void eeconfig_init_kb(void) {
|
||||
// Default values
|
||||
eeprom_ec_config.actuation_mode = DEFAULT_ACTUATION_MODE;
|
||||
@ -57,8 +61,14 @@ void keyboard_post_init_kb(void) {
|
||||
ec_config.rescaled_mode_0_actuation_threshold[row][col] = rescale(ec_config.mode_0_actuation_threshold, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
ec_config.rescaled_mode_0_release_threshold[row][col] = rescale(ec_config.mode_0_release_threshold, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
ec_config.rescaled_mode_1_initial_deadzone_offset[row][col] = rescale(ec_config.mode_1_initial_deadzone_offset, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
ec_config.rescaled_mode_1_actuation_offset[row][col] = rescale(ec_config.mode_1_actuation_offset, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
ec_config.rescaled_mode_1_release_offset[row][col] = rescale(ec_config.mode_1_release_offset, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
transaction_register_rpc(RPC_ID_VIA_CMD, via_cmd_slave_handler);
|
||||
#endif
|
||||
|
||||
keyboard_post_init_user();
|
||||
}
|
||||
|
@ -37,8 +37,14 @@ const pin_t amux_en_pins[] = AMUX_EN_PINS;
|
||||
const pin_t amux_n_col_sizes[] = AMUX_COL_CHANNELS_SIZES;
|
||||
const pin_t amux_n_col_channels[][AMUX_MAX_COLS_COUNT] = {AMUX_COL_CHANNELS};
|
||||
|
||||
#ifdef UNUSED_POSITIONS_LIST
|
||||
const uint8_t UNUSED_POSITIONS[][2] = UNUSED_POSITIONS_LIST;
|
||||
# define UNUSED_POSITIONS_COUNT ARRAY_SIZE(UNUSED_POSITIONS)
|
||||
#endif
|
||||
|
||||
#define AMUX_SEL_PINS_COUNT ARRAY_SIZE(amux_sel_pins)
|
||||
#define EXPECTED_AMUX_SEL_PINS_COUNT ceil(log2(AMUX_MAX_COLS_COUNT)
|
||||
|
||||
// Checks for the correctness of the configuration
|
||||
_Static_assert(ARRAY_SIZE(amux_en_pins) == AMUX_COUNT, "AMUX_EN_PINS doesn't have the minimum number of bits required to enable all the multiplexers available");
|
||||
// Check that number of select pins is enough to select all the channels
|
||||
@ -70,6 +76,16 @@ void init_amux(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// Disable all the unused rows
|
||||
void disable_unused_row(uint8_t row) {
|
||||
// disable all the other rows apart from the current selected one
|
||||
for (uint8_t idx = 0; idx < MATRIX_ROWS; idx++) {
|
||||
if (idx != row) {
|
||||
gpio_write_pin_low(row_pins[idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Select the multiplexer channel of the specified multiplexer
|
||||
void select_amux_channel(uint8_t channel, uint8_t col) {
|
||||
// Get the channel for the specified multiplexer
|
||||
@ -158,6 +174,10 @@ void ec_noise_floor(void) {
|
||||
sum += amux_n_col_sizes[i];
|
||||
uint8_t adjusted_col = col + sum;
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
#ifdef UNUSED_POSITIONS_LIST
|
||||
if (is_unused_position(row, adjusted_col)) continue;
|
||||
#endif
|
||||
disable_unused_row(row);
|
||||
ec_config.noise_floor[row][adjusted_col] += ec_readkey_raw(amux, row, col);
|
||||
}
|
||||
}
|
||||
@ -180,11 +200,15 @@ bool ec_matrix_scan(matrix_row_t current_matrix[]) {
|
||||
for (uint8_t amux = 0; amux < AMUX_COUNT; amux++) {
|
||||
disable_unused_amux(amux);
|
||||
for (uint8_t col = 0; col < amux_n_col_sizes[amux]; col++) {
|
||||
uint8_t sum = 0;
|
||||
for (uint8_t i = 0; i < (amux > 0 ? amux : 0); i++)
|
||||
sum += amux_n_col_sizes[i];
|
||||
uint8_t adjusted_col = col + sum;
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
uint8_t sum = 0;
|
||||
for (uint8_t i = 0; i < (amux > 0 ? amux : 0); i++)
|
||||
sum += amux_n_col_sizes[i];
|
||||
uint8_t adjusted_col = col + sum;
|
||||
#ifdef UNUSED_POSITIONS_LIST
|
||||
if (is_unused_position(row, adjusted_col)) continue;
|
||||
#endif
|
||||
disable_unused_row(row);
|
||||
sw_value[row][adjusted_col] = ec_readkey_raw(amux, row, col);
|
||||
|
||||
if (ec_config.bottoming_calibration) {
|
||||
@ -266,7 +290,7 @@ bool ec_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint16_t
|
||||
uprintf("Key pressed: %d, %d, %d\n", row, col, sw_value);
|
||||
}
|
||||
// Has key moved up enough to be released?
|
||||
else if (sw_value < ec_config.extremum[row][col] - ec_config.mode_1_release_offset) {
|
||||
else if (sw_value < ec_config.extremum[row][col] - ec_config.rescaled_mode_1_release_offset[row][col]) {
|
||||
ec_config.extremum[row][col] = sw_value;
|
||||
*current_row &= ~(1 << col);
|
||||
uprintf("Key released: %d, %d, %d\n", row, col, sw_value);
|
||||
@ -280,7 +304,7 @@ bool ec_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint16_t
|
||||
ec_config.extremum[row][col] = sw_value;
|
||||
}
|
||||
// Has key moved down enough to be pressed?
|
||||
else if (sw_value > ec_config.extremum[row][col] + ec_config.mode_1_actuation_offset) {
|
||||
else if (sw_value > ec_config.extremum[row][col] + ec_config.rescaled_mode_1_actuation_offset[row][col]) {
|
||||
ec_config.extremum[row][col] = sw_value;
|
||||
*current_row |= (1 << col);
|
||||
uprintf("Key pressed: %d, %d, %d\n", row, col, sw_value);
|
||||
@ -312,6 +336,18 @@ void ec_print_matrix(void) {
|
||||
print("\n");
|
||||
}
|
||||
|
||||
// Check if the position is unused
|
||||
#ifdef UNUSED_POSITIONS_LIST
|
||||
bool is_unused_position(uint8_t row, uint8_t col) {
|
||||
for (uint8_t i = 0; i < UNUSED_POSITIONS_COUNT; i++) {
|
||||
if (UNUSED_POSITIONS[i][0] == row && UNUSED_POSITIONS[i][1] == col) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Rescale the value to a different range
|
||||
uint16_t rescale(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max) {
|
||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
|
@ -37,11 +37,13 @@ typedef struct {
|
||||
uint16_t mode_0_actuation_threshold; // threshold for key press in mode 0
|
||||
uint16_t mode_0_release_threshold; // threshold for key release in mode 0
|
||||
uint16_t mode_1_initial_deadzone_offset; // threshold for key press in mode 1 (initial deadzone)
|
||||
uint8_t mode_1_actuation_offset; // offset for key press in mode 1 (1-255)
|
||||
uint8_t mode_1_release_offset; // offset for key release in mode 1 (1-255)
|
||||
uint16_t rescaled_mode_0_actuation_threshold[MATRIX_ROWS][MATRIX_COLS]; // threshold for key press in mode 0 rescaled to actual scale
|
||||
uint16_t rescaled_mode_0_release_threshold[MATRIX_ROWS][MATRIX_COLS]; // threshold for key release in mode 0 rescaled to actual scale
|
||||
uint16_t rescaled_mode_1_initial_deadzone_offset[MATRIX_ROWS][MATRIX_COLS]; // threshold for key press in mode 1 (initial deadzone) rescaled to actual scale
|
||||
uint8_t mode_1_actuation_offset; // offset for key press in mode 1 (1-255)
|
||||
uint8_t mode_1_release_offset; // offset for key release in mode 1 (1-255)
|
||||
uint8_t rescaled_mode_1_actuation_offset[MATRIX_ROWS][MATRIX_COLS]; // offset for key press in mode 1 rescaled to actual scale
|
||||
uint8_t rescaled_mode_1_release_offset[MATRIX_ROWS][MATRIX_COLS]; // offset for key release in mode 1 rescaled to actual scale
|
||||
uint16_t extremum[MATRIX_ROWS][MATRIX_COLS]; // extremum values for mode 1
|
||||
uint16_t noise_floor[MATRIX_ROWS][MATRIX_COLS]; // noise floor detected during startup
|
||||
bool bottoming_calibration; // calibration mode for bottoming out values (true: calibration mode, false: normal mode)
|
||||
@ -58,6 +60,7 @@ extern ec_config_t ec_config;
|
||||
|
||||
void init_row(void);
|
||||
void init_amux(void);
|
||||
void disable_unused_row(uint8_t row);
|
||||
void select_amux_channel(uint8_t channel, uint8_t col);
|
||||
void disable_unused_amux(uint8_t channel);
|
||||
void discharge_capacitor(void);
|
||||
@ -71,3 +74,11 @@ bool ec_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint
|
||||
void ec_print_matrix(void);
|
||||
|
||||
uint16_t rescale(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max);
|
||||
|
||||
#ifdef UNUSED_POSITIONS_LIST
|
||||
bool is_unused_position(uint8_t row, uint8_t col);
|
||||
#endif
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
void via_cmd_slave_handler(uint8_t m2s_size, const void* m2s_buffer, uint8_t s2m_size, void* s2m_buffer);
|
||||
#endif
|
||||
|
@ -19,6 +19,10 @@
|
||||
#include "print.h"
|
||||
#include "via.h"
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
# include "transactions.h"
|
||||
#endif
|
||||
|
||||
#ifdef VIA_ENABLE
|
||||
|
||||
void ec_rescale_values(uint8_t item);
|
||||
@ -50,6 +54,12 @@ void via_config_set_value(uint8_t *data) {
|
||||
uint8_t *value_id = &(data[0]);
|
||||
uint8_t *value_data = &(data[1]);
|
||||
|
||||
# ifdef SPLIT_KEYBOARD
|
||||
if (is_keyboard_master()) {
|
||||
transaction_rpc_send(RPC_ID_VIA_CMD, 30, data);
|
||||
}
|
||||
# endif
|
||||
|
||||
switch (*value_id) {
|
||||
case id_actuation_mode: {
|
||||
eeprom_ec_config.actuation_mode = value_data[0];
|
||||
@ -115,6 +125,8 @@ void via_config_set_value(uint8_t *data) {
|
||||
ec_rescale_values(0);
|
||||
ec_rescale_values(1);
|
||||
ec_rescale_values(2);
|
||||
ec_rescale_values(3);
|
||||
ec_rescale_values(4);
|
||||
uprintf("#############################\n");
|
||||
uprintf("# Noise floor data acquired #\n");
|
||||
uprintf("#############################\n");
|
||||
@ -124,13 +136,14 @@ void via_config_set_value(uint8_t *data) {
|
||||
case id_show_calibration_data: {
|
||||
if (value_data[0] == 0) {
|
||||
ec_show_calibration_data();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case id_clear_bottoming_calibration_data: {
|
||||
if (value_data[0] == 0) {
|
||||
ec_clear_bottoming_calibration_data();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// Unhandled value.
|
||||
@ -240,6 +253,22 @@ void ec_rescale_values(uint8_t item) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Rescale the Rapid Trigger mode actuation offsets
|
||||
case 3:
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
ec_config.rescaled_mode_1_actuation_offset[row][col] = rescale(ec_config.mode_1_actuation_offset, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Rescale the Rapid Trigger mode release offsets
|
||||
case 4:
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
ec_config.rescaled_mode_1_release_offset[row][col] = rescale(ec_config.mode_1_release_offset, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Unhandled item.
|
||||
@ -258,9 +287,11 @@ void ec_save_threshold_data(uint8_t option) {
|
||||
// Save Rapid Trigger mode thresholds and rescale them for runtime usage
|
||||
else if (option == 1) {
|
||||
eeprom_ec_config.mode_1_initial_deadzone_offset = ec_config.mode_1_initial_deadzone_offset;
|
||||
eeprom_ec_config.mode_1_actuation_offset = ec_config.mode_1_actuation_offset;
|
||||
eeprom_ec_config.mode_1_release_offset = ec_config.mode_1_release_offset;
|
||||
eeprom_ec_config.mode_1_actuation_offset = ec_config.mode_1_actuation_offset;
|
||||
eeprom_ec_config.mode_1_release_offset = ec_config.mode_1_release_offset;
|
||||
ec_rescale_values(2);
|
||||
ec_rescale_values(3);
|
||||
ec_rescale_values(4);
|
||||
}
|
||||
eeconfig_update_kb_datablock(&eeprom_ec_config);
|
||||
uprintf("####################################\n");
|
||||
@ -272,11 +303,12 @@ void ec_save_threshold_data(uint8_t option) {
|
||||
void ec_save_bottoming_reading(void) {
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
// If the bottom reading doesn't go over the noise floor by BOTTOMING_CALIBRATION_THRESHOLD, it is likely that:
|
||||
// 1. The key is not actually in the matrix
|
||||
// 2. The key is on an alternative layout, therefore not being pressed
|
||||
// 3. The key in in the current layout but not being pressed
|
||||
if (ec_config.bottoming_reading[row][col] < (ec_config.noise_floor[row][col] + BOTTOMING_CALIBRATION_THRESHOLD)) {
|
||||
// If the calibration starter flag is still set on the key, it indicates that the key was skipped during the scan because it is not physically present.
|
||||
// If the flag is not set, it means a bottoming reading was taken. If this reading doesn't exceed the noise floor by the BOTTOMING_CALIBRATION_THRESHOLD, it likely indicates one of the following:
|
||||
// 1. The key is part of an alternative layout and is not being pressed.
|
||||
// 2. The key is in the current layout but is not being pressed.
|
||||
// In both conditions we should set the bottoming reading to the maximum value to avoid false positives.
|
||||
if (ec_config.bottoming_calibration_starter[row][col] || ec_config.bottoming_reading[row][col] < (ec_config.noise_floor[row][col] + BOTTOMING_CALIBRATION_THRESHOLD)) {
|
||||
eeprom_ec_config.bottoming_reading[row][col] = 1023;
|
||||
} else {
|
||||
eeprom_ec_config.bottoming_reading[row][col] = ec_config.bottoming_reading[row][col];
|
||||
@ -287,6 +319,8 @@ void ec_save_bottoming_reading(void) {
|
||||
ec_rescale_values(0);
|
||||
ec_rescale_values(1);
|
||||
ec_rescale_values(2);
|
||||
ec_rescale_values(3);
|
||||
ec_rescale_values(4);
|
||||
eeconfig_update_kb_datablock(&eeprom_ec_config);
|
||||
}
|
||||
|
||||
@ -360,4 +394,14 @@ void ec_clear_bottoming_calibration_data(void) {
|
||||
uprintf("######################################\n");
|
||||
}
|
||||
|
||||
# ifdef SPLIT_KEYBOARD
|
||||
void via_cmd_slave_handler(uint8_t m2s_size, const void *m2s_buffer, uint8_t s2m_size, void *s2m_buffer) {
|
||||
if (m2s_size == (RAW_EPSIZE-2)) {
|
||||
via_config_set_value((uint8_t *)m2s_buffer);
|
||||
} else {
|
||||
uprintf("Unexpected response in slave handler\n");
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif // VIA_ENABLE
|
||||
|
@ -1,3 +1 @@
|
||||
ifeq ($(strip $(VIA_ENABLE)), yes)
|
||||
SRC += keyboards/cipulot/common/via_ec.c
|
||||
endif
|
||||
include keyboards/cipulot/common/common_cipulot.mk
|
||||
|
@ -1,5 +1 @@
|
||||
CUSTOM_MATRIX = lite
|
||||
ANALOG_DRIVER_REQUIRED = yes
|
||||
VPATH += keyboards/cipulot/common
|
||||
SRC += matrix.c ec_board.c ec_switch_matrix.c
|
||||
OPT = 2
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 15
|
||||
|
||||
#define UNUSED_POSITIONS_LIST { {1, 14}, {2, 14}, {4, 3}, {4, 8} }
|
||||
|
||||
#define MATRIX_ROW_PINS \
|
||||
{ B15, A8, B0, A7, B1 }
|
||||
|
||||
|
@ -1,3 +1 @@
|
||||
ifeq ($(strip $(VIA_ENABLE)), yes)
|
||||
SRC += keyboards/cipulot/common/via_ec.c
|
||||
endif
|
||||
include keyboards/cipulot/common/common_cipulot.mk
|
||||
|
@ -1,5 +1 @@
|
||||
CUSTOM_MATRIX = lite
|
||||
ANALOG_DRIVER_REQUIRED = yes
|
||||
VPATH += keyboards/cipulot/common
|
||||
SRC += matrix.c ec_board.c ec_switch_matrix.c
|
||||
OPT = 3
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 15
|
||||
|
||||
#define UNUSED_POSITIONS_LIST { {2, 14}, {4, 3}, {4, 5}, {4, 7}, {4, 9}, {4, 14} }
|
||||
|
||||
#define MATRIX_ROW_PINS \
|
||||
{ A8, A15, B12, B8, B9}
|
||||
|
||||
|
@ -1,3 +1 @@
|
||||
ifeq ($(strip $(VIA_ENABLE)), yes)
|
||||
SRC += keyboards/cipulot/common/via_ec.c
|
||||
endif
|
||||
include keyboards/cipulot/common/common_cipulot.mk
|
||||
|
@ -1,5 +1 @@
|
||||
CUSTOM_MATRIX = lite
|
||||
ANALOG_DRIVER_REQUIRED = yes
|
||||
VPATH += keyboards/cipulot/common
|
||||
SRC += matrix.c ec_board.c ec_switch_matrix.c
|
||||
OPT = 2
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 15
|
||||
|
||||
#define UNUSED_POSITIONS_LIST { {3, 14}, {4, 3}, {4, 4}, {4, 5}, {4, 7}, {4, 8} }
|
||||
|
||||
#define MATRIX_ROW_PINS \
|
||||
{ B1, B10, B0, A1, A0 }
|
||||
|
||||
|
@ -1,3 +1 @@
|
||||
ifeq ($(strip $(VIA_ENABLE)), yes)
|
||||
SRC += keyboards/cipulot/common/via_ec.c
|
||||
endif
|
||||
include keyboards/cipulot/common/common_cipulot.mk
|
||||
|
@ -1,5 +1 @@
|
||||
CUSTOM_MATRIX = lite
|
||||
ANALOG_DRIVER_REQUIRED = yes
|
||||
VPATH += keyboards/cipulot/common
|
||||
SRC += matrix.c ec_board.c ec_switch_matrix.c
|
||||
OPT = 3
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define MATRIX_ROWS 6
|
||||
#define MATRIX_COLS 19
|
||||
|
||||
#define UNUSED_POSITIONS_LIST { {0, 1}, {0, 10}, {3, 14}, {4, 13}, {5, 4}, {5, 7}, {5, 12} }
|
||||
|
||||
#define MATRIX_ROW_PINS \
|
||||
{ B13, B12, B14, A9, B6, B7 }
|
||||
|
||||
|
@ -69,6 +69,8 @@ void keyboard_post_init_kb(void) {
|
||||
ec_config.rescaled_mode_0_actuation_threshold[row][col] = rescale(ec_config.mode_0_actuation_threshold, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
ec_config.rescaled_mode_0_release_threshold[row][col] = rescale(ec_config.mode_0_release_threshold, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
ec_config.rescaled_mode_1_initial_deadzone_offset[row][col] = rescale(ec_config.mode_1_initial_deadzone_offset, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
ec_config.rescaled_mode_1_actuation_offset[row][col] = rescale(ec_config.mode_1_actuation_offset, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
ec_config.rescaled_mode_1_release_offset[row][col] = rescale(ec_config.mode_1_release_offset, 0, 1023, ec_config.noise_floor[row][col], eeprom_ec_config.bottoming_reading[row][col]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,11 @@ const pin_t amux_en_pins[] = AMUX_EN_PINS;
|
||||
const pin_t amux_n_col_sizes[] = AMUX_COL_CHANNELS_SIZES;
|
||||
const pin_t amux_n_col_channels[][AMUX_MAX_COLS_COUNT] = {AMUX_COL_CHANNELS};
|
||||
|
||||
#ifdef UNUSED_POSITIONS_LIST
|
||||
const uint8_t UNUSED_POSITIONS[][2] = UNUSED_POSITIONS_LIST;
|
||||
# define UNUSED_POSITIONS_COUNT (sizeof(UNUSED_POSITIONS) / sizeof(UNUSED_POSITIONS[0]))
|
||||
#endif
|
||||
|
||||
#define AMUX_SEL_PINS_COUNT ARRAY_SIZE(amux_sel_pins)
|
||||
#define EXPECTED_AMUX_SEL_PINS_COUNT ceil(log2(AMUX_MAX_COLS_COUNT)
|
||||
// Checks for the correctness of the configuration
|
||||
@ -70,6 +75,16 @@ void init_amux(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// Disable all the unused rows
|
||||
void disable_unused_row(uint8_t row) {
|
||||
// disable all the other rows apart from the current selected one
|
||||
for (uint8_t idx = 0; idx < MATRIX_ROWS; idx++) {
|
||||
if (idx != row) {
|
||||
gpio_write_pin_low(row_pins[idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Select the multiplexer channel of the specified multiplexer
|
||||
void select_amux_channel(uint8_t channel, uint8_t col) {
|
||||
// Get the channel for the specified multiplexer
|
||||
@ -158,6 +173,10 @@ void ec_noise_floor(void) {
|
||||
sum += amux_n_col_sizes[i];
|
||||
uint8_t adjusted_col = col + sum;
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
#ifdef UNUSED_POSITIONS_LIST
|
||||
if (is_unused_position(row, adjusted_col)) continue;
|
||||
#endif
|
||||
disable_unused_row(row);
|
||||
ec_config.noise_floor[row][adjusted_col] += ec_readkey_raw(amux, row, col);
|
||||
}
|
||||
}
|
||||
@ -180,11 +199,15 @@ bool ec_matrix_scan(matrix_row_t current_matrix[]) {
|
||||
for (uint8_t amux = 0; amux < AMUX_COUNT; amux++) {
|
||||
disable_unused_amux(amux);
|
||||
for (uint8_t col = 0; col < amux_n_col_sizes[amux]; col++) {
|
||||
uint8_t sum = 0;
|
||||
for (uint8_t i = 0; i < (amux > 0 ? amux : 0); i++)
|
||||
sum += amux_n_col_sizes[i];
|
||||
uint8_t adjusted_col = col + sum;
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
uint8_t sum = 0;
|
||||
for (uint8_t i = 0; i < (amux > 0 ? amux : 0); i++)
|
||||
sum += amux_n_col_sizes[i];
|
||||
uint8_t adjusted_col = col + sum;
|
||||
#ifdef UNUSED_POSITIONS_LIST
|
||||
if (is_unused_position(row, adjusted_col)) continue;
|
||||
#endif
|
||||
disable_unused_row(row);
|
||||
sw_value[row][adjusted_col] = ec_readkey_raw(amux, row, col);
|
||||
|
||||
if (ec_config.bottoming_calibration) {
|
||||
@ -229,7 +252,7 @@ uint16_t ec_readkey_raw(uint8_t channel, uint8_t row, uint8_t col) {
|
||||
}
|
||||
|
||||
// Update press/release state of key
|
||||
bool ec_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint16_t sw_value) {
|
||||
bool ec_update_key(matrix_row_t *current_row, uint8_t row, uint8_t col, uint16_t sw_value) {
|
||||
bool current_state = (*current_row >> col) & 1;
|
||||
|
||||
// Real Time Noise Floor Calibration
|
||||
@ -266,7 +289,7 @@ bool ec_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint16_t
|
||||
uprintf("Key pressed: %d, %d, %d\n", row, col, sw_value);
|
||||
}
|
||||
// Has key moved up enough to be released?
|
||||
else if (sw_value < ec_config.extremum[row][col] - ec_config.mode_1_release_offset) {
|
||||
else if (sw_value < ec_config.extremum[row][col] - ec_config.rescaled_mode_1_release_offset[row][col]) {
|
||||
ec_config.extremum[row][col] = sw_value;
|
||||
*current_row &= ~(1 << col);
|
||||
uprintf("Key released: %d, %d, %d\n", row, col, sw_value);
|
||||
@ -280,7 +303,7 @@ bool ec_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint16_t
|
||||
ec_config.extremum[row][col] = sw_value;
|
||||
}
|
||||
// Has key moved down enough to be pressed?
|
||||
else if (sw_value > ec_config.extremum[row][col] + ec_config.mode_1_actuation_offset) {
|
||||
else if (sw_value > ec_config.extremum[row][col] + ec_config.rescaled_mode_1_actuation_offset[row][col]) {
|
||||
ec_config.extremum[row][col] = sw_value;
|
||||
*current_row |= (1 << col);
|
||||
uprintf("Key pressed: %d, %d, %d\n", row, col, sw_value);
|
||||
@ -312,6 +335,18 @@ void ec_print_matrix(void) {
|
||||
print("\n");
|
||||
}
|
||||
|
||||
// Check if the position is unused
|
||||
#ifdef UNUSED_POSITIONS_LIST
|
||||
bool is_unused_position(uint8_t row, uint8_t col) {
|
||||
for (uint8_t i = 0; i < UNUSED_POSITIONS_COUNT; i++) {
|
||||
if (UNUSED_POSITIONS[i][0] == row && UNUSED_POSITIONS[i][1] == col) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Rescale the value to a different range
|
||||
uint16_t rescale(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max) {
|
||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
|
@ -47,11 +47,13 @@ typedef struct {
|
||||
uint16_t mode_0_actuation_threshold; // threshold for key press in mode 0
|
||||
uint16_t mode_0_release_threshold; // threshold for key release in mode 0
|
||||
uint16_t mode_1_initial_deadzone_offset; // threshold for key press in mode 1 (initial deadzone)
|
||||
uint8_t mode_1_actuation_offset; // offset for key press in mode 1 (1-255)
|
||||
uint8_t mode_1_release_offset; // offset for key release in mode 1 (1-255)
|
||||
uint16_t rescaled_mode_0_actuation_threshold[MATRIX_ROWS][MATRIX_COLS]; // threshold for key press in mode 0 rescaled to actual scale
|
||||
uint16_t rescaled_mode_0_release_threshold[MATRIX_ROWS][MATRIX_COLS]; // threshold for key release in mode 0 rescaled to actual scale
|
||||
uint16_t rescaled_mode_1_initial_deadzone_offset[MATRIX_ROWS][MATRIX_COLS]; // threshold for key press in mode 1 (initial deadzone) rescaled to actual scale
|
||||
uint8_t mode_1_actuation_offset; // offset for key press in mode 1 (1-255)
|
||||
uint8_t mode_1_release_offset; // offset for key release in mode 1 (1-255)
|
||||
uint8_t rescaled_mode_1_actuation_offset[MATRIX_ROWS][MATRIX_COLS]; // offset for key press in mode 1 rescaled to actual scale
|
||||
uint8_t rescaled_mode_1_release_offset[MATRIX_ROWS][MATRIX_COLS]; // offset for key release in mode 1 rescaled to actual scale
|
||||
uint16_t extremum[MATRIX_ROWS][MATRIX_COLS]; // extremum values for mode 1
|
||||
uint16_t noise_floor[MATRIX_ROWS][MATRIX_COLS]; // noise floor detected during startup
|
||||
bool bottoming_calibration; // calibration mode for bottoming out values (true: calibration mode, false: normal mode)
|
||||
@ -81,3 +83,7 @@ bool ec_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint
|
||||
void ec_print_matrix(void);
|
||||
|
||||
uint16_t rescale(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max);
|
||||
|
||||
#ifdef UNUSED_POSITIONS_LIST
|
||||
bool is_unused_position(uint8_t row, uint8_t col);
|
||||
#endif
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 16
|
||||
|
||||
#define UNUSED_POSITIONS_LIST { {2, 12}, {3, 11}, {3, 12}, {4, 3}, {4, 4}, {4, 6}, {4, 7}, {4, 8}, {4, 9}, {4, 10} }
|
||||
|
||||
#define MATRIX_ROW_PINS \
|
||||
{ A14, B3, A15, B5, B4 }
|
||||
|
||||
|
@ -1,3 +1 @@
|
||||
ifeq ($(strip $(VIA_ENABLE)), yes)
|
||||
SRC += keyboards/cipulot/common/via_ec.c
|
||||
endif
|
||||
include keyboards/cipulot/common/common_cipulot.mk
|
||||
|
@ -1,5 +1 @@
|
||||
CUSTOM_MATRIX = lite
|
||||
ANALOG_DRIVER_REQUIRED = yes
|
||||
VPATH += keyboards/cipulot/common
|
||||
SRC += matrix.c ec_board.c ec_switch_matrix.c
|
||||
OPT = 3
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 16
|
||||
|
||||
#define UNUSED_POSITIONS_LIST { {3, 11}, {3, 12}, {4, 3}, {4, 4}, {4, 6}, {4, 7}, {4, 8}, {4, 9}, {4, 10} }
|
||||
|
||||
#define MATRIX_ROW_PINS \
|
||||
{ A14, B3, A15, B5, B4 }
|
||||
|
||||
|
@ -1,3 +1 @@
|
||||
ifeq ($(strip $(VIA_ENABLE)), yes)
|
||||
SRC += keyboards/cipulot/common/via_ec.c
|
||||
endif
|
||||
include keyboards/cipulot/common/common_cipulot.mk
|
||||
|
@ -1,5 +1 @@
|
||||
CUSTOM_MATRIX = lite
|
||||
ANALOG_DRIVER_REQUIRED = yes
|
||||
VPATH += keyboards/cipulot/common
|
||||
SRC += matrix.c ec_board.c ec_switch_matrix.c
|
||||
OPT = 3
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 15
|
||||
|
||||
#define UNUSED_POSITIONS_LIST { {2, 14}, {4, 0}, {4, 2}, {4, 4}, {4, 7}, {4, 9}, {4, 11}, {4, 12}, {4, 13} }
|
||||
|
||||
#define MATRIX_ROW_PINS \
|
||||
{ B13, A8, B12, B14, B15 }
|
||||
|
||||
|
@ -1,3 +1 @@
|
||||
ifeq ($(strip $(VIA_ENABLE)), yes)
|
||||
SRC += keyboards/cipulot/common/via_ec.c
|
||||
endif
|
||||
include keyboards/cipulot/common/common_cipulot.mk
|
||||
|
@ -1,5 +1 @@
|
||||
CUSTOM_MATRIX = lite
|
||||
ANALOG_DRIVER_REQUIRED = yes
|
||||
VPATH += keyboards/cipulot/common
|
||||
SRC += matrix.c ec_board.c ec_switch_matrix.c
|
||||
OPT = 3
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user