Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: can diff side test points #382

Merged
merged 3 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions edg/abstract_parts/AbstractTestPoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,25 @@ def contents(self):
def connected(self, io: Port[CanLogicLink]) -> 'CanControllerTestPoint':
cast(Block, builder.get_enclosing_block()).connect(io, self.io)
return self


class CanDiffTestPoint(TypedTestPoint, Block):
"""Two test points for CAN differential-side canh and canl"""

@init_in_parent
def __init__(self, tp_name: StringLike = ""):
super().__init__()
self.io = self.Port(CanDiffPort(DigitalBidir.empty()), [InOut])
self.tp_name = self.ArgParameter(tp_name)

def contents(self):
super().contents()
name_prefix = (self.tp_name == '').then_else(self.io.link().name(), self.tp_name)
self.tp_canh = self.Block(DigitalTestPoint(name_prefix + '.canh'))
self.tp_canl = self.Block(DigitalTestPoint(name_prefix + '.canl'))
self.connect(self.tp_canh.io, self.io.canh)
self.connect(self.tp_canl.io, self.io.canl)

def connected(self, io: Port[CanLogicLink]) -> 'CanDiffTestPoint':
cast(Block, builder.get_enclosing_block()).connect(io, self.io)
return self
2 changes: 1 addition & 1 deletion edg/abstract_parts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
from .AbstractDebugHeaders import SwdCortexTargetConnector, SwdCortexTargetConnectorReset, \
SwdCortexTargetConnectorSwo, SwdCortexTargetConnectorTdi
from .AbstractTestPoint import TestPoint, GroundTestPoint, VoltageTestPoint, DigitalTestPoint, DigitalArrayTestPoint, \
AnalogTestPoint, I2cTestPoint, SpiTestPoint, CanControllerTestPoint
AnalogTestPoint, I2cTestPoint, SpiTestPoint, CanControllerTestPoint, CanDiffTestPoint
from .AbstractTestPoint import AnalogRfTestPoint
from .AbstractJumper import Jumper, DigitalJumper
from .PassiveConnector import PassiveConnector, FootprintPassiveConnector
Expand Down
Loading