mirror of
https://github.com/diodeinc/pcb.git
synced 2026-09-14 20:17:19 +08:00
1636bc18f7
* 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>
30 lines
890 B
Plaintext
30 lines
890 B
Plaintext
"""
|
|
A reusable LED module with current limiting resistor.
|
|
Configurable LED color and resistor value.
|
|
"""
|
|
|
|
load("@stdlib:v0.2.2/interfaces.zen", "Gpio", "Ground", "Power")
|
|
|
|
Resistor = Module("@stdlib:v0.2.2/generics/Resistor.zen")
|
|
Led = Module("@stdlib:v0.2.2/generics/Led.zen")
|
|
|
|
# Configuration parameters
|
|
led_color = config("led_color", str, default = "red")
|
|
r_value = config("r_value", str, default = "330Ohm")
|
|
package = config("package", str, default = "0603")
|
|
|
|
# IO ports
|
|
VCC = io("VCC", Power)
|
|
GND = io("GND", Ground)
|
|
CTRL = io("CTRL", Gpio) # Control signal to enable/disable LED
|
|
|
|
# Internal nets
|
|
led_anode = Net("LED_ANODE")
|
|
|
|
# Create the LED circuit
|
|
# Current limiting resistor
|
|
Resistor(name = "R1", value = r_value, package = package, P1 = VCC.NET, P2 = led_anode)
|
|
|
|
# LED with configurable color
|
|
Led(name = "D1", color = led_color, package = package, A = led_anode, K = CTRL.NET)
|