Choc footprint fix, status led, generic PCB outlines
This commit is contained in:
parent
f71368b835
commit
852ebbcf95
6 changed files with 76 additions and 27 deletions
|
@ -17,8 +17,8 @@ module.exports = {
|
|||
(fp_line (start 7 -7) (end 7 -6) (layer F.SilkS) (width 0.15))
|
||||
|
||||
${''/* pins */}
|
||||
(pad 1 thru_hole circle (at 0 -5.9) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net_from})
|
||||
(pad 2 thru_hole circle (at -5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net_to})
|
||||
(pad 1 thru_hole circle (at 5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net_from})
|
||||
(pad 2 thru_hole circle (at 0 -5.9) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net_to})
|
||||
|
||||
${''/* middle shaft */}
|
||||
(pad "" np_thru_hole circle (at 0 0) (size 3.429 3.429) (drill 3.429) (layers *.Cu *.Mask))
|
||||
|
|
|
@ -4,5 +4,6 @@ module.exports = {
|
|||
choc: require('./choc'),
|
||||
diode: require('./diode'),
|
||||
promicro: require('./promicro'),
|
||||
rgb: require('./rgb'),
|
||||
pad: require('./pad')
|
||||
}
|
38
src/footprints/rgb.js
Normal file
38
src/footprints/rgb.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
module.exports = {
|
||||
static_nets: ['VCC', 'GND'],
|
||||
nets: ['din', 'dout'],
|
||||
params: {
|
||||
side: 'F'
|
||||
},
|
||||
body: p => `
|
||||
|
||||
(module WS2812B (layer F.Cu) (tedit 53BEE615)
|
||||
|
||||
${p.at /* parametric position */}
|
||||
|
||||
(fp_line (start -1.75 -1.75) (end -1.75 1.75) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||
(fp_line (start -1.75 1.75) (end 1.75 1.75) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||
(fp_line (start 1.75 1.75) (end 1.75 -1.75) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||
(fp_line (start 1.75 -1.75) (end -1.75 -1.75) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||
|
||||
(fp_line (start -2.5 -2.5) (end -2.5 2.5) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||
(fp_line (start -2.5 2.5) (end 2.5 2.5) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||
(fp_line (start 2.5 2.5) (end 2.5 -2.5) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||
(fp_line (start 2.5 -2.5) (end -2.5 -2.5) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||
|
||||
(fp_poly (pts (xy 4 2.2) (xy 4 0.375) (xy 5 1.2875)) (layer ${p.param_side}.SilkS) (width 0.1))
|
||||
|
||||
(pad 1 smd rect (at -2.2 -0.875 ${p.rot}) (size 2.6 1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_VCC})
|
||||
(pad 2 smd rect (at -2.2 0.875 ${p.rot}) (size 2.6 1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_dout})
|
||||
(pad 3 smd rect (at 2.2 0.875 ${p.rot}) (size 2.6 1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_GND})
|
||||
(pad 4 smd rect (at 2.2 -0.875 ${p.rot}) (size 2.6 1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_din})
|
||||
|
||||
(pad 11 smd rect (at -2.5 -1.6 ${p.rot}) (size 2 1.2) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_VCC})
|
||||
(pad 22 smd rect (at -2.5 1.6 ${p.rot}) (size 2 1.2) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_dout})
|
||||
(pad 33 smd rect (at 2.5 1.6 ${p.rot}) (size 2 1.2) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_GND})
|
||||
(pad 44 smd rect (at 2.5 -1.6 ${p.rot}) (size 2 1.2) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_din})
|
||||
|
||||
)
|
||||
|
||||
`
|
||||
}
|
|
@ -237,13 +237,14 @@ exports.parse = (config = {}, points = {}) => {
|
|||
const bevel = a.sane(part.bevel || 0, `${name}.bevel`, 'number')
|
||||
const rect_mirror = a.sane(part.mirror || false, `${name}.mirror`, 'boolean')
|
||||
const rect = rectangle(size[0], size[1], corner, bevel, name)
|
||||
arg = anchor.position(rect)
|
||||
arg = anchor.position(u.deepcopy(rect))
|
||||
if (rect_mirror) {
|
||||
const mirror_part = u.deepcopy(part)
|
||||
a.assert(mirror_part.ref, `Field "${name}.ref" must be speficied if mirroring is required!`)
|
||||
mirror_part.ref = `mirror_${mirror_part.ref}`
|
||||
anchor = a.anchor(mirror_part, name, points, false)
|
||||
arg = u.stack(arg, anchor.position(rect))
|
||||
const mirror_rect = m.model.moveRelative(u.deepcopy(rect), [-size[0], 0])
|
||||
arg = u.union(arg, anchor.position(mirror_rect))
|
||||
}
|
||||
break
|
||||
case 'circle':
|
||||
|
@ -257,7 +258,7 @@ exports.parse = (config = {}, points = {}) => {
|
|||
a.assert(mirror_part.ref, `Field "${name}.ref" must be speficied if mirroring is required!`)
|
||||
mirror_part.ref = `mirror_${mirror_part.ref}`
|
||||
anchor = a.anchor(mirror_part, name, points, false)
|
||||
arg = u.stack(arg, u.circle(anchor.p, radius))
|
||||
arg = u.union(arg, u.circle(anchor.p, radius))
|
||||
}
|
||||
break
|
||||
case 'polygon':
|
||||
|
|
17
src/pcbs.js
17
src/pcbs.js
|
@ -206,12 +206,16 @@ exports.parse = (config, points, outlines) => {
|
|||
for (const [pcb_name, pcb_config] of Object.entries(pcbs)) {
|
||||
|
||||
// config sanitization
|
||||
a.detect_unexpected(pcb_config, `pcb.${pcb_name}`, ['edge', 'footprints'])
|
||||
const edge = outlines[pcb_config.edge]
|
||||
if (!edge) throw new Error(`Field "pcb.${pcb_name}.edge" doesn't name a valid outline!`)
|
||||
a.detect_unexpected(pcb_config, `pcb.${pcb_name}`, ['outlines', 'footprints'])
|
||||
|
||||
// Edge.Cuts conversion
|
||||
const kicad_edge = makerjs2kicad(edge)
|
||||
// outline conversion
|
||||
const config_outlines = a.sane(pcb_config.outlines, `pcb.${pcb_name}.outlines`, 'object')
|
||||
const kicad_outlines = {}
|
||||
for (const [outline_name, outline] of Object.entries(config_outlines)) {
|
||||
const ref = a.in(outline.outline, `pcb.${pcb_name}.outlines.${outline_name}.outline`, Object.keys(outlines))
|
||||
const layer = a.sane(outline.layer || 'Edge.Cuts', `pcb.${pcb_name}.outlines.${outline_name}.outline`, 'string')
|
||||
kicad_outlines[outline_name] = makerjs2kicad(outlines[ref], layer)
|
||||
}
|
||||
|
||||
// making a global net index registry
|
||||
const nets = {"": 0}
|
||||
|
@ -247,12 +251,13 @@ exports.parse = (config, points, outlines) => {
|
|||
const netclass = kicad_netclass.replace('__ADD_NET', add_nets_arr.join('\n'))
|
||||
const nets_text = nets_arr.join('\n')
|
||||
const footprint_text = footprints.join('\n')
|
||||
const outline_text = Object.values(kicad_outlines).join('\n')
|
||||
results[pcb_name] = `
|
||||
${kicad_prefix}
|
||||
${nets_text}
|
||||
${netclass}
|
||||
${footprint_text}
|
||||
${kicad_edge}
|
||||
${outline_text}
|
||||
${kicad_suffix}
|
||||
`
|
||||
}
|
||||
|
|
36
test/fixtures/absolem.yaml
vendored
36
test/fixtures/absolem.yaml
vendored
|
@ -559,7 +559,7 @@ outlines:
|
|||
glue: uniform_s19
|
||||
size: 14
|
||||
bound: false
|
||||
classic_s19_middle:
|
||||
pcb_middle:
|
||||
raw:
|
||||
type: keys
|
||||
side: middle
|
||||
|
@ -573,32 +573,26 @@ outlines:
|
|||
size: [25, 5]
|
||||
ref: thumbfan_home_thumb
|
||||
shift: [0, 12]
|
||||
mirror: true
|
||||
helper2:
|
||||
type: rectangle
|
||||
size: [25, 5]
|
||||
ref: thumbfan_far_thumb
|
||||
shift: [-25, 12]
|
||||
helper3:
|
||||
type: rectangle
|
||||
size: [25, 5]
|
||||
ref: mirror_thumbfan_home_thumb
|
||||
shift: [25, 12]
|
||||
helper4:
|
||||
type: rectangle
|
||||
size: [25, 5]
|
||||
ref: mirror_thumbfan_far_thumb
|
||||
shift: [0, 12]
|
||||
mirror: true
|
||||
outer_bounds:
|
||||
type: outline
|
||||
name: classic_s19_outline
|
||||
operation: intersect
|
||||
mounting_holes:
|
||||
type: outline
|
||||
name: mounting_holes
|
||||
operation: stack
|
||||
pcbs:
|
||||
main:
|
||||
edge: intersected_outline
|
||||
outlines:
|
||||
edge:
|
||||
outline: intersected_outline
|
||||
layer: Edge.Cuts
|
||||
middle:
|
||||
outline: pcb_middle
|
||||
layer: F.SilkS
|
||||
footprints:
|
||||
mcu:
|
||||
type: promicro
|
||||
|
@ -634,3 +628,13 @@ pcbs:
|
|||
width: 3
|
||||
height: 3
|
||||
front: false
|
||||
led:
|
||||
type: rgb
|
||||
anchor:
|
||||
ref:
|
||||
- matrix_inner_bottom
|
||||
- mirror_matrix_inner_bottom
|
||||
shift: [0, -48]
|
||||
nets:
|
||||
din: 'P9'
|
||||
dout: ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue