Files
diodeinc__pcb/examples/HighSideCurrentSense/HighSideCurrentSense.zen
Akhil Velagapudi adfdc228d8 pcb 0.4 breaking changes (#870)
* Migrate stdlib to KiCad 10 symbols + footprints (#701)

* Bump stdlib KiCad asset pin to 10.0.0

* Update crystal generic for KiCad 10 pin names

* Update snapshots

* Delete deprecated stdlib (#703)

* Delete deprecated stdlib files

* Fix tests

* Remove deprecated generic stdlib modules

* Remove deprecated standoff and terminal block generics

* Remove deprecated stdlib helpers and API shims

* Remove physical value range deprecation hook

* Drop legacy stdlib load path

* Remove V1 manifest migration support

* Remove legacy net moved directives

* Remove legacy manifest assets support

* Bump KiCad 10 assets to 10.0.3

* Error on legacy Component properties

* Remove legacy module property API

* Drop old toolchain compatibility shims

* Strict 0.4 net naming (#849)

* Enforce strict regular net naming

* Treat NotConnected nets as source-unnamed

* Update unreleased changelog for 0.4 changes

* Clean up 0.4 docs

* fix: pcb fmt

* Fix CI for KiCad 10 symbols and examples

* Fix symbol library fallback and NetTie defaults

* Use versioned KiCad parts index URL

* Include stdlib assets in frozen dependency materialization

* fix: bump W25Q128JVE dep

* Bundle KiCad split symbols granularly

* Remove flash module from workspace test board

* Update publish snapshots

* chore: bump @stdlib dependencies

* Fix Crystal compatibility for KiCad 9 symbols
2026-06-09 17:22:27 -04:00

54 lines
1.5 KiB
Python

"""
Type: High Side Current Sensor
Description: High side current sensor using INA240A with 2mohm shunt resistor, 20x V/V gain. 80Vin Max
"""
load("@stdlib/interfaces.zen", "Analog")
load("@stdlib/units.zen", "Resistance")
Resistor = Module("@stdlib/generics/Resistor.zen")
NetTie = Module("@stdlib/generics/NetTie.zen")
INA240A = Module("../INA240A/INA240A.zen")
shunt_value = config(str, default="2mohm 1%", optional=True)
shunt_package = config(str, default="2512", optional=True)
ina_gain = config(str, default="A1", optional=True)
ina_package = config(str, default="TSSOP", optional=True)
ref_config = config(str, default="GROUND")
POWER_BUS_IN = io(Power) # Input power bus
POWER_BUS_OUT = io(Power) # Output power bus
POWER_3V3 = io(Power(voltage="3.3V")) # Digital power supply
ISENSE_OUT = io(Analog) # Current sense output
GND = io(Ground) # Ground reference
_IN_P = Analog()
_IN_N = Analog()
# Create net tie modules for power connections
NetTie(name="isense_shunt_high", P1=POWER_BUS_IN, P2=_IN_P)
NetTie(name="isense_shunt_low", P1=POWER_BUS_OUT, P2=_IN_N)
# Shunt resistor
Resistor(
name="r_shunt",
value=shunt_value,
package=shunt_package,
P1=POWER_BUS_IN,
P2=POWER_BUS_OUT,
)
# INA240 current sense inalifier
INA240A(
name="ina240",
ref_config=ref_config,
package=ina_package,
gain=ina_gain,
implementation_type="WITH_PASSIVES",
POWER=POWER_3V3,
GND=GND,
IN_P=_IN_P,
IN_N=_IN_N,
OUT=ISENSE_OUT,
)