From c90e9d77bef6e81e1603f617c077f00470f01e8a Mon Sep 17 00:00:00 2001 From: Marco Massarelli Date: Sun, 28 Jan 2024 18:49:43 +0000 Subject: [PATCH] Overhaul footprint (header, params, name) --- ergogen/config.yaml | 3 +- ergogen/footprints/reset_switch.js | 41 ----------- ergogen/footprints/reset_switch_tht_top.js | 80 ++++++++++++++++++++++ 3 files changed, 82 insertions(+), 42 deletions(-) delete mode 100644 ergogen/footprints/reset_switch.js create mode 100644 ergogen/footprints/reset_switch_tht_top.js diff --git a/ergogen/config.yaml b/ergogen/config.yaml index aa4eb60..bbbad00 100644 --- a/ergogen/config.yaml +++ b/ergogen/config.yaml @@ -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 diff --git a/ergogen/footprints/reset_switch.js b/ergogen/footprints/reset_switch.js deleted file mode 100644 index f98119b..0000000 --- a/ergogen/footprints/reset_switch.js +++ /dev/null @@ -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}) - ) - ` -} \ No newline at end of file diff --git a/ergogen/footprints/reset_switch_tht_top.js b/ergogen/footprints/reset_switch_tht_top.js new file mode 100644 index 0000000..94f8825 --- /dev/null +++ b/ergogen/footprints/reset_switch_tht_top.js @@ -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; + } +} \ No newline at end of file