forked from M-Labs/artiq
1
0
Fork 0

comm_analyzer: add get_channel_list

This commit is contained in:
Simon Renblad 2024-01-08 16:21:12 +08:00 committed by Sébastien Bourdeauducq
parent 64567bc26f
commit 3af4c9d517
1 changed files with 26 additions and 0 deletions

View File

@ -300,6 +300,23 @@ class WaveformChannel:
self.data.append((self.current_time, log_message)) self.data.append((self.current_time, log_message))
class ChannelSignatureManager:
def __init__(self):
self.current_scope = ""
self.channels = dict()
def get_channel(self, name, width, ty):
self.channels[self.current_scope + name] = (width, ty)
return None
@contextmanager
def scope(self, scope, name):
old_scope = self.current_scope
self.current_scope = scope + "/"
yield
self.current_scope = old_scope
class TTLHandler: class TTLHandler:
def __init__(self, manager, name): def __init__(self, manager, name):
self.name = name self.name = name
@ -628,6 +645,15 @@ def create_channel_handlers(manager, devices, ref_period,
return channel_handlers return channel_handlers
def get_channel_list(devices):
manager = ChannelSignatureManager()
create_channel_handlers(manager, devices, 1e-9, 3e9, False)
manager.get_channel("timestamp", 64, ty=WaveformType.VECTOR)
manager.get_channel("interval", 64, ty=WaveformType.ANALOG)
manager.get_channel("rtio_slack", 64, ty=WaveformType.ANALOG)
return manager.channels
def get_message_time(message): def get_message_time(message):
return getattr(message, "timestamp", message.rtio_counter) return getattr(message, "timestamp", message.rtio_counter)