CircuitPython Dialect API
Tier: Dialect Surface
P1AM hardware model, module catalog, validation, and code generation.
pyrung.circuitpy.CircuitPyFinding
dataclass
pyrung.circuitpy.CircuitPyValidationReport
dataclass
pyrung.circuitpy.ChannelGroup
dataclass
One homogeneous group of channels within a module.
Simple modules have a single group. Combo modules (e.g. P1-16CDR) have two groups — one input, one output.
Attributes:
| Name | Type | Description |
|---|---|---|
direction |
ModuleDirection
|
|
count |
int
|
Number of channels in this group (positive). |
tag_type |
TagType
|
IEC data type for the channels. |
pyrung.circuitpy.MAX_SLOTS
module-attribute
Maximum number of I/O module slots on the P1AM-200 base unit.
pyrung.circuitpy.MODULE_CATALOG
module-attribute
MODULE_CATALOG: Final[dict[str, ModuleSpec]] = {
"P1-08ND-TTL": ModuleSpec(
"P1-08ND-TTL", "8-ch discrete input (TTL)", _di(8)
),
"P1-08ND3": ModuleSpec(
"P1-08ND3", "8-ch discrete input (24V sink)", _di(8)
),
"P1-08NA": ModuleSpec(
"P1-08NA", "8-ch discrete input (120V AC)", _di(8)
),
"P1-08SIM": ModuleSpec(
"P1-08SIM", "8-ch discrete input simulator", _di(8)
),
"P1-08NE3": ModuleSpec(
"P1-08NE3",
"8-ch discrete input (24V source)",
_di(8),
),
"P1-16ND3": ModuleSpec(
"P1-16ND3",
"16-ch discrete input (24V sink)",
_di(16),
),
"P1-16NE3": ModuleSpec(
"P1-16NE3",
"16-ch discrete input (24V source)",
_di(16),
),
"P1-04TRS": ModuleSpec(
"P1-04TRS", "4-ch relay output", _do(4)
),
"P1-08TA": ModuleSpec(
"P1-08TA", "8-ch AC output", _do(8)
),
"P1-08TRS": ModuleSpec(
"P1-08TRS", "8-ch relay output", _do(8)
),
"P1-16TR": ModuleSpec(
"P1-16TR", "16-ch relay output", _do(16)
),
"P1-08TD-TTL": ModuleSpec(
"P1-08TD-TTL", "8-ch discrete output (TTL)", _do(8)
),
"P1-08TD1": ModuleSpec(
"P1-08TD1",
"8-ch discrete output (24V sink)",
_do(8),
),
"P1-08TD2": ModuleSpec(
"P1-08TD2",
"8-ch discrete output (24V source)",
_do(8),
),
"P1-15TD1": ModuleSpec(
"P1-15TD1",
"15-ch discrete output (24V sink)",
_do(15),
),
"P1-15TD2": ModuleSpec(
"P1-15TD2",
"15-ch discrete output (24V source)",
_do(15),
),
"P1-16CDR": ModuleSpec(
"P1-16CDR",
"8-ch DI + 8-ch relay DO",
_combo_discrete(8, 8),
),
"P1-15CDD1": ModuleSpec(
"P1-15CDD1",
"8-ch DI + 7-ch DO (24V sink)",
_combo_discrete(8, 7),
),
"P1-15CDD2": ModuleSpec(
"P1-15CDD2",
"8-ch DI + 7-ch DO (24V source)",
_combo_discrete(8, 7),
),
"P1-04AD": ModuleSpec(
"P1-04AD",
"4-ch analog input (voltage/current)",
_ai(4),
),
"P1-04AD-1": ModuleSpec(
"P1-04AD-1", "4-ch analog input (voltage)", _ai(4)
),
"P1-04AD-2": ModuleSpec(
"P1-04AD-2", "4-ch analog input (current)", _ai(4)
),
"P1-04RTD": ModuleSpec(
"P1-04RTD",
"4-ch RTD temperature input",
_temp_ai(4),
),
"P1-04THM": ModuleSpec(
"P1-04THM", "4-ch thermocouple input", _temp_ai(4)
),
"P1-04NTC": ModuleSpec(
"P1-04NTC",
"4-ch NTC temperature input",
_temp_ai(4),
),
"P1-04ADL-1": ModuleSpec(
"P1-04ADL-1",
"4-ch analog input (voltage, low-cost)",
_ai(4),
),
"P1-04ADL-2": ModuleSpec(
"P1-04ADL-2",
"4-ch analog input (current, low-cost)",
_ai(4),
),
"P1-08ADL-1": ModuleSpec(
"P1-08ADL-1",
"8-ch analog input (voltage, low-cost)",
_ai(8),
),
"P1-08ADL-2": ModuleSpec(
"P1-08ADL-2",
"8-ch analog input (current, low-cost)",
_ai(8),
),
"P1-04DAL-1": ModuleSpec(
"P1-04DAL-1",
"4-ch analog output (voltage, low-cost)",
_ao(4),
),
"P1-04DAL-2": ModuleSpec(
"P1-04DAL-2",
"4-ch analog output (current, low-cost)",
_ao(4),
),
"P1-08DAL-1": ModuleSpec(
"P1-08DAL-1",
"8-ch analog output (voltage, low-cost)",
_ao(8),
),
"P1-08DAL-2": ModuleSpec(
"P1-08DAL-2",
"8-ch analog output (current, low-cost)",
_ao(8),
),
"P1-4ADL2DAL-1": ModuleSpec(
"P1-4ADL2DAL-1",
"4-ch AI (voltage) + 2-ch AO (voltage)",
_combo_analog(4, 2),
),
"P1-4ADL2DAL-2": ModuleSpec(
"P1-4ADL2DAL-2",
"4-ch AI (current) + 2-ch AO (current)",
_combo_analog(4, 2),
),
}
pyrung.circuitpy.ModuleDirection
Bases: Enum
I/O direction of a P1AM module.
pyrung.circuitpy.ModuleSpec
dataclass
Static specification for a single P1AM I/O module.
Attributes:
| Name | Type | Description |
|---|---|---|
part_number |
str
|
Manufacturer part number (e.g. |
description |
str
|
Human-readable summary. |
groups |
tuple[ChannelGroup, ...]
|
One or two :class: |
input_group
property
The input channel group, or None if the module has no inputs.
pyrung.circuitpy.P1AM
P1AM-200 hardware configuration.
Represents a P1AM-200 base unit with up to 15 I/O module slots.
Each slot is configured with a module part number via :meth:slot,
which constructs and returns the appropriate
:class:~pyrung.core.memory_block.InputBlock /
:class:~pyrung.core.memory_block.OutputBlock.
This class holds no runtime state — it produces Block instances
whose tags reference values in SystemState.tags via the core engine.
Example::
hw = P1AM()
inputs = hw.slot(1, "P1-08SIM") # InputBlock
outputs = hw.slot(2, "P1-08TRS") # OutputBlock
inp, out = hw.slot(3, "P1-16CDR") # combo → tuple
Button = inputs[1] # LiveInputTag("Slot1.1", BOOL)
Light = outputs[1] # LiveOutputTag("Slot2.1", BOOL)
configured_slots
property
Mapping of slot number → :class:ModuleSpec for all configured slots.
slot
Configure a module in the given slot and return its block(s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
int
|
Slot number (1–15 inclusive). |
required |
module
|
str
|
Module part number (e.g. |
required |
name
|
str | None
|
Optional custom name prefix for tags in this slot.
Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
SlotValue
|
|
SlotValue
|
|
SlotValue
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If number is out of range, module is not in the catalog, or the slot is already configured. |
pyrung.circuitpy.RunStopConfig
dataclass
Optional RUN/STOP hardware-mode mapping for generated runtime.
pyrung.circuitpy.board
P1AM-200 onboard peripheral tag model.
P1AMNeoPixelNamespace
dataclass
Onboard single NeoPixel RGB channels.
P1AMBoardNamespace
dataclass
Onboard P1AM peripheral tags.
RunStopConfig
dataclass
Optional RUN/STOP hardware-mode mapping for generated runtime.