Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to support eth-io revision #197

Merged
merged 4 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/bundles/comms.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,6 @@ Microwire is a subset of SPI with slightly
different latching requirements. It often comes
in a 3-wire variant.



@member clk Synchronous clock - Required Port
@member cs Chip Select - Optional Port
@member do Data Output - Optional Port
Expand Down Expand Up @@ -423,7 +421,7 @@ interface.
@member di Data Input

<DOC>
public defn microwire ():
public defn microwire-4 ():
microwire(Microwire-CS, Microwire-DO, Microwire-DI)


Expand Down
2 changes: 1 addition & 1 deletion src/circuits.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ defpackage jsl/circuits:
forward jsl/circuits/CrystalResonator
forward jsl/circuits/Network
forward jsl/circuits/Pullups
forward jsl/circuits/Termination
forward jsl/circuits/utils

33 changes: 28 additions & 5 deletions src/circuits/Pullups.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,19 @@ to `IRQ_N-pu`.
@param qb? Optional Resistor query builder for the selection of the pullup resistor
in the case that `elem-type?` is a `Double`. By default, the global query defaults are
extended with `ResistorQuery(precision = (5 %))`.
@param make-public Determines if the created resistor instance will be defined
with the `public` access modifier or not. By default, the component is defined as
`private`
<DOC>
public defn insert-pullup (sig:JITXObject, rail:JITXObject -- elem-type:Instantiable|Double = 10.0e3, inst-name?:String|Symbol = ?, qb?:ResistorQuery = ?) :
public defn insert-pullup (
sig:JITXObject,
rail:JITXObject
--
elem-type:Instantiable|Double = 10.0e3,
inst-name?:String|Symbol = ?,
qb?:ResistorQuery = ?,
make-public:True|False = false
) -> Instance:
val inst-name = to-string $ value-or(inst-name?, "%_-pu" % [get-ref-name $ ref(sig)])
val qb = value-or(qb?, PULLUP_DEF_QB)

Expand All @@ -93,8 +104,9 @@ public defn insert-pullup (sig:JITXObject, rail:JITXObject -- elem-type:Instanti
(R-v:Double): ; Resistance Value
create-resistor(resistance = R-v, precision = (1 %))

val elem = make-inst(to-symbol(inst-name), et, false)
val elem = make-inst(to-symbol(inst-name), et, make-public)
add-pullup(elem, sig, rail)
elem

doc: \<DOC>
Construct a pulldown instance from an Instantiable
Expand All @@ -116,8 +128,19 @@ to `IRQ_N-pu`.
@param qb? Optional Resistor query builder for the selection of the pullup resistor
in the case that `elem-type?` is a `Double`. By default, the global query defaults are
extended with `ResistorQuery(precision = (5 %))`.
@param make-public Determines if the created resistor instance will be defined
with the `public` access modifier or not. By default, the component is defined as
`private`
<DOC>
public defn insert-pulldown (sig:JITXObject, rail:JITXObject -- elem-type:Instantiable|Double = 10.0e3, inst-name?:String|Symbol = ?, qb?:ResistorQuery = ?) :
public defn insert-pulldown (
sig:JITXObject,
rail:JITXObject
--
elem-type:Instantiable|Double = 10.0e3,
inst-name?:String|Symbol = ?,
qb?:ResistorQuery = ?,
make-public:True|False = false
) -> Instance:
val inst-name = to-string $ value-or(inst-name?, "%_-pd" % [get-ref-name $ ref(sig)])
val qb = value-or(qb?, PULLUP_DEF_QB)

Expand All @@ -127,6 +150,6 @@ public defn insert-pulldown (sig:JITXObject, rail:JITXObject -- elem-type:Instan
(R-v:Double): ; Resistance Value
create-resistor(qb, resistance = R-v)

val elem = make-inst(to-symbol(inst-name), et, false)
val elem = make-inst(to-symbol(inst-name), et, make-public)
add-pulldown(elem, sig, rail)

elem
35 changes: 35 additions & 0 deletions src/circuits/Termination.stanza
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#use-added-syntax(jitx)
defpackage jsl/circuits/Termination:
import core
import jitx
import jitx/parts


doc: \<DOC>
Create a typical shield termination

This type is intended mostly for prototypes where the
exact termination requirements aren't completely known.
We're giving ourselves options for testing.

Default is a simple RC parallel circuit.

@member SHIELD Connected to the shield of a connector, etc.
@member GND Ground plane connection for the termination.

@param R-query Resistor query parameters - default is `ResistorQuery()`.
@param C-query Capacitor query parameters. Default sets a min rated
voltage of 50.0V.
<DOC>
public defn shield-termination (
R-query:ResistorQuery = ResistorQuery(),
C-query:CapacitorQuery = CapacitorQuery(rated-voltage = AtLeast(50.0))
) -> Instantiable:

pcb-module shield-term-t :
port SHIELD
port GND
insert-resistor(SHIELD, GND, R-query, resistance = 0.0, inst-name = "R")
insert-capacitor(SHIELD, GND, C-query, capacitance = 4.7e-9, inst-name = "C")

shield-term-t