Overhaul footprint (header, params, name)

This commit is contained in:
Marco Massarelli 2024-01-28 18:49:43 +00:00
parent 031bd20b89
commit c90e9d77be
3 changed files with 82 additions and 42 deletions

View File

@ -758,11 +758,12 @@ pcbs:
shift: [0.5 ks + 10.147, 0.375 kp -38.696]
reset_switch:
what: reset_switch
what: reset_switch_tht_top
where: matrix_inner_top
params:
from: GND
to: RST
reversible: true
adjust:
shift: [0.5 ks + 17.817, 0.375 kp -40.251]
rotate: 90

View File

@ -1,41 +0,0 @@
module.exports = {
params: {
designator: 'B', // for Button
side: 'F',
from: undefined,
to: undefined
},
body: p => `
(module ceoloide:top-actuated-reset-switch (layer F.Cu) (tedit 5B9559E6) (tstamp 61905781)
(descr "A two pin, top actuated, through-hole Tactile Switch, the same as on the Corne (PTS636 SP43 LFS)")
(tags "Tactile Switch")
${p.at /* parametric position */}
${'' /* footprint reference */}
(fp_text reference "${p.ref}" (at 0 2.55 90) (layer F.SilkS) ${p.ref_hide} (effects (font (size 1 1) (thickness 0.153))))
(fp_text value "Reset (PTS636 SP43 LFS)" (at 0 -2.55 90) (layer F.Fab) (effects (font (size 1 1) (thickness 0.153))))
${'' /* outline */}
(fp_text user "RST" (at 0 0 ${p.rot}) (layer F.SilkS) (effects (font (size 1 1) (thickness 0.153))))
(fp_text user "RST" (at 0 0 ${p.rot}) (layer B.SilkS) (effects (font (size 1 1) (thickness 0.153)) (justify mirror)))
(fp_line (start 3 1.5) (end 3 1.75) (layer B.SilkS) (width 0.15))
(fp_line (start 3 1.75) (end -3 1.75) (layer B.SilkS) (width 0.15))
(fp_line (start -3 1.75) (end -3 1.5) (layer B.SilkS) (width 0.15))
(fp_line (start -3 -1.5) (end -3 -1.75) (layer B.SilkS) (width 0.15))
(fp_line (start -3 -1.75) (end 3 -1.75) (layer B.SilkS) (width 0.15))
(fp_line (start 3 -1.75) (end 3 -1.5) (layer B.SilkS) (width 0.15))
(fp_line (start -3 1.75) (end 3 1.75) (layer F.SilkS) (width 0.15))
(fp_line (start 3 1.75) (end 3 1.5) (layer F.SilkS) (width 0.15))
(fp_line (start -3 1.75) (end -3 1.5) (layer F.SilkS) (width 0.15))
(fp_line (start -3 -1.75) (end -3 -1.5) (layer F.SilkS) (width 0.15))
(fp_line (start -3 -1.75) (end 3 -1.75) (layer F.SilkS) (width 0.15))
(fp_line (start 3 -1.75) (end 3 -1.5) (layer F.SilkS) (width 0.15))
${'' /* pins */}
(pad 2 thru_hole circle (at -3.25 0 ${p.rot}) (size 2 2) (drill 1.3) (layers *.Cu *.Mask) ${p.from.str})
(pad 1 thru_hole circle (at 3.25 0 ${p.rot}) (size 2 2) (drill 1.3) (layers *.Cu *.Mask) ${p.to.str})
)
`
}

View File

@ -0,0 +1,80 @@
// Copyright (c) 2023 Marco Massarelli
//
// SPDX-License-Identifier: MIT
//
// To view a copy of this license, visit https://opensource.org/license/mit/
//
// Author: @ceoloide
//
// Description:
// A through-hole top-actuated momentary switch, the same used by the Corne keyboard and
// compatible with "PTS636 S[L|M]43 LFS" tactile switches sold on LCSC.
//
// Datasheet:
// https://datasheet.lcsc.com/lcsc/2110271930_C-K-PTS636SM43LFS_C2689636.pdf
//
// Params:
// side: default is F for Front
// the side on which to place the single-side footprint and designator, either F or B
// reversible: default is false
// if true, it will include silkscreen on both Front and Back, if silkscreen is included.
// because the footprint is through-hole and because it's only connecting RST to GND, the
// pads are reversible in any case.
// include_silkscreen: default is true
// if true it will include silkscreen markings
module.exports = {
params: {
designator: 'RST', // for Button
side: 'F',
reversible: false,
include_silkscreen: true,
from: undefined,
to: undefined
},
body: p => {
const common_start = `
(module "ceoloide/reset_switch_tht_top" (layer ${p.side}.Cu) (tedit 5B9559E6) (tstamp 61905781)
${p.at /* parametric position */}
(fp_text value "reset_switch_tht_top" (at 0 -2.55 90) (layer ${p.side}.Fab) (effects (font (size 1 1) (thickness 0.15))))
(fp_text reference "${p.ref}" (at 0 2.55 90) (layer ${p.side}.SilkS) ${p.ref_hide} (effects (font (size 1 1) (thickness 0.15))))
`
const silkscreen_front = `
(fp_text user "RST" (at 0 0 ${p.rot}) (layer F.SilkS) (effects (font (size 1 1) (thickness 0.15))))
(fp_line (start -3 1.75) (end 3 1.75) (layer F.SilkS) (width 0.15))
(fp_line (start 3 1.75) (end 3 1.5) (layer F.SilkS) (width 0.15))
(fp_line (start -3 1.75) (end -3 1.5) (layer F.SilkS) (width 0.15))
(fp_line (start -3 -1.75) (end -3 -1.5) (layer F.SilkS) (width 0.15))
(fp_line (start -3 -1.75) (end 3 -1.75) (layer F.SilkS) (width 0.15))
(fp_line (start 3 -1.75) (end 3 -1.5) (layer F.SilkS) (width 0.15))
`
const silkscreen_back = `
(fp_text user "RST" (at 0 0 ${p.rot}) (layer B.SilkS) (effects (font (size 1 1) (thickness 0.15)) (justify mirror)))
(fp_line (start 3 1.5) (end 3 1.75) (layer B.SilkS) (width 0.15))
(fp_line (start 3 1.75) (end -3 1.75) (layer B.SilkS) (width 0.15))
(fp_line (start -3 1.75) (end -3 1.5) (layer B.SilkS) (width 0.15))
(fp_line (start -3 -1.5) (end -3 -1.75) (layer B.SilkS) (width 0.15))
(fp_line (start -3 -1.75) (end 3 -1.75) (layer B.SilkS) (width 0.15))
(fp_line (start 3 -1.75) (end 3 -1.5) (layer B.SilkS) (width 0.15))
`
const common_end = `
(pad 2 thru_hole circle (at -3.25 0 ${p.rot}) (size 2 2) (drill 1.3) (layers *.Cu *.Mask) ${p.from.str})
(pad 1 thru_hole circle (at 3.25 0 ${p.rot}) (size 2 2) (drill 1.3) (layers *.Cu *.Mask) ${p.to.str})
)
`
let final = common_start;
if(p.side == "F" || p.reversible) {
if(p.include_silkscreen){
final += silkscreen_front
}
}
if(p.side == "B" || p.reversible) {
if(p.include_silkscreen){
final += silkscreen_back
}
}
final += common_end;
return final;
}
}