Files
diodeinc__pcb/test-workspaces/with-pcb-toml/modules/LedIndicatorModule.zen
Akhil Velagapudi 1636bc18f7 [DIO-300] Add pcb release command (#69)
* Add pcb release command

Intentially spartan in terms of flags/arguments. All that's needed is
the path to the .zen file.

To test:
cargo run -- release crates/pcb/test-workspace/boards/TestBoard.zen

Implemented:
- Workspace root detection (even without pcb.toml)
- Git-based versioning (e.g. tag > commit hash > dirty commit hash)
- Zen source files copied into release dir (release-dir/src)
- Dependencies are vendored into release dir (release-dir/src/vendor)
- Unmatched bom is generated into release dir (release-dir/bom)
- KiCad layout dir is copied into release dir (release-dir/layout)
- Metadata file is generated into release dir (release-dir/metadata.json)
- Generated artifacts are stored in .pcb/ dir (for now) and not uploaded

TODO:
- Upload the release bundle to API server
- Add a --dry-run to generate release bundle but not upload (similar to
  cargo)
- Use the vendor/ dir for dependency resolution for deterministic builds
- Add pcb vendor subcommand, --offline flag for build/layout
- Add more release artifacts (e.g. gerbers, odb, etc.)

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Fix windows compat

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Add support, test-coverage for workspace-relative loads

Assume that pcb.toml is needed for workspace-relative loads

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Use workspace root .pcb dir for staging releases

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

---------

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-14 18:46:43 -07:00

40 lines
814 B
Plaintext

"""
LED indicator module for status signaling.
Simple module to demonstrate // path usage between modules.
"""
load("@stdlib:v0.2.2/interfaces.zen", "Ground", "Power")
Resistor = Module("@stdlib:v0.2.2/generics/Resistor.zen")
Led = Module("@stdlib:v0.2.2/generics/Led.zen")
# Configuration
led_color = config("led_color", str, default="green")
current_limit_value = config("current_limit_value", str, default="220Ohm")
# IO ports
VCC = io("VCC", Power)
GND = io("GND", Ground)
ENABLE = io("ENABLE", Net)
# Internal nets
led_anode = Net("LED_ANODE")
# Current limiting resistor
Resistor(
name="R_LIMIT",
value=current_limit_value,
package="0402",
P1=VCC.NET,
P2=led_anode,
)
# Status LED
Led(
name="D_STATUS",
color=led_color,
package="0603",
A=led_anode,
K=ENABLE,
)