From e4c54a9612318ea03accfb688c8440b62c5706e1 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sat, 21 Oct 2023 01:48:05 +0100 Subject: Support additional split sync items for info.json (#22193) --- data/mappings/info_config.hjson | 12 ++++++++++-- data/schemas/keyboard.jsonschema | 28 +++++++++++++++++++++++++--- docs/reference_info_json.md | 37 +++++++++++++++++++++++++++++++------ lib/python/qmk/info.py | 9 +++++++++ 4 files changed, 75 insertions(+), 11 deletions(-) diff --git a/data/mappings/info_config.hjson b/data/mappings/info_config.hjson index e68a4439d0..4cebe906b4 100644 --- a/data/mappings/info_config.hjson +++ b/data/mappings/info_config.hjson @@ -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"}, diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index e0be8f5b97..8ff94fb9f2 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -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": { diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md index f31d3c4a2f..e05b09c6cd 100644 --- a/docs/reference_info_json.md +++ b/docs/reference_info_json.md @@ -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` diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 4806add67a..265e6a645f 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -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 -- cgit v1.2.3