IoT fan + led driver combo, new parts, I2C controller bridge#518
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the PolymorphicBlocks hardware DSL/compiler and example set: it refactors the IoT fan example into a fan + (12V-capable) LED driver combo with a two-level “control subboard” concept, removes the redundant IoT knob example, and extends the core HDL/compiler and parts library (notably I2C nesting/bridging, array concatenation expressions, and a new VL53L5CX distance array sensor).
Changes:
- Refactor
IotFaninto a multi-board design with USB-C PD option, added sensing, and updated netlist/layout artifacts; removeIotKnobexample + generated layout files. - Extend I2C modeling: optional pullup resistance, controller “nested address propagation” via a controller bridge, and additional compile-time checks + tests.
- Extend compiler/proto: add
SHRINK_SUBrange op and implement array concatenation viaADD, with updated evaluation/stringification and regenerated protobuf bindings.
Reviewed changes
Copilot reviewed 26 out of 30 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| proto/edgir/expr.proto | Adds SHRINK_SUB opcode to the expression proto. |
| edg/hdl_server/main.py | Bumps EDG proto version to match regenerated protobufs. |
| edg/electronics_interfaces/test_i2c_link.py | Adds tests for nested I2C controller address propagation and redundant pullup detection. |
| edg/electronics_interfaces/I2cPort.py | Adds controller bridge + controller addresses and tightens I2C pullup rules. |
| edg/edgir/expr_pb2.pyi | Regenerated typing stubs to include the new proto opcode. |
| edg/edgir/expr_pb2.py | Regenerated protobuf Python bindings to include the new proto opcode. |
| edg/core/ArrayExpr.py | Adds concat() helper for array concatenation backed by ADD. |
| edg/circuits/I2cPullup.py | Makes I2C pullup resistance configurable. |
| edg/circuits/I2cBitBang.py | Updates I2C controller port construction to the new I2cController initializer pattern. |
| compiler/src/test/scala/edg/compiler/ExprEvaluateTest.scala | Adds tests for SHRINK_SUB and for array concatenation via ADD. |
| compiler/src/main/scala/edg/compiler/ExprToString.scala | Adds stringification for SHRINK_SUB. |
| compiler/src/main/scala/edg/compiler/ExprEvaluate.scala | Implements array concatenation for ADD and SHRINK_SUB evaluation. |
| compiler/src/main/scala/edg/compiler/Compiler.scala | Bumps expected proto version to match the updated schema. |
| examples/test_iot_knob.py | Removes the IoT knob example test. |
| examples/test_iot_fan.py | Refactors IoT fan into a two-level design and adds USB-C PD + sensors + NeoPixel/fan control changes. |
| examples/IotKnob/resources/svgpcb-ledring.js | Removes knob SVGPCB resource as part of knob example removal. |
| examples/IotKnob/IotKnob.svgpcb.js | Removes generated knob SVGPCB layout artifact. |
| examples/IotKnob/IotKnob.kicad_pro | Removes knob KiCad project file. |
| examples/IotKnob/fp-lib-table | Removes knob footprint library table file. |
| examples/IotFan/IotFan.svgpcb.js | Updates generated SVGPCB layout artifact for the refactored IoT fan design. |
| examples/IotFan/IotFan_control.net.ref | Adds/updates reference netlist for the new “control” sub-board netlist output. |
| examples/edg.pretty/ST_VL53L5x.kicad_mod | Adds a KiCad footprint for the VL53L5x family package. |
| edg/parts/sensor/DistanceArray_Vl53l5cx.py | Adds a new VL53L5CX distance array sensor part (with decoupling + pulls). |
| edg/parts/sensor/init.py | Re-exports the new Vl53l5cx part. |
| edg/parts/logic/Logic_74Ahct.py | Adds OE support to 74AHCT1G125 and exposes optional enable on the wrapper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) | ||
| ) | ||
|
|
||
| self.scl_bridge = self.Block(DigitalBidirBridge()) |
| self.gnd = self.Export(self.ic.gnd, [Common]) | ||
| self.input = self.Export(self.ic.a, [Input]) | ||
| self.output = self.Export(self.ic.y, [Output]) | ||
| self.output_enable = self.Port(DigitalSink.empty(), optional=True) |
| (layers "F.Cu" "F.Paste" "F.Mask") | ||
| (uuid "dda41fc5-48a6-467c-82d3-916ae06f9b43") | ||
| ) | ||
| (model "${KICAD8_3DMODEL_DIR}/OptoDevice.3dshapes/ST_VL53L0X.wrl" |
| Exposed pad must be thermally connected to GND. | ||
|
|
||
| According to the datasheet, I2C pins require a 2.2k pullup to IOVDD, and int requires a 47k pullup to IOVDD. | ||
| The int pullup is auto-generated if not connected..""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactors the IoT fan driver example to be a combination fan driver / 12v-capable neopixel driver. Changes it to a two-level board, adds sensors and the choice of USB PD input. Layout to be completed as a separate PR, which may also require changing the pinning and circuit split between levels.
Removes IoT knob example, which is now redundant.
Component library changes:
Core / compiler changes: