{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://beyond-kle.org/schemas/elc-layer.json", "title": "ELC Layer - Electrical Wiring", "description": "Wiring between provider pins and key terminals", "type": "object", "required": ["version", "phyReference", "providers", "keys"], "properties": { "version": { "type": "string" }, "phyReference": { "type": "object", "required": ["source", "checksum"], "properties": { "source": { "type": "string" }, "checksum": { "type": "string" } } }, "providers": { "type": "array", "items": { "$ref": "#/$defs/provider" } }, "keys": { "type": "array", "items": { "$ref": "#/$defs/keyWiring" } }, "ledChains": { "type": "array", "items": { "$ref": "#/$defs/ledChain" } } }, "$defs": { "pinRef": { "type": "string", "pattern": "^(VCC|GND|[^.]+\\.[^.]+)$", "description": "\".\", or the reserved power rails VCC / GND" }, "provider": { "oneOf": [{ "$ref": "#/$defs/mcuProvider" }, { "$ref": "#/$defs/analogMuxProvider" }] }, "mcuProvider": { "type": "object", "required": ["id", "kind", "part"], "properties": { "id": { "type": "string" }, "kind": { "const": "mcu" }, "part": { "type": "string", "description": "Part number. Used to interpret pin names" } } }, "analogMuxProvider": { "type": "object", "required": ["id", "kind", "channels", "select", "common"], "properties": { "id": { "type": "string" }, "kind": { "const": "analog-mux" }, "channels": { "type": "integer", "minimum": 1, "description": "Number of logical pins provided. Pin names are \"0\"..\"channels-1\"" }, "select": { "type": "array", "items": { "$ref": "#/$defs/pinRef" }, "description": "Select pins, least significant bit first" }, "common": { "$ref": "#/$defs/pinRef" }, "enable": { "$ref": "#/$defs/pinRef" } } }, "keyWiring": { "oneOf": [{ "$ref": "#/$defs/contactKey" }, { "$ref": "#/$defs/analogKey" }] }, "contactKey": { "type": "object", "required": ["key", "detect", "terminals"], "properties": { "key": { "type": "string", "description": "Reference to PHY layer key ID" }, "detect": { "const": "contact" }, "terminals": { "type": "object", "description": "Non-polar. a and b carry no ordering meaning", "required": ["a", "b"], "properties": { "a": { "$ref": "#/$defs/pinRef" }, "b": { "$ref": "#/$defs/pinRef" } } }, "diode": { "type": "string", "enum": ["a-to-b", "b-to-a"], "description": "Anode side comes first. Omitted means no diode" } } }, "analogKey": { "type": "object", "required": ["key", "detect", "terminals"], "properties": { "key": { "type": "string", "description": "Reference to PHY layer key ID" }, "detect": { "const": "analog" }, "terminals": { "type": "object", "required": ["out", "vcc", "gnd"], "properties": { "out": { "$ref": "#/$defs/pinRef" }, "vcc": { "$ref": "#/$defs/pinRef" }, "gnd": { "$ref": "#/$defs/pinRef" } } } } }, "ledChain": { "type": "object", "required": ["id", "data", "order"], "properties": { "id": { "type": "string" }, "data": { "$ref": "#/$defs/pinRef" }, "order": { "type": "array", "items": { "type": "string" }, "description": "PHY node IDs. The position in the array is the LED number" } } } } }