forked from M-Labs/artiq
ddb_template: edge counter keys correspond with according ttl keys
previously ttl_counter_0 and ttl_0 could be on completely different physical ttl output channels with this change, ttl_0_counter (note the changed key format) is always on the same channel as ttl_0 Signed-off-by: Leon Riesebos <leon.riesebos@duke.edu>
This commit is contained in:
parent
e7a46ec767
commit
2cf144a60c
@ -22,6 +22,8 @@ Highlights:
|
||||
* ``get()``, ``get_mu()``, ``get_att()``, and ``get_att_mu()`` functions added for AD9910 and AD9912
|
||||
* New hardware support:
|
||||
- HVAMP_8CH 8 channel HV amplifier for Fastino / Zotino
|
||||
* ``artiq_ddb_template`` generates edge-counter keys that start with the key of the corresponding
|
||||
TTL device (e.g. ``"ttl_0_counter"`` for the edge counter on TTL device``"ttl_0"``)
|
||||
|
||||
Breaking changes:
|
||||
|
||||
|
@ -82,7 +82,7 @@ class PeripheralManager:
|
||||
def gen(self, string, **kwargs):
|
||||
print(textwrap.dedent(string).format(**kwargs), file=self.output)
|
||||
|
||||
def process_dio(self, rtio_offset, peripheral):
|
||||
def process_dio(self, rtio_offset, peripheral, num_channels=8):
|
||||
class_names = {
|
||||
"input": "TTLInOut",
|
||||
"output": "TTLOut"
|
||||
@ -92,7 +92,8 @@ class PeripheralManager:
|
||||
class_names[peripheral["bank_direction_high"]]
|
||||
]
|
||||
channel = count(0)
|
||||
for i in range(8):
|
||||
name = [self.get_name("ttl") for _ in range(num_channels)]
|
||||
for i in range(num_channels):
|
||||
self.gen("""
|
||||
device_db["{name}"] = {{
|
||||
"type": "local",
|
||||
@ -101,22 +102,22 @@ class PeripheralManager:
|
||||
"arguments": {{"channel": 0x{channel:06x}}},
|
||||
}}
|
||||
""",
|
||||
name=self.get_name("ttl"),
|
||||
name=name[i],
|
||||
class_name=classes[i // 4],
|
||||
channel=rtio_offset + next(channel))
|
||||
if peripheral.get("edge_counter", False):
|
||||
for i in range(8):
|
||||
for i in range(num_channels):
|
||||
class_name = classes[i // 4]
|
||||
if class_name == "TTLInOut":
|
||||
self.gen("""
|
||||
device_db["{name}"] = {{
|
||||
device_db["{name}_counter"] = {{
|
||||
"type": "local",
|
||||
"module": "artiq.coredevice.edge_counter",
|
||||
"class": "EdgeCounter",
|
||||
"arguments": {{"channel": 0x{channel:06x}}},
|
||||
}}
|
||||
""",
|
||||
name=self.get_name("ttl_counter"),
|
||||
name=name[i],
|
||||
channel=rtio_offset + next(channel))
|
||||
return next(channel)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user