Skip to content

Commit

Permalink
Add: can diff side test points (#382)
Browse files Browse the repository at this point in the history
Adding the testpoints for can diff side. The controller side is already
in the lib.
  • Loading branch information
Suke0811 authored Sep 21, 2024
1 parent 353e803 commit b91e359
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
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

0 comments on commit b91e359

Please sign in to comment.