From 98530cad3ba8733d8a100e0bc5f3cf47339c4b3e Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 29 Oct 2023 01:09:02 +0100 Subject: Implement data driven dip switches (#22017) * Add data driven dip switches * Autogen weak matrix_mask --- data/mappings/info_config.hjson | 4 ++++ data/mappings/info_rules.hjson | 1 + data/schemas/keyboard.jsonschema | 38 +++++++++++++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/data/mappings/info_config.hjson b/data/mappings/info_config.hjson index 66aca35e94..9b65c73084 100644 --- a/data/mappings/info_config.hjson +++ b/data/mappings/info_config.hjson @@ -45,6 +45,10 @@ // Combos "COMBO_TERM": {"info_key": "combo.term", "value_type": "int"}, + "DIP_SWITCH_MATRIX_GRID": {"info_key": "dip_switch.matrix_grid", "value_type": "array.array.int", "to_json": false}, + "DIP_SWITCH_PINS": {"info_key": "dip_switch.pins", "value_type": "array"}, + "DIP_SWITCH_PINS_RIGHT": {"info_key": "split.dip_switch.right.pins", "value_type": "array"}, + // Dynamic Keymap "DYNAMIC_KEYMAP_EEPROM_MAX_ADDR": {"info_key": "dynamic_keymap.eeprom_max_addr", "value_type": "int"}, "DYNAMIC_KEYMAP_LAYER_COUNT": {"info_key": "dynamic_keymap.layer_count", "value_type": "int"}, diff --git a/data/mappings/info_rules.hjson b/data/mappings/info_rules.hjson index 6a0f0a3030..02fc2bee9d 100644 --- a/data/mappings/info_rules.hjson +++ b/data/mappings/info_rules.hjson @@ -17,6 +17,7 @@ "BOOTLOADER": {"info_key": "bootloader", "warn_duplicate": false}, "BOOTMAGIC_ENABLE": {"info_key": "bootmagic.enabled", "value_type": "bool"}, "CAPS_WORD_ENABLE": {"info_key": "caps_word.enabled", "value_type": "bool"}, + "DIP_SWITCH_ENABLE": {"info_key": "dip_switch.enabled", "value_type": "bool"}, "DEBOUNCE_TYPE": {"info_key": "build.debounce_type"}, "EEPROM_DRIVER": {"info_key": "eeprom.driver"}, "ENCODER_ENABLE": {"info_key": "encoder.enabled", "value_type": "bool"}, diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index c120099745..540ce4e42a 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -20,7 +20,15 @@ } } } - } + }, + "dip_switch_config": { + "type": "object", + "properties": { + "pins": { + "$ref": "qmk.definitions.v1#/mcu_pin_array" + } + } + }, }, "type": "object", "not": { "required": [ "vendorId", "productId" ] }, // reject via keys... @@ -245,6 +253,25 @@ "type": "array", "items": {"$ref": "qmk.definitions.v1#/filename"} }, + "dip_switch": { + "$ref": "#/definitions/dip_switch_config", + "properties": { + "enabled": {"type": "boolean"}, + "matrix_grid": { + "type": "array", + "minItems": 1, + "items": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "items": { + "type": "integer", + "minimum": 0 + } + } + } + } + }, "eeprom": { "properties": { "driver": {"type": "string"}, @@ -636,6 +663,15 @@ } } }, + "dip_switch": { + "type": "object", + "additionalProperties": false, + "properties": { + "right": { + "$ref": "#/definitions/dip_switch_config" + } + } + }, "encoder": { "type": "object", "additionalProperties": false, -- cgit v1.2.3