Skip to content

IoT fan + led driver combo, new parts, I2C controller bridge#518

Merged
ducky64 merged 20 commits into
masterfrom
iot-controller
Jun 7, 2026
Merged

IoT fan + led driver combo, new parts, I2C controller bridge#518
ducky64 merged 20 commits into
masterfrom
iot-controller

Conversation

@ducky64

@ducky64 ducky64 commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

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:

  • Add optional resistance to I2cPullup
  • Add I2cController bridge, allow I2cController to have addresses (mostly to encode inner devices), with tests
  • Add OE pin to 74xx1g125
  • Add VL53L5CX

Core / compiler changes:

  • Add array concatenation operation to compiler, using addition op
  • Add tolerance-shrinking subtract to compiler, though not plumbed through to frontend yet
  • Regenerate proto

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 IotFan into a multi-board design with USB-C PD option, added sensing, and updated netlist/layout artifacts; remove IotKnob example + 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_SUB range op and implement array concatenation via ADD, 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.

Comment thread edg/electronics_interfaces/I2cPort.py Outdated
)
)

self.scl_bridge = self.Block(DigitalBidirBridge())
Comment thread edg/parts/logic/Logic_74Ahct.py Outdated
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.."""
@ducky64 ducky64 merged commit 6356d57 into master Jun 7, 2026
12 checks passed
@ducky64 ducky64 deleted the iot-controller branch June 7, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants