Pad Planner¶
Package name: jsl/landpatterns/pad-planner
How & Where to Place Pads
When building complex landpatterns, we are often faced with cases where the package for a particular component does something out of the ordinary. You will often run into this when looking at BGA packages where some subset of the balls in a grid may be depopulated. Sometimes this is pretty straight forward like for a thermally enhanced BGA pattern:
TODO - Figure here showing a thermally enhanced BGA
Other times, it can be more off the beaten path:
TODO - Figure here showing the Dialog chip with offset sub-grid of balls.
Regardless, we need tools to instructs the JITX environment how to place the pads we need for a particular component. This is where the "Pad Planner" comes in.
Pad Planner is a piece of code that tells the land pattern generator:
- Whether or not to place a pad at a particular location.
- The features of the pad to place at a particular location.
In order for the Pad Planner to provide good guidance, we have to have a common understanding between the generator and the planner:
- The pads for a landpattern are generally going to be in a grid of some sort.
- BGA packages have an obvious 2D grid.
- Quad Packages (QFP, QFN, etc) also have a 2D grid but it isn't quite as obvious.
- The Pad Planner makes the assumption that the pads of a component are arranged in a 2D grid with rows and columns.
- A common shape characteristic
- Many landpatterns use Rectangle for the shape of their pads.
- Sometimes we might want to use RoundedRectangle or Capsule.
- The Pad Planner makes the assumption that each pad's geometry will be described by a Dims object. This means that if we want to provide different shapes, we have to shim them into accepting a Dims object.
- Shape Orientation - The Pad Planner doesn't actually care about this but the
shapes generated by it need to align with the package's needs. The Pad Planner
shapes will be aligned with the Dims object. The Package's land pattern generator
is responsible for making sure that the
x
dimension of the shape corresponds with thelead-length
direction, and they
dimension corresponds with thelead-width
direction.
Summary¶
Data Types¶
ShapePadPlanner¶
Pad Planner that always returns a Shape Converter
Constructors¶
Function | Description |
---|---|
ShapePadPlanner | Constructor for defstruct ShapePadPlanner |
Functions¶
Function | Description |
---|---|
RoundedRectanglePadPlanner | |
DShapePadPlanner |
Pin1-PadPlanner¶
Constructors¶
Function | Description |
---|---|
Pin1-PadPlanner | Constructor for defstruct Pin1-PadPlanner |
NoGeneratorForActivePadError¶
Error for MisMatched Active & Generators
Constructors¶
Function | Description |
---|---|
NoGeneratorForActivePadError | Constructor for defstruct NoGeneratorForActivePadError |
Pin1-PthPadPlanner¶
Constructors¶
Function | Description |
---|---|
Pin1-PthPadPlanner | Constructor for defstruct Pin1-PthPadPlanner |
PthPadPlanner¶
Plated Through-Hole Pad Planner
Constructors¶
Function | Description |
---|---|
PthPadPlanner | Constructor for defstruct PthPadPlanner |
Corner-PadPlanner¶
Corner Pin Pad Planner
Constructors¶
Function | Description |
---|---|
Corner-PadPlanner (+ 1) | Constructor for defstruct Corner-PadPlanner |
StaggerPthPlanner¶
Constructors¶
Function | Description |
---|---|
StaggerPthPlanner (+ 1) | Constructor for defstruct StaggerPthPlanner |
StaggerPadPlanner¶
Constructors¶
Function | Description |
---|---|
StaggerPadPlanner (+ 1) | Constructor for defstruct StaggerPadPlanner |
PadPlanner¶
Pad Planner Base Type
Multis¶
Function | Description |
---|---|
th-pad-generator | Through-hole Pad Generator |
is-through-hole? | Is this PadPlanner configured to generate through-hole pads ? |
hole-generator | Hole Shape for Pad |
shape-generator | Retrieve the Shape Generator for this grid position |
active? | Check if this package grid location is active. |
pad-generator | Retrieve the Pad Generator for this grid position |
Methods¶
Function | Description |
---|---|
th-pad-generator | Default Through-Hole Pad Generator |
pad-generator | Default implementation for the pad-generator |
is-through-hole? | Default Implementation |
hole-generator | Default hole-shape - No Holes Created. |
General Definitions¶
Function | Description |
---|---|
to-CircleOrCapsule | Shape generator for Circle/Capsule |
dshape-shaper | |
round-rect-shaper | |
is-omit? | |
chamfered-corner-shaper | Chamfered Corner Shaper |
Variable | Description |
---|---|
rect-shaper | |
RectanglePadPlanner | |
capsule-shaper | |
CapsulePadPlanner |
Definitions¶
ShapePadPlanner¶
Pad Planner that always returns a Shape Converter
public defstruct ShapePadPlanner <: PadPlanner :
shaper: (Dims) -> Shape
shaper: (Dims) -> Shape
This is a default implementation of the PadPlanner interface for swapping a particular shape for all pads in a landpattern.
This is useful for when you don't want to use Rectangle
(the typical default) and you want to replace it with
say RoundedRectangle
.
Constructors¶
ShapePadPlanner¶
Constructor for defstruct ShapePadPlanner
public defn ShapePadPlanner (shaper:(Dims) -> Shape)
Functions¶
RoundedRectanglePadPlanner¶
public defn RoundedRectanglePadPlanner (radius:Double) -> ShapePadPlanner
- Returns
ShapePadPlanner
DShapePadPlanner¶
public defn DShapePadPlanner (radius:Double) -> ShapePadPlanner
- Returns
ShapePadPlanner
Pin1-PadPlanner¶
public defstruct Pin1-PadPlanner <: PadPlanner :
pin1-shaper: (Dims) -> Shape
shaper: (Dims) -> Shape
-
pin1-shaper: (Dims) -> Shape
-
shaper: (Dims) -> Shape
Constructors¶
Pin1-PadPlanner¶
Constructor for defstruct Pin1-PadPlanner
public defn Pin1-PadPlanner (pin1-shaper:(Dims) -> Shape, shaper:(Dims) -> Shape)
NoGeneratorForActivePadError¶
Error for MisMatched Active & Generators
public defstruct NoGeneratorForActivePadError <: Exception :
column: Int
gen-func: String
row: Int
-
column: Int
-
gen-func: String
-
row: Int
If the generator functions return False
for an active
pad grid location - then this exception will be thrown.
Constructors¶
NoGeneratorForActivePadError¶
Constructor for defstruct NoGeneratorForActivePadError
public defn NoGeneratorForActivePadError (row:Int, column:Int, gen-func:String)
Pin1-PthPadPlanner¶
public defstruct Pin1-PthPadPlanner <: PthPadPlanner :
pin1-shaper: (Dims) -> Shape
pin1-shaper: (Dims) -> Shape
- Pin 1 Pad Shaper This function is called forcol=0, row=0
to construct the copper pad shape.
Constructors¶
Pin1-PthPadPlanner¶
Constructor for defstruct Pin1-PthPadPlanner
public defn Pin1-PthPadPlanner (pin1-shaper:(Dims) -> Shape, shaper:(Dims) -> Shape = ?)
PthPadPlanner¶
Plated Through-Hole Pad Planner
public defstruct PthPadPlanner <: ShapePadPlanner :
Basic Pad Planner for PTH pads. This assumes the hole size is the same for all grid locations.
Constructors¶
PthPadPlanner¶
Constructor for defstruct PthPadPlanner
public defn PthPadPlanner (shaper:(Dims) -> Shape = ?)
Corner-PadPlanner¶
Corner Pin Pad Planner
public defstruct Corner-PadPlanner <: PadPlanner :
corner-shaper: (Dims) -> Shape
rows: Int|Tuple<Int>
shaper: (Dims) -> Shape
-
corner-shaper: (Dims) -> Shape
-
rows: Int|Tuple<Int>
-
shaper: (Dims) -> Shape
This pad planner is useful for packages like QFN, QFP, and other quad packages where the pads in the corners need to be customized to prevent overlapping pad geometry.
This pad planner accepts two shapers - one for normal pads and one for the pads in the corner. The corner pad will be used normally in the first row of a column. In the last row of a column - the corner pad will be mirrored about the X axis.
Constructors¶
Corner-PadPlanner¶
Constructor for defstruct Corner-PadPlanner
public defn Corner-PadPlanner (corner-shaper:(Dims) -> Shape, shaper:(Dims) -> Shape, rows:Int|Tuple<Int>)
Corner-PadPlanner¶
Constructor for defstruct Corner-PadPlanner
public defn Corner-PadPlanner ( -- corner-shaper:(Dims) -> Shape, shaper:(Dims) -> Shape, rows:Int|Tuple<Int>)
StaggerPthPlanner¶
public defstruct StaggerPthPlanner <: PthPadPlanner :
phase: StaggerPhase
phase: StaggerPhase
- Set the stagger phase for the planner
Constructors¶
StaggerPthPlanner¶
Constructor for defstruct StaggerPthPlanner
public defn StaggerPthPlanner (shaper:(Dims) -> Shape, phase:StaggerPhase = ?)
StaggerPthPlanner¶
Constructor for defstruct StaggerPthPlanner
public defn StaggerPthPlanner ( -- shaper:(Dims) -> Shape = ?, phase:StaggerPhase = ?)
StaggerPadPlanner¶
public defstruct StaggerPadPlanner <: ShapePadPlanner :
omits: Tuple<[Int, Int]>
phase: StaggerPhase
-
omits: Tuple<[Int, Int]>
- List of [row, col] combinations that will be non-stuffed -
phase: StaggerPhase
- Set the stagger phase for the planner
Constructors¶
StaggerPadPlanner¶
Constructor for defstruct StaggerPadPlanner
public defn StaggerPadPlanner (shaper:(Dims) -> Shape, phase:StaggerPhase, omits:Tuple<[Int, Int]> = ?)
StaggerPadPlanner¶
Constructor for defstruct StaggerPadPlanner
public defn StaggerPadPlanner ( -- shaper:(Dims) -> Shape, phase:StaggerPhase = ?, omits:Tuple<[Int, Int]> = ?)
PadPlanner¶
Pad Planner Base Type
public deftype PadPlanner
This defines the interface for a Pad Planner. The Pad Planner is consulted by the landpattern generator when determining what pads to create and what shape those pads should have.
Multis¶
th-pad-generator¶
Through-hole Pad Generator
public defmulti th-pad-generator (x:PadPlanner, row:Int, column:Int) -> (Dims, Dims) -> Pad|False
x: PadPlanner
- Pad Planner (self)row: Int
- Zero-based Index into the grid of a package's pad positions.column: Int
- Zero-based Index into the grid of a package's pad positions.-
Returns
(Dims, Dims) -> Pad|False
- Pad Generator function with declared signature. This function will accept the following arguments: -
hole:Dims - Size of the plated-through hole (not accounting for plating)
- copper:Dims - Size of the pad annulus for the hole.
This function will return a pcb-pad
definition which uses the
shape provided by shape-generator
and the hole provided by hole-generator
.
This function is an alternate to the pad-generator
function. This
function is used to generate through-hole pads where the pad-generator
is for SMT pads.
is-through-hole?¶
Is this PadPlanner configured to generate through-hole pads ?
public defmulti is-through-hole? (x:PadPlanner) -> True|False
- Returns
True|False
This is a flag that indicates whether this planner is intended
for through-hole or surface mount pad generation. This is a
helper function to make it easier to determine whether the
pad-generator
or th-pad-generator
functions should be
called in a particular application
hole-generator¶
Hole Shape for Pad
public defmulti hole-generator (x:PadPlanner, row:Int, column:Int) -> (Dims) -> Shape|False
x: PadPlanner
- Pad Planner (self)row: Int
- Zero-based Index into the grid of a package's pad positions.column: Int
- Zero-based Index into the grid of a package's pad positions.- Returns
(Dims) -> Shape|False
- This function should return a function that will convert aDims
object into aShape
. That function will need to have the following signature:
Dims -> Shape
This function can return false
for location in the grid where no
hole should be created. If this function returns false
at an
active? = true
grid location - then the related pad generation
functions will raise an exception.
This function provides the user with the ability to create a plated through-hole pad instead of an SMT pad.
In general, this function should not query active?
unless
it needs to. The active?
flag will be queried in the pad-generator
functions when selecting whether to generate pad shapes.
The typical use case is to only return False
if the land pattern
contains zero through-hole pads. If you need to create a land pattern
with a mix of through-hole and surface mount pads - it is better to construct
this land pattern through composition.
If you intend to violate this convention - you must provide a reformed version of is-through-hole? in your derived implementation.
shape-generator¶
Retrieve the Shape Generator for this grid position
public defmulti shape-generator (x:PadPlanner, row:Int, column:Int) -> (Dims) -> Shape|False
x: PadPlanner
- Pad Planner (self)row: Int
- Zero-based Index into the grid of a package's pad positions.column: Int
- Zero-based Index into the grid of a package's pad positions.-
Returns
(Dims) -> Shape|False
- Shape Generator function with declared signature. This function will accept the following arguments: -
Dims - Size of the generated pad
This function will return a Shape
object with those properties. Note that
the shape should have its own internal Pose
object so that this method
could add a custom offset if needed.
In general, this function should not query active?
unless
it needs to. The active?
flag will be queried in the pad-generator
functions when selecting whether to generate pad shapes.
active?¶
Check if this package grid location is active.
public defmulti active? (x:PadPlanner, row:Int, column:Int) -> True|False
x: PadPlanner
- Pad Planner (self)row: Int
- Zero-based Index into the grid of a package's pad positions.column: Int
- Zero-based Index into the grid of a package's pad positions.- Returns
True|False
- Pad Grid location is Active.
In this context, active
means that there should be a copper
pad at this location. inactive
means that no copper pad should be
placed at this location.
pad-generator¶
Retrieve the Pad Generator for this grid position
public defmulti pad-generator (x:PadPlanner, row:Int, column:Int) -> (Dims) -> Pad|False
x: PadPlanner
- Pad Planner (self)row: Int
- Zero-based Index into the grid of a package's pad positions.column: Int
- Zero-based Index into the grid of a package's pad positions.-
Returns
(Dims) -> Pad|False
- Pad Generator function with declared signature. This function will accept the following arguments: -
Dims - Size of the generated pad
This function will return a pcb-pad
definition which uses the
shape provided by shape-generator
.
Methods¶
th-pad-generator¶
Default Through-Hole Pad Generator
defmethod th-pad-generator (x:PadPlanner, row:Int, column:Int) -> (Dims, Dims) -> Pad|False
- Returns
(Dims, Dims) -> Pad|False
- Throws
NoGeneratorForActivePadError
- When an improper configuration of hole and shape generator functions are provided to an active grid location.
The default implementation will generate either plated or non-plated holes
depending on whether the shape-generator
returns true or false.
For non-plated holes - the copper:Dims
argument will be ignored.
If the user tries to use th-pad-generator
when hole-generator
returns false - then this function will raise an error.
pad-generator¶
Default implementation for the pad-generator
defmethod pad-generator (x:PadPlanner, row:Int, column:Int) -> (Dims) -> Pad|False
- Returns
(Dims) -> Pad|False
By default, this function will use the smd-pad generator for creating the pad definition. The default soldermask and pastemask settings will be used.
is-through-hole?¶
Default Implementation
defmethod is-through-hole? (x:PadPlanner) -> True|False
- Returns
True|False
This just checks if hole-generator
returns False or not.
hole-generator¶
Default hole-shape
- No Holes Created.
defmethod hole-generator (x:PadPlanner, row:Int, column:Int) -> (Dims) -> Shape|False
- Returns
(Dims) -> Shape|False
- Alwaysfalse
General Definitions¶
to-CircleOrCapsule¶
Shape generator for Circle/Capsule
public defn to-CircleOrCapsule (d:Dims) -> Shape
- Returns
Shape
For through-holes, the most common shapes are circles and slots. This is a helper function for creating those patterns in the PthPadPlanner
dshape-shaper¶
public defn dshape-shaper (radius:Double) -> (Dims) -> Shape
- Returns
(Dims) -> Shape
round-rect-shaper¶
public defn round-rect-shaper (radius:Double) -> (Dims) -> Shape
- Returns
(Dims) -> Shape
is-omit?¶
public defn is-omit? (omits:Tuple<[Int, Int]>, row:Int, column:Int) -> True|False
- Returns
True|False
chamfered-corner-shaper¶
Chamfered Corner Shaper
public defn chamfered-corner-shaper (radius:Double) -> (Dims) -> Shape
- Returns
(Dims) -> Shape
This function is intended to be used with Corner-PadPlanner to implement the differential corner pads.
rect-shaper¶
public val rect-shaper
RectanglePadPlanner¶
public val RectanglePadPlanner
capsule-shaper¶
public val capsule-shaper
CapsulePadPlanner¶
public val CapsulePadPlanner
Related Packages¶
Forwarded by packages: jsl/landpatterns/framework, jsl/landpatterns