Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support additional split sync items for info.json #22193

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions data/mappings/info_config.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,21 @@
// Split Keyboard
"SOFT_SERIAL_PIN": {"info_key": "split.soft_serial_pin"},
"SOFT_SERIAL_SPEED": {"info_key": "split.soft_serial_speed"},
"SPLIT_MODS_ENABLE": {"info_key": "split.transport.sync_modifiers", "value_type": "bool"},
"SPLIT_TRANSPORT_MIRROR": {"info_key": "split.transport.sync_matrix_state", "value_type": "bool"},
"SPLIT_USB_DETECT": {"info_key": "split.usb_detect.enabled", "value_type": "bool"},
"SPLIT_USB_TIMEOUT": {"info_key": "split.usb_detect.timeout", "value_type": "int"},
"SPLIT_USB_TIMEOUT_POLL": {"info_key": "split.usb_detect.polling_interval", "value_type": "int"},
"SPLIT_WATCHDOG_ENABLE": {"info_key": "split.transport.watchdog", "value_type": "bool"},
"SPLIT_WATCHDOG_TIMEOUT": {"info_key": "split.transport.watchdog_timeout", "value_type": "int"},
"SPLIT_ACTIVITY_ENABLE": {"info_key": "split.transport.sync.activity", "value_type": "bool"},
"SPLIT_DETECTED_OS_ENABLE": {"info_key": "split.transport.sync.detected_os", "value_type": "bool"},
"SPLIT_HAPTIC_ENABLE": {"info_key": "split.transport.sync.haptic", "value_type": "bool"},
"SPLIT_LAYER_STATE_ENABLE": {"info_key": "split.transport.sync.layer_state", "value_type": "bool"},
"SPLIT_LED_STATE_ENABLE": {"info_key": "split.transport.sync.indicators", "value_type": "bool"},
"SPLIT_TRANSPORT_MIRROR": {"info_key": "split.transport.sync.matrix_state", "value_type": "bool"},
"SPLIT_MODS_ENABLE": {"info_key": "split.transport.sync.modifiers", "value_type": "bool"},
"SPLIT_OLED_ENABLE": {"info_key": "split.transport.sync.oled", "value_type": "bool"},
"SPLIT_ST7565_ENABLE": {"info_key": "split.transport.sync.st7565", "value_type": "bool"},
"SPLIT_WPM_ENABLE": {"info_key": "split.transport.sync.wpm", "value_type": "bool"},

// Tapping
"HOLD_ON_OTHER_KEY_PRESS": {"info_key": "tapping.hold_on_other_key_press", "value_type": "bool"},
Expand Down
28 changes: 25 additions & 3 deletions data/schemas/keyboard.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -663,10 +663,32 @@
"type": "string",
"enum": ["custom", "i2c", "serial", "serial_usart"]
},
"sync_matrix_state": {"type": "boolean"},
"sync_modifiers": {"type": "boolean"},
"sync": {
"type": "object",
"additionalProperties": false,
"properties": {
"activity": {"type": "boolean"},
"detected_os": {"type": "boolean"},
"haptic": {"type": "boolean"},
"layer_state": {"type": "boolean"},
"indicators": {"type": "boolean"},
"matrix_state": {"type": "boolean"},
"modifiers": {"type": "boolean"},
"oled": {"type": "boolean"},
"st7565": {"type": "boolean"},
"wpm": {"type": "boolean"}
}
}
"watchdog": {"type": "boolean"},
"watchdog_timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"}
"watchdog_timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"},
"sync_matrix_state": {
"type": "boolean",
"$comment": "Deprecated: use sync.matrix_state instead"
},
"sync_modifiers": {
"type": "boolean",
"$comment": "Deprecated: use sync.modifiers instead"
}
}
},
"usb_detect": {
Expand Down
37 changes: 31 additions & 6 deletions docs/reference_info_json.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,37 @@ Configures the [Split Keyboard](feature_split_keyboard.md) feature.
* `transport`
* `protocol`
* The split transport protocol to use. Must be one of `custom`, `i2c`, `serial`, `serial_usart`.
* `sync_matrix_state`
* Mirror the main/primary half's matrix state to the secondary half.
* Default: `false`
* `sync_modifiers`
* Mirror the modifier state to the secondary half.
* Default: `false`
* `sync`
* `activity`
* Mirror the activity timestamps to the secondary half.
* Default: `false`
* `detected_os`
* Mirror the [detected OS](feature_os_detection.md) to the secondary half.
* Default: `false`
* `haptic`
* Mirror the haptic state and process haptic feedback to the secondary half.
* Default: `false`
* `layer_state`
* Mirror the layer state to the secondary half.
* Default: `false`
* `indicators`
* Mirror the indicator state to the secondary half.
* Default: `false`
* `matrix_state`
* Mirror the main/primary half's matrix state to the secondary half.
* Default: `false`
* `modifiers`
* Mirror the modifier state to the secondary half.
* Default: `false`
* `oled`
* Mirror the OLED on/off status to the secondary half.
* Default: `false`
* `st7565`
* Mirror the ST7565 on/off status to the secondary half.
* Default: `false`
* `wpm`
* Mirror the current WPM value to the secondary half.
* Default: `false`
* `watchdog`
* Reboot the secondary half if it loses connection.
* Default: `false`
Expand Down
9 changes: 9 additions & 0 deletions lib/python/qmk/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,15 @@ def _extract_split_transport(info_data, config_c):
if 'protocol' not in info_data['split']['transport']:
info_data['split']['transport']['protocol'] = 'serial'

# Migrate
transport = info_data.get('split', {}).get('transport', {})
if 'sync_matrix_state' in transport:
transport['sync'] = transport.get('sync', {})
transport['sync']['matrix_state'] = transport.pop('sync_matrix_state')
if 'sync_modifiers' in transport:
transport['sync'] = transport.get('sync', {})
transport['sync']['modifiers'] = transport.pop('sync_modifiers')


def _extract_split_right_pins(info_data, config_c):
# Figure out the right half matrix pins
Expand Down