Skip to content

Commit 673d432

Browse files
authored
Cleanup from iot devices panel (#418)
Miscellaneous cleanup - Fix AH1806 pinning - Remove ADC2 from ESP32C3 (can't be used with WiFi), repin examples to use other pins - Change inheritance ordering of parts tables parts to base class (eg TableInductor) last, logic being that is the most general and the parts table generic logic (eg, JlcParts) is more specific and should handle delegating of things like filtering. - This requires a change in the capacitor structure for parallel capacitor generation, which must be handled at the top level since it's not generating a part and needs to skip footprint generation which is sandwiched between the top-level and capacitor table. Least worst solution for something that's fundamentally abstraction breaking. - Deprecate SeriesPowerPptcFuse, use SeriesPowerFuse + refinement - Deprecate LedDriverSwitchingConverter, setting the ripple as a spec doesn't really make sense, it should be internal. - Can't refactor Al8861 to use the new buck converter architecture since its design guide is weird. - Fix library viewer tree via categorizations and non_library annotations Resolves #415
1 parent 0354529 commit 673d432

Some content is hidden

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

52 files changed

+104
-88
lines changed

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,9 +1,10 @@
11
from typing import Mapping
22

3+
from ..abstract_parts import Analog
34
from ..electronics_model import *
45

56

6-
class Comparator(KiCadInstantiableBlock, Block):
7+
class Comparator(KiCadInstantiableBlock, Analog):
78
"""Abstract comparator interface, output goes high when inp > inn."""
89
def symbol_pinning(self, symbol_name: str) -> Mapping[str, BasePort]:
910
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/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: 6 additions & 0 deletions
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."""

edg/abstract_parts/I2cBitBang.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@
66

77
class I2cControllerBitBang(BitBangAdapter, Block):
88
"""Bit-bang adapter for I2C controller"""
9-
@staticmethod
10-
def digital_external_from_link(link_port: DigitalBidir) -> DigitalBidir:
11-
"""Creates a DigitalBidir model that is the external-facing port that exports from
12-
an internal-facing (link-side) port. The internal-facing port should be ideal.
13-
These are basically the semantics of a DigitalBidir bridge.
14-
TODO: unify code w/ DigitalBidir bridge?"""
15-
return DigitalBidir(
16-
voltage_out=link_port.link().voltage, current_draw=link_port.link().current_drawn,
17-
voltage_limits=link_port.link().voltage_limits, current_limits=link_port.link().current_limits,
18-
output_thresholds=link_port.link().output_thresholds, input_thresholds=link_port.link().input_thresholds,
19-
pulldown_capable=link_port.link().pulldown_capable, pullup_capable=link_port.link().pullup_capable
20-
)
21-
229
def __init__(self) -> None:
2310
super().__init__()
2411
self.i2c = self.Port(I2cController.empty(), [Output])

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.

edg/abstract_parts/RfNetworks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _calculate_values(cls, freq: float, z1: complex, z2: complex) -> Tuple[float
5656
PiLowPassFilter._reactance_to_capacitance(freq, xp)
5757

5858

59-
class LLowPassFilterWith2HNotch(AnalogFilter, GeneratorBlock):
59+
class LLowPassFilterWith2HNotch(GeneratorBlock, RfFilter):
6060
"""L filter for impedance matching for RF with an overlaid second-harmonic LC notch filter.
6161
The target reactance is given by the L filter.
6262
Then, the L and C values are from the simultaneous solution of:
@@ -143,7 +143,7 @@ def _calculate_values(cls, freq: float, z1: complex, z2: complex) -> Tuple[float
143143
PiLowPassFilter._reactance_to_capacitance(freq, net_xs - xs2)
144144

145145

146-
class PiLowPassFilter(AnalogFilter, GeneratorBlock):
146+
class PiLowPassFilter(GeneratorBlock, RfFilter):
147147
"""Passive-typed pi impedance matching network.
148148
Based on equations from https://www.silabs.com/documents/public/application-notes/an1275-imp-match-for-network-arch.pdf
149149
and also referencing https://www.electronicdesign.com/technologies/communications/article/21801154/back-to-basics-impedance-matching-part-3

edg/abstract_parts/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from .Categories import DiscreteComponent, DiscreteSemiconductor, PassiveComponent
1010
from .Categories import DiscreteApplication
1111
from .Categories import Analog, OpampApplication
12-
from .Categories import Filter, AnalogFilter, DigitalFilter
12+
from .Categories import Filter, AnalogFilter, RfFilter, DigitalFilter
1313
from .Categories import Microcontroller, Fpga, Memory, RealtimeClock, Radiofrequency
1414
from .Categories import Interface, AnalogToDigital, DigitalToAnalog, SpeakerDriver, IoExpander, BitBangAdapter
1515
from .Categories import PowerConditioner, PowerSwitch, MotorDriver, BrushedMotorDriver, BldcDriver

edg/electronics_model/CircuitBlock.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def footprint(self, refdes: StringLike, footprint: StringLike, pinning: Mapping[
9191
self.assign(self.fp_datasheet, '')
9292

9393

94+
@non_library
9495
class WrapperFootprintBlock(FootprintBlock):
9596
"""Block that has a footprint and optional internal contents, but the netlister ignores internal components.
9697
Useful for, for example, a breakout board where the modelling details are provided by internal chip blocks,

0 commit comments

Comments
 (0)