Schemas / I/O

rig.sensor.gpio

v1.0.0 · stable maturity: draft 5 fields 2 required

Fields

FieldTypeMeaning
pin int required GPIO index
mode enumin · out required in, out
level number0 – 1 optional Optional. 0-1 reading or drive; absent = 0
device entity optional Optional board / network entity; absent or none = local
terminal entity optional Optional. rig.circuit.pin this line drives or reads; absent = not linked to a design

Digital hosts threshold level themselves (e.g. ≥ 0.5). A ROS 2 node entity is a valid device - docs/ros.md.

pin is the controller's logical line (BCM 17 on a Raspberry Pi). The physical terminal it comes out on (header pin 11) is the terminal entity's number. Keep both: code addresses the line, a wiring diagram addresses the terminal.

JSON Schema

Resolves at https://rig.works/schemas/rig.sensor.gpio.schema.json — raw file.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rig.works/schemas/rig.sensor.gpio.schema.json",
  "title": "rig.sensor.gpio",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "pin": {
      "$ref": "./_defs.schema.json#/$defs/int"
    },
    "mode": {
      "type": "string",
      "enum": [
        "in",
        "out"
      ]
    },
    "level": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "device": {
      "$ref": "./_defs.schema.json#/$defs/entity"
    },
    "terminal": {
      "$ref": "./_defs.schema.json#/$defs/entity"
    }
  },
  "required": [
    "pin",
    "mode"
  ],
  "x-rig-maturity": "draft"
}

Seen in

kicad-pcb.json