Skip to content

Commit b91e359

Browse files
authored
Add: can diff side test points (#382)
Adding the testpoints for can diff side. The controller side is already in the lib.
1 parent 353e803 commit b91e359

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

edg/abstract_parts/AbstractTestPoint.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,25 @@ def contents(self):
196196
def connected(self, io: Port[CanLogicLink]) -> 'CanControllerTestPoint':
197197
cast(Block, builder.get_enclosing_block()).connect(io, self.io)
198198
return self
199+
200+
201+
class CanDiffTestPoint(TypedTestPoint, Block):
202+
"""Two test points for CAN differential-side canh and canl"""
203+
204+
@init_in_parent
205+
def __init__(self, tp_name: StringLike = ""):
206+
super().__init__()
207+
self.io = self.Port(CanDiffPort(DigitalBidir.empty()), [InOut])
208+
self.tp_name = self.ArgParameter(tp_name)
209+
210+
def contents(self):
211+
super().contents()
212+
name_prefix = (self.tp_name == '').then_else(self.io.link().name(), self.tp_name)
213+
self.tp_canh = self.Block(DigitalTestPoint(name_prefix + '.canh'))
214+
self.tp_canl = self.Block(DigitalTestPoint(name_prefix + '.canl'))
215+
self.connect(self.tp_canh.io, self.io.canh)
216+
self.connect(self.tp_canl.io, self.io.canl)
217+
218+
def connected(self, io: Port[CanLogicLink]) -> 'CanDiffTestPoint':
219+
cast(Block, builder.get_enclosing_block()).connect(io, self.io)
220+
return self

edg/abstract_parts/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
from .AbstractDebugHeaders import SwdCortexTargetConnector, SwdCortexTargetConnectorReset, \
7878
SwdCortexTargetConnectorSwo, SwdCortexTargetConnectorTdi
7979
from .AbstractTestPoint import TestPoint, GroundTestPoint, VoltageTestPoint, DigitalTestPoint, DigitalArrayTestPoint, \
80-
AnalogTestPoint, I2cTestPoint, SpiTestPoint, CanControllerTestPoint
80+
AnalogTestPoint, I2cTestPoint, SpiTestPoint, CanControllerTestPoint, CanDiffTestPoint
8181
from .AbstractTestPoint import AnalogRfTestPoint
8282
from .AbstractJumper import Jumper, DigitalJumper
8383
from .PassiveConnector import PassiveConnector, FootprintPassiveConnector

0 commit comments

Comments
 (0)