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
parent 669edf17c5
commit ecba1cd5f6
1 changed files with 26 additions and 0 deletions

View File

@ -246,6 +246,23 @@ class WaveformChannel:
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:
def __init__(self, manager, name):
self.name = name
@ -574,6 +591,15 @@ def create_channel_handlers(manager, devices, ref_period,
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):
return getattr(message, "timestamp", message.rtio_counter)