diff --git a/src/footprints/alps.js b/src/footprints/alps.js index 708e85e..c1e28c4 100644 --- a/src/footprints/alps.js +++ b/src/footprints/alps.js @@ -7,14 +7,14 @@ module.exports = { ${p.at /* parametric position */} ${''/* corner marks */} - (fp_line (start -7 -6) (end -7 -7) (layer F.SilkS) (width 0.15)) - (fp_line (start -7 7) (end -6 7) (layer F.SilkS) (width 0.15)) - (fp_line (start -6 -7) (end -7 -7) (layer F.SilkS) (width 0.15)) - (fp_line (start -7 7) (end -7 6) (layer F.SilkS) (width 0.15)) - (fp_line (start 7 6) (end 7 7) (layer F.SilkS) (width 0.15)) - (fp_line (start 7 -7) (end 6 -7) (layer F.SilkS) (width 0.15)) - (fp_line (start 6 7) (end 7 7) (layer F.SilkS) (width 0.15)) - (fp_line (start 7 -7) (end 7 -6) (layer F.SilkS) (width 0.15)) + (fp_line (start -7 -6) (end -7 -7) (layer Dwgs.User) (width 0.15)) + (fp_line (start -7 7) (end -6 7) (layer Dwgs.User) (width 0.15)) + (fp_line (start -6 -7) (end -7 -7) (layer Dwgs.User) (width 0.15)) + (fp_line (start -7 7) (end -7 6) (layer Dwgs.User) (width 0.15)) + (fp_line (start 7 6) (end 7 7) (layer Dwgs.User) (width 0.15)) + (fp_line (start 7 -7) (end 6 -7) (layer Dwgs.User) (width 0.15)) + (fp_line (start 6 7) (end 7 7) (layer Dwgs.User) (width 0.15)) + (fp_line (start 7 -7) (end 7 -6) (layer Dwgs.User) (width 0.15)) ${''/* pins */} (pad 1 thru_hole circle (at 2.5 -4.5) (size 2.25 2.25) (drill 1.47) (layers *.Cu *.Mask) ${p.net_from}) diff --git a/src/footprints/choc.js b/src/footprints/choc.js index e4e0040..bd44684 100644 --- a/src/footprints/choc.js +++ b/src/footprints/choc.js @@ -7,14 +7,14 @@ module.exports = { ${p.at /* parametric position */} ${''/* corner marks */} - (fp_line (start -7 -6) (end -7 -7) (layer F.SilkS) (width 0.15)) - (fp_line (start -7 7) (end -6 7) (layer F.SilkS) (width 0.15)) - (fp_line (start -6 -7) (end -7 -7) (layer F.SilkS) (width 0.15)) - (fp_line (start -7 7) (end -7 6) (layer F.SilkS) (width 0.15)) - (fp_line (start 7 6) (end 7 7) (layer F.SilkS) (width 0.15)) - (fp_line (start 7 -7) (end 6 -7) (layer F.SilkS) (width 0.15)) - (fp_line (start 6 7) (end 7 7) (layer F.SilkS) (width 0.15)) - (fp_line (start 7 -7) (end 7 -6) (layer F.SilkS) (width 0.15)) + (fp_line (start -7 -6) (end -7 -7) (layer Dwgs.User) (width 0.15)) + (fp_line (start -7 7) (end -6 7) (layer Dwgs.User) (width 0.15)) + (fp_line (start -6 -7) (end -7 -7) (layer Dwgs.User) (width 0.15)) + (fp_line (start -7 7) (end -7 6) (layer Dwgs.User) (width 0.15)) + (fp_line (start 7 6) (end 7 7) (layer Dwgs.User) (width 0.15)) + (fp_line (start 7 -7) (end 6 -7) (layer Dwgs.User) (width 0.15)) + (fp_line (start 6 7) (end 7 7) (layer Dwgs.User) (width 0.15)) + (fp_line (start 7 -7) (end 7 -6) (layer Dwgs.User) (width 0.15)) ${''/* pins */} (pad 1 thru_hole circle (at 5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net_from}) diff --git a/src/footprints/index.js b/src/footprints/index.js index 4c8f311..35c1358 100644 --- a/src/footprints/index.js +++ b/src/footprints/index.js @@ -4,6 +4,9 @@ module.exports = { choc: require('./choc'), diode: require('./diode'), promicro: require('./promicro'), + slider: require('./slider'), + reset: require('./reset'), rgb: require('./rgb'), + jstph: require('./jstph'), pad: require('./pad') } \ No newline at end of file diff --git a/src/footprints/jstph.js b/src/footprints/jstph.js new file mode 100644 index 0000000..0cc69c6 --- /dev/null +++ b/src/footprints/jstph.js @@ -0,0 +1,33 @@ +module.exports = { + nets: ['pos', 'neg'], + params: { + side: 'F' + }, + body: p => ` + + (module JST_PH_S2B-PH-K_02x2.00mm_Angled (layer F.Cu) (tedit 58D3FE32) + + (descr "JST PH series connector, S2B-PH-K, side entry type, through hole, Datasheet: http://www.jst-mfg.com/product/pdf/eng/ePH.pdf") + (tags "connector jst ph") + + ${p.at /* parametric position */} + + (fp_line (start -2.25 0.25) (end -2.25 -1.35) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start -2.25 -1.35) (end -2.95 -1.35) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start -2.95 -1.35) (end -2.95 6.25) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start -2.95 6.25) (end 2.95 6.25) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start 2.95 6.25) (end 2.95 -1.35) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start 2.95 -1.35) (end 2.25 -1.35) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start 2.25 -1.35) (end 2.25 0.25) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start 2.25 0.25) (end -2.25 0.25) (layer ${p.param_side}.SilkS) (width 0.15)) + + (fp_line (start -1 1.5) (end -1 2.0) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start -1.25 1.75) (end -0.75 1.75) (layer ${p.param_side}.SilkS) (width 0.15)) + + (pad 1 thru_hole rect (at -1 0 ${p.rot}) (size 1.2 1.7) (drill 0.75) (layers *.Cu *.Mask) ${p.net_pos}) + (pad 2 thru_hole oval (at 1 0 ${p.rot}) (size 1.2 1.7) (drill 0.75) (layers *.Cu *.Mask) ${p.net_neg}) + + ) + + ` +} \ No newline at end of file diff --git a/src/footprints/mx.js b/src/footprints/mx.js index a90e417..214ea62 100644 --- a/src/footprints/mx.js +++ b/src/footprints/mx.js @@ -7,14 +7,14 @@ module.exports = { ${p.at /* parametric position */} ${''/* corner marks */} - (fp_line (start -7 -6) (end -7 -7) (layer F.SilkS) (width 0.15)) - (fp_line (start -7 7) (end -6 7) (layer F.SilkS) (width 0.15)) - (fp_line (start -6 -7) (end -7 -7) (layer F.SilkS) (width 0.15)) - (fp_line (start -7 7) (end -7 6) (layer F.SilkS) (width 0.15)) - (fp_line (start 7 6) (end 7 7) (layer F.SilkS) (width 0.15)) - (fp_line (start 7 -7) (end 6 -7) (layer F.SilkS) (width 0.15)) - (fp_line (start 6 7) (end 7 7) (layer F.SilkS) (width 0.15)) - (fp_line (start 7 -7) (end 7 -6) (layer F.SilkS) (width 0.15)) + (fp_line (start -7 -6) (end -7 -7) (layer Dwgs.User) (width 0.15)) + (fp_line (start -7 7) (end -6 7) (layer Dwgs.User) (width 0.15)) + (fp_line (start -6 -7) (end -7 -7) (layer Dwgs.User) (width 0.15)) + (fp_line (start -7 7) (end -7 6) (layer Dwgs.User) (width 0.15)) + (fp_line (start 7 6) (end 7 7) (layer Dwgs.User) (width 0.15)) + (fp_line (start 7 -7) (end 6 -7) (layer Dwgs.User) (width 0.15)) + (fp_line (start 6 7) (end 7 7) (layer Dwgs.User) (width 0.15)) + (fp_line (start 7 -7) (end 7 -6) (layer Dwgs.User) (width 0.15)) ${''/* pins */} (pad 1 thru_hole circle (at 2.54 -5.08) (size 2.286 2.286) (drill 1.4986) (layers *.Cu *.Mask) ${p.net_from}) diff --git a/src/footprints/pad.js b/src/footprints/pad.js index 0082f9c..5c7f9c4 100644 --- a/src/footprints/pad.js +++ b/src/footprints/pad.js @@ -4,18 +4,29 @@ module.exports = { width: 1, height: 1, front: true, - back: true + back: true, + text: '', + align: 'left', + mirrored: '!mirrored' }, body: p => { - let front = '' - if (p.param_front) { - front = `(pad 1 smd rect (at 0 0 ${p.rot}) (size ${p.param_width} ${p.param_height}) (layers F.Cu F.Paste F.Mask) ${p.net_net})` - } - - let back = '' - if (p.param_back) { - back = `(pad 1 smd rect (at 0 0 ${p.rot}) (size ${p.param_width} ${p.param_height}) (layers B.Cu B.Paste B.Mask) ${p.net_net})` + const layout = (toggle, side) => { + if (!toggle) return '' + let x = 0, y = 0 + const mirror = side == 'B' ? '(justify mirror)' : '' + const plus = (p.param_text.length + 1) * 0.5 + let align = p.param_align + if (p.param_mirrored === true) { + if (align == 'left') align = 'right' + else if (align == 'right') align = 'left' + } + if (align == 'left') x -= p.param_width / 2 + plus + if (align == 'right') x += p.param_width / 2 + plus + if (align == 'up') y += p.param_height / 2 + plus + if (align == 'down') y -= p.param_height / 2 + plus + const text = `(fp_text user ${p.param_text} (at ${x} ${y} ${p.rot}) (layer ${side}.SilkS) (effects (font (size 0.8 0.8) (thickness 0.15)) ${mirror}))` + return `(pad 1 smd rect (at 0 0 ${p.rot}) (size ${p.param_width} ${p.param_height}) (layers ${side}.Cu ${side}.Paste ${side}.Mask) ${p.net_net})\n${text}` } return ` @@ -25,8 +36,8 @@ module.exports = { ${p.at /* parametric position */} ${''/* SMD pads */} - ${front} - ${back} + ${layout(p.param_front, 'F')} + ${layout(p.param_back, 'B')} ) diff --git a/src/footprints/promicro.js b/src/footprints/promicro.js index b69e2a0..1e4dd5a 100644 --- a/src/footprints/promicro.js +++ b/src/footprints/promicro.js @@ -13,21 +13,21 @@ module.exports = { ${p.at /* parametric position */} ${''/* illustration of the (possible) USB port overhang */} - (fp_line (start -19.304 -3.556) (end -14.224 -3.556) (layer Dwgs.User) (width 0.25)) - (fp_line (start -19.304 3.81) (end -19.304 -3.556) (layer Dwgs.User) (width 0.25)) - (fp_line (start -14.224 3.81) (end -19.304 3.81) (layer Dwgs.User) (width 0.25)) - (fp_line (start -14.224 -3.556) (end -14.224 3.81) (layer Dwgs.User) (width 0.25)) + (fp_line (start -19.304 -3.556) (end -14.224 -3.556) (layer Dwgs.User) (width 0.15)) + (fp_line (start -19.304 3.81) (end -19.304 -3.556) (layer Dwgs.User) (width 0.15)) + (fp_line (start -14.224 3.81) (end -19.304 3.81) (layer Dwgs.User) (width 0.15)) + (fp_line (start -14.224 -3.556) (end -14.224 3.81) (layer Dwgs.User) (width 0.15)) ${''/* component outline */} - (fp_line (start -17.78 8.89) (end 15.24 8.89) (layer F.SilkS) (width 0.25)) - (fp_line (start 15.24 8.89) (end 15.24 -8.89) (layer F.SilkS) (width 0.25)) - (fp_line (start 15.24 -8.89) (end -17.78 -8.89) (layer F.SilkS) (width 0.25)) - (fp_line (start -17.78 -8.89) (end -17.78 8.89) (layer F.SilkS) (width 0.25)) + (fp_line (start -17.78 8.89) (end 15.24 8.89) (layer F.SilkS) (width 0.15)) + (fp_line (start 15.24 8.89) (end 15.24 -8.89) (layer F.SilkS) (width 0.15)) + (fp_line (start 15.24 -8.89) (end -17.78 -8.89) (layer F.SilkS) (width 0.15)) + (fp_line (start -17.78 -8.89) (end -17.78 8.89) (layer F.SilkS) (width 0.15)) ${''/* extra border around "RAW", in case the rectangular shape is not distinctive enough */} - (fp_line (start -15.24 6.35) (end -12.7 6.35) (layer F.SilkS) (width 0.25)) - (fp_line (start -15.24 6.35) (end -15.24 8.89) (layer F.SilkS) (width 0.25)) - (fp_line (start -12.7 6.35) (end -12.7 8.89) (layer F.SilkS) (width 0.25)) + (fp_line (start -15.24 6.35) (end -12.7 6.35) (layer F.SilkS) (width 0.15)) + (fp_line (start -15.24 6.35) (end -15.24 8.89) (layer F.SilkS) (width 0.15)) + (fp_line (start -12.7 6.35) (end -12.7 8.89) (layer F.SilkS) (width 0.15)) ${''/* pin names */} (fp_text user RAW (at -13.97 4.8 ${p.rot + 90}) (layer F.SilkS) (effects (font (size 0.8 0.8) (thickness 0.15)))) diff --git a/src/footprints/reset.js b/src/footprints/reset.js new file mode 100644 index 0000000..7911029 --- /dev/null +++ b/src/footprints/reset.js @@ -0,0 +1,33 @@ +module.exports = { + nets: ['from', 'to'], + params: { + side: 'F' + }, + body: p => ` + + (module E73:SW_TACT_ALPS_SKQGABE010 (layer F.Cu) (tstamp 5BF2CC94) + + (descr "Low-profile SMD Tactile Switch, https://www.e-switch.com/system/asset/product_line/data_sheet/165/TL3342.pdf") + (tags "SPST Tactile Switch") + + ${p.at /* parametric position */} + + ${'' /* outline */} + (fp_line (start 2.75 1.25) (end 1.25 2.75) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start 2.75 -1.25) (end 1.25 -2.75) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start 2.75 -1.25) (end 2.75 1.25) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start -1.25 2.75) (end 1.25 2.75) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start -1.25 -2.75) (end 1.25 -2.75) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start -2.75 1.25) (end -1.25 2.75) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start -2.75 -1.25) (end -1.25 -2.75) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start -2.75 -1.25) (end -2.75 1.25) (layer ${p.param_side}.SilkS) (width 0.15)) + + ${'' /* pins */} + (pad 1 smd rect (at -3.1 -1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_from}) + (pad 1 smd rect (at 3.1 -1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_from}) + (pad 2 smd rect (at -3.1 1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_to}) + (pad 2 smd rect (at 3.1 1.85 ${p.rot}) (size 1.8 1.1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_to}) + ) + + ` +} \ No newline at end of file diff --git a/src/footprints/slider.js b/src/footprints/slider.js new file mode 100644 index 0000000..6caad77 --- /dev/null +++ b/src/footprints/slider.js @@ -0,0 +1,47 @@ +module.exports = { + nets: ['from', 'to'], + params: { + side: 'F' + }, + body: p => { + + const sign = p.param_side == 'F' ? '-' : '' + + return ` + + (module E73:SPDT_C128955 (layer F.Cu) (tstamp 5BF2CC3C) + + ${p.at /* parametric position */} + + ${'' /* outline */} + (fp_line (start 1.95 -1.35) (end -1.95 -1.35) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start 0 -1.35) (end -3.3 -1.35) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start -3.3 -1.35) (end -3.3 1.5) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start -3.3 1.5) (end 3.3 1.5) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start 3.3 1.5) (end 3.3 -1.35) (layer ${p.param_side}.SilkS) (width 0.15)) + (fp_line (start 0 -1.35) (end 3.3 -1.35) (layer ${p.param_side}.SilkS) (width 0.15)) + + ${'' /* extra indicator for the slider */} + (fp_line (start -1.95 -3.85) (end 1.95 -3.85) (layer Dwgs.User) (width 0.15)) + (fp_line (start 1.95 -3.85) (end 1.95 -1.35) (layer Dwgs.User) (width 0.15)) + (fp_line (start -1.95 -1.35) (end -1.95 -3.85) (layer Dwgs.User) (width 0.15)) + + ${'' /* bottom cutouts */} + (pad "" np_thru_hole circle (at 1.5 0) (size 1 1) (drill 0.9) (layers *.Cu *.Mask)) + (pad "" np_thru_hole circle (at -1.5 0) (size 1 1) (drill 0.9) (layers *.Cu *.Mask)) + + ${'' /* pins */} + (pad 1 smd rect (at 2.25 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_from}) + (pad 2 smd rect (at ${sign}0.75 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_to}) + (pad 3 smd rect (at -2.25 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask)) + + ${'' /* side mounts */} + (pad "" smd rect (at 3.7 -1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask)) + (pad "" smd rect (at 3.7 1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask)) + (pad "" smd rect (at -3.7 1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask)) + (pad "" smd rect (at -3.7 -1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask)) + ) + + ` + } +} \ No newline at end of file diff --git a/src/points.js b/src/points.js index 4651ffa..3c02199 100644 --- a/src/points.js +++ b/src/points.js @@ -214,6 +214,7 @@ exports.parse = (config = {}) => { const mp = p.clone().mirror(axis) mp.meta = a.extend(mp.meta, mp.meta.mirror || {}) mp.meta.mirrored = true + p.meta.mirrored = false const new_name = `mirror_${name}` mp.meta.name = new_name mirrored_points[new_name] = mp diff --git a/test/fixtures/absolem.yaml b/test/fixtures/absolem.yaml index 947dab9..d251b50 100644 --- a/test/fixtures/absolem.yaml +++ b/test/fixtures/absolem.yaml @@ -15,6 +15,7 @@ points: bind: [,15,-1] key: column_net: P1 + column_mark: P ring: stagger: 12 rows: @@ -26,6 +27,7 @@ points: bind: [,10] key: column_net: P0 + column_mark: R middle: stagger: 5 rows: @@ -36,6 +38,7 @@ points: top: key: column_net: P2 + column_mark: M index: stagger: -6 rows: @@ -47,6 +50,7 @@ points: bind: [,,,10] key: column_net: P3 + column_mark: X inner: stagger: -2 rows: @@ -58,21 +62,28 @@ points: bind: [,,,10] key: column_net: P4 + column_mark: I rows: bottom: bind: [10] row_net: P16 + row_mark: LB mirror: row_net: P7 + row_mark: RB home: bind: [10] row_net: P14 + row_mark: LH mirror: row_net: P6 + row_mark: RH top: row_net: P15 + row_mark: LT mirror: row_net: P5 + row_mark: RT s19: extends: matrix columns: @@ -103,6 +114,8 @@ points: width: 2 height: 2 front: false + text: 'E' + align: right key: footprints: row_ext: @@ -115,6 +128,8 @@ points: width: 2 height: 2 front: false + text: '!row_mark' + align: right ring: rows: @@ -179,6 +194,7 @@ points: width: 2 height: 2 front: false + text: '!column_mark' bottom: footprints: diode: @@ -194,6 +210,7 @@ points: width: 2 height: 2 front: false + text: '!column_mark' key: tags: s19: true @@ -288,6 +305,8 @@ points: width: 2 height: 2 front: false + text: '!row_mark' + align: right home: spread: 21.25 @@ -318,6 +337,7 @@ points: rows: thumb: row_net: P10 + row_mark: LF footprints: diode: anchor: @@ -325,6 +345,7 @@ points: rotate: 180 mirror: row_net: P8 + row_mark: RF footprints: diode: anchor: @@ -602,6 +623,31 @@ pcbs: - mirror_s18_inner_top shift: [0, -23] rotate: 270 + slider: + type: slider + anchor: + ref: + - s18_inner_top + - mirror_s18_inner_top + shift: [0, -7.5] + nets: + from: RAWER + to: RAW + params: + side: B + reset: + type: reset + anchor: + ref: + - s18_inner_top + - mirror_s18_inner_top + shift: [0, -17] + rotate: 90 + nets: + from: RST + to: GND + params: + side: B extra_row_left: type: pad anchor: @@ -615,6 +661,8 @@ pcbs: width: 3 height: 3 front: false + text: 'LN' + align: right extra_row_right: type: pad anchor: @@ -628,6 +676,18 @@ pcbs: width: 3 height: 3 front: false + text: 'RN' + battery: + type: jstph + anchor: + ref: + - matrix_inner_bottom + - mirror_matrix_inner_bottom + shift: [0, -43] + rotate: 180 + nets: + pos: RAWER + neg: GND led: type: rgb anchor: