logic_analyzer: only set triggers if extra info provided in config

This commit is contained in:
Fischer Moseley 2024-09-09 19:27:29 -07:00
parent 0cb58c169e
commit 1c1c514a39
4 changed files with 13 additions and 6 deletions

View File

@ -3,6 +3,7 @@ cores:
my_logic_analyzer:
type: logic_analyzer
sample_depth: 2048
trigger_mode: single_shot
probes:
probe0: 1

View File

@ -3,6 +3,7 @@ cores:
my_logic_analyzer:
type: logic_analyzer
sample_depth: 8192
trigger_mode: single_shot
probes:
probe0: 1

View File

@ -3,6 +3,7 @@ cores:
my_logic_analyzer:
type: logic_analyzer
sample_depth: 256
trigger_mode: single_shot
probes:
probe0: 1

View File

@ -115,13 +115,17 @@ class LogicAnalyzerCore(MantaCore):
# Checks and formatting complete, create LogicAnalyzerCore
probes = [Signal(width, name=name) for name, width in config["probes"].items()]
core = cls(sample_depth, probes)
core.set_triggers(
trigger_mode=config.get("trigger_mode"),
triggers=triggers,
trigger_location=config.get("trigger_location"),
)
# If any trigger-related configuration was provided, set the triggers with it
keys = ["trigger_mode", "triggers", "trigger_location"]
if any([key in config for key in keys]):
core.set_triggers(
trigger_mode=config.get("trigger_mode"),
triggers=triggers,
trigger_location=config.get("trigger_location"),
)
return core
def define_submodules(self):