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

Updated insert-pullup/pulldown to use the default query objects #229

Merged
merged 1 commit into from
Dec 16, 2024
Merged
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
19 changes: 8 additions & 11 deletions src/circuits/Pullups.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public defn add-pulldown (elem:JITXObject, sig:JITXObject, rail:JITXObject) :
inside pcb-module:
add-puller(elem, sig, rail, false)

val PULLUP_DEF_QB = ResistorQuery(precision = (5 %))

doc: \<DOC>
Construct a pullup instance from an Instantiable
Expand All @@ -89,9 +88,9 @@ will create a 10k resistor for the pullup.
@param inst-name? Name of the created instance. If no name is provided, we will
use the Ref of the `sig` argument. For example, `netsw.C.IRQ_N` will be converted
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 qb Optional Resistor query builder for the selection of the pullup resistor
in the case that `elem-type?` is a `Double`. By default, `get-default-resistor-query()`
is consulted if the user doesn't provide a query builder.
@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`
Expand All @@ -102,11 +101,10 @@ public defn insert-pullup (
--
elem-type:Instantiable|Double = 10.0e3,
inst-name?:String|Symbol = ?,
qb?:ResistorQuery = ?,
qb:ResistorQuery = get-default-resistor-query(),
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)

inside pcb-module:
val et = match(elem-type):
Expand Down Expand Up @@ -135,9 +133,9 @@ default.
@param inst-name? Optional name of the created instance. If no name is provided, we will
use the Ref name of the `sig` argument. For example, `netsw.C.IRQ_N` will be converted
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 qb Optional Resistor query builder for the selection of the pullup resistor
in the case that `elem-type?` is a `Double`. By default, `get-default-resistor-query()`
is consulted if the user doesn't provide a query builder.
@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`
Expand All @@ -148,11 +146,10 @@ public defn insert-pulldown (
--
elem-type:Instantiable|Double = 10.0e3,
inst-name?:String|Symbol = ?,
qb?:ResistorQuery = ?,
qb:ResistorQuery = get-default-resistor-query(),
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)

inside pcb-module:
val et = match(elem-type):
Expand Down
Loading