Enum Statements
pcb-enum
is a way to store categorical variables.
Example
Right now we need to use a fully qualified name to define a new pcb-enum
. So if we wanted an enum named:
Antenna
And we're defining it in a package named
defpackage ocdb/components/espressif/esp32-wroom-32
Then the enum needs to be defined as follows:
public pcb-enum ocdb/components/espressif/esp32-wroom-32/Antenna :
All together this is what it looks like to define and use a
pcb-enum
:
defpackage ocdb/components/espressif/esp32-wroom-32:
...
public pcb-enum ocdb/components/espressif/esp32-wroom-32/Antenna :
Integrated
UMCX
; Using the pcb-enum as a type to define land pattern geometry
pcb-landpattern esp32-wroom (antenna-type:Antenna) :
switch(antenna-type):
Integrated :
package-y = 25.5
offset = (25.5 - 19.2) / 2.0
UMCX :
package-y = 19.2
offset = 0.0
Length of Enum
Get the length of an enum
When you create a new enum, called my-enum
, Stanza (the language JITX uses) creates a new integer which represents the length of that enum, called my-enum-length
.
Just add a -length
to the end of any enum name to get its length.