Skip to content

Commit b4e9b44

Browse files
committed
merge
2 parents 30c657f + 673d432 commit b4e9b44

File tree

112 files changed

+105227
-66275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+105227
-66275
lines changed

edg/BoardTop.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def refinements(self) -> Refinements:
7878
(Resistor, JlcResistor),
7979
(Capacitor, JlcCapacitor),
8080
(Inductor, JlcInductor),
81+
(AluminumCapacitor, JlcAluminumCapacitor),
8182
(FerriteBead, JlcFerriteBead),
8283
(PptcFuse, JlcPptcFuse),
8384
(ResistorArray, JlcResistorArray),

edg/abstract_parts/AbstractAntenna.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@abstract_block
88
class Antenna(Interface, Block):
99
@init_in_parent
10-
def __init__(self, frequency: RangeLike, impedance: RangeLike = Range.all(), power: RangeLike = (0, 0*Watt)):
10+
def __init__(self, frequency: RangeLike, impedance: RangeLike = Range.all(), power: RangeLike = (0, 0)*Watt):
1111
super().__init__()
1212

1313
self.frequency = self.ArgParameter(frequency)

edg/abstract_parts/AbstractCapacitor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,16 @@ def add_derated_row(row: PartsTableRow) -> Optional[Dict[PartsTableColumn, Any]]
264264
))
265265

266266
def _row_generate(self, row: PartsTableRow) -> None:
267+
"""This one is weird. Because this is the last in the class order, this is called last.
268+
So the top subclass needs explicit logic to handle parallel capacitors."""
269+
super()._row_generate(row)
267270
if row[self.PARALLEL_COUNT] == 1:
268-
super()._row_generate(row) # creates the footprint
269271
self.assign(self.actual_derated_capacitance, row[self.DERATED_CAPACITANCE])
270272
else:
271273
self.assign(self.actual_part, f"{row[self.PARALLEL_COUNT]}x {row[self.PART_NUMBER_COL]}")
272274
self.assign(self.actual_voltage_rating, row[self.VOLTAGE_RATING])
273275
self.assign(self.actual_capacitance, row[self.PARALLEL_CAPACITANCE])
274276
self.assign(self.actual_derated_capacitance, row[self.PARALLEL_DERATED_CAPACITANCE])
275-
self._make_parallel_footprints(row)
276277

277278
@abstractmethod
278279
def _make_parallel_footprints(self, row: PartsTableRow) -> None:

edg/abstract_parts/AbstractComparator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from typing import Mapping
22

33
from .ResistiveDivider import FeedbackVoltageDivider, VoltageDivider
4+
from ..abstract_parts import Analog
45
from ..electronics_model import *
56

67

7-
class Comparator(KiCadInstantiableBlock, Block):
8+
class Comparator(KiCadInstantiableBlock, Analog):
89
"""Abstract comparator interface, output goes high when inp > inn."""
910
def symbol_pinning(self, symbol_name: str) -> Mapping[str, BasePort]:
1011
assert symbol_name in ('Simulation_SPICE:OPAMP', 'edg_importable:Opamp')

edg/abstract_parts/AbstractFuse.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from typing import Optional, cast
22

3+
from deprecated import deprecated
4+
35
from ..electronics_model import *
46
from .Categories import *
57
from .PartsTable import PartsTableColumn, PartsTableRow
@@ -132,5 +134,6 @@ def _row_generate(self, row: PartsTableRow) -> None:
132134
self.assign(self.actual_voltage_rating, row[self.VOLTAGE_RATING])
133135

134136

137+
@deprecated("Use SeriesPowerFuse and a top-level refinement to specify a PPTC fuse")
135138
class SeriesPowerPptcFuse(SeriesPowerFuse):
136139
FUSE_TYPE = PptcFuse

edg/abstract_parts/AbstractInductor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Dict, Optional, cast
1+
from typing import Dict, Optional, cast, Any
22

33
from ..electronics_model import *
44
from .PartsTable import PartsTableColumn, PartsTableRow, ExperimentalUserFnPartsTable
@@ -143,7 +143,6 @@ def __init__(self, *args, **kwargs) -> None:
143143
self.experimental_filter_fn)
144144

145145
def _row_filter(self, row: PartsTableRow) -> bool:
146-
# TODO eliminate arbitrary DCR limit in favor of exposing max DCR to upper levels
147146
filter_fn_str = self.get(self.experimental_filter_fn)
148147
if filter_fn_str:
149148
filter_fn = ExperimentalUserFnPartsTable.deserialize_fn(filter_fn_str)
@@ -164,6 +163,10 @@ def _row_generate(self, row: PartsTableRow) -> None:
164163
self.assign(self.actual_frequency_rating, row[self.FREQUENCY_RATING])
165164
self.assign(self.actual_resistance_dc, row[self.DC_RESISTANCE])
166165

166+
@classmethod
167+
def _row_sort_by(cls, row: PartsTableRow) -> Any:
168+
return row[cls.DC_RESISTANCE].center()
169+
167170

168171
class SeriesPowerInductor(DiscreteApplication):
169172
"""VoltageSource/Sink-typed series inductor for power filtering"""

edg/abstract_parts/AbstractLedDriver.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from ..abstract_parts import *
2+
from deprecated import deprecated
23

34

45
@abstract_block
@@ -18,6 +19,7 @@ def __init__(self, max_current: RangeLike):
1819
self.max_current = self.ArgParameter(max_current)
1920

2021

22+
@deprecated("ripple should be an internal parameter")
2123
class LedDriverSwitchingConverter(BlockInterfaceMixin[LedDriver]):
2224
"""LED driver mixin indicating that the LED driver is a switching converter and with a peak-peak ripple limit."""
2325
@init_in_parent

edg/abstract_parts/Categories.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ class AnalogFilter(Filter):
3232
pass
3333

3434

35+
@abstract_block
36+
class RfFilter(AnalogFilter):
37+
"""RF signal conditioning subcircuit."""
38+
pass
39+
40+
3541
@abstract_block
3642
class DigitalFilter(Filter):
3743
"""Digital signal conditioning block."""
@@ -238,7 +244,19 @@ class LightSensor(Sensor):
238244

239245

240246
@abstract_block
241-
class Magnetometer(Sensor):
247+
class MagneticSensor(Sensor):
248+
pass
249+
250+
251+
@abstract_block
252+
class MagneticSwitch(MagneticSensor):
253+
"""A switch that is activated by a magnetic field, including omnipolar and bipolar devices."""
254+
pass
255+
256+
257+
@abstract_block
258+
class Magnetometer(MagneticSensor):
259+
"""Linear response magnetic field sensor, potentially with multiple axes"""
242260
pass
243261

244262

edg/abstract_parts/I2cBitBang.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from typing import cast
2+
3+
from ..electronics_model import *
4+
from .Categories import *
5+
6+
7+
class I2cControllerBitBang(BitBangAdapter, Block):
8+
"""Bit-bang adapter for I2C controller"""
9+
def __init__(self) -> None:
10+
super().__init__()
11+
self.i2c = self.Port(I2cController.empty(), [Output])
12+
self.scl = self.Port(DigitalBidir.empty())
13+
self.sda = self.Port(DigitalBidir.empty())
14+
15+
def contents(self) -> None:
16+
super().contents()
17+
self.connect(self.i2c.scl, self.scl)
18+
self.connect(self.i2c.sda, self.sda)
19+
20+
def connected_from(self, scl: Port[DigitalLink], sda: Port[DigitalLink]) -> 'I2cControllerBitBang':
21+
cast(Block, builder.get_enclosing_block()).connect(scl, self.scl)
22+
cast(Block, builder.get_enclosing_block()).connect(sda, self.sda)
23+
return self

edg/abstract_parts/IoController.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .Categories import ProgrammableController
99

1010

11+
@non_library
1112
@abstract_block
1213
class BaseIoController(PinMappable, Block):
1314
"""An abstract IO controller block, that takes power input and provides a grab-bag of common IOs.

0 commit comments

Comments
 (0)