~tgrosinger/keyboards

14ac4005ecf48ff901d6125e724842c07fb6d869 — Tony Grosinger 1 year, 2 months ago a101438
Finished updating board outline
2 files changed, 162 insertions(+), 33 deletions(-)

A pseudacris/footprints/choc_with_diode.js
M pseudacris/pseudacris.yaml
A pseudacris/footprints/choc_with_diode.js => pseudacris/footprints/choc_with_diode.js +121 -0
@@ 0,0 1,121 @@
// Kailh Choc PG1350
// Nets
//    from: corresponds to pin 1
//    to: corresponds to pin 2
// Params
//    hotswap: default is false
//      if true, will include holes and pads for Kailh choc hotswap sockets
//    reverse: default is false
//      if true, will flip the footprint such that the pcb can be reversible
//    keycaps: default is false
//      if true, will add choc sized keycap box around the footprint
// 
// note: hotswap and reverse can be used simultaneously

module.exports = {
  nets: {
    from: undefined,
    to: undefined
  },
  params: {
    class: 'S',
    hotswap: false,
    reverse: false,
    keycaps: false
  },
  body: p => {
    const standard = `
      (module PG1350 (layer F.Cu) (tedit 5DD50112)
      ${p.at /* parametric position */}

      ${'' /* footprint reference */}
      (fp_text reference "${p.ref}" (at 0 0) (layer F.SilkS) ${p.ref_hide} (effects (font (size 1.27 1.27) (thickness 0.15))))
      (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))

      ${''/* diode box marker */}        	 
      (fp_line (start 2.868 3.326) (end 2.868 5.476) (layer "Dwgs.User") (width 0.15))
      (fp_line (start -2.732 5.476) (end 2.868 5.476) (layer "Dwgs.User") (width 0.15))
      (fp_line (start 2.868 3.326) (end -2.732 3.326) (layer "Dwgs.User") (width 0.15))
      (fp_line (start -2.732 3.326) (end -2.732 5.476) (layer "Dwgs.User") (width 0.15))

      ${''/* diode direction marker */}        	 
      (fp_line (start -0.282 4.426) (end 0.318 4.026) (layer "F.SilkS") (width 0.1))
      (fp_line (start 0.318 4.826) (end -0.282 4.426) (layer "F.SilkS") (width 0.1))
      (fp_line (start -0.282 4.426) (end -0.282 3.876) (layer "F.SilkS") (width 0.1))
      (fp_line (start -0.282 4.426) (end -0.282 4.976) (layer "F.SilkS") (width 0.1))
      (fp_line (start -0.682 4.426) (end -0.282 4.426) (layer "F.SilkS") (width 0.1))
      (fp_line (start 0.318 4.426) (end 0.818 4.426) (layer "F.SilkS") (width 0.1))
      (fp_line (start 0.318 4.026) (end 0.318 4.826) (layer "F.SilkS") (width 0.1))

      ${''/* diode pads */}
      (pad "" smd rect (at 1.776 4.401 ${ p.rot }) (size 1.1 1.9) (layers "B.Cu" "B.Paste" "B.Mask"))
      (pad 2 smd rect (at -1.524 4.401 ${ p.rot }) (size 1.1 1.9) (layers "B.Cu" "B.Paste" "B.Mask") ${p.net.to.str})

      ${''/* corner marks */}
      (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))      
      
      ${''/* middle shaft */}
      (pad "" np_thru_hole circle (at 0 0) (size 3.429 3.429) (drill 3.429) (layers *.Cu *.Mask))
        
      ${''/* stabilizers */}
      (pad "" np_thru_hole circle (at 5.5 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
      (pad "" np_thru_hole circle (at -5.5 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))

      `
    const keycap = `
      ${'' /* keycap marks */}
      (fp_line (start -9 -8.5) (end 9 -8.5) (layer Dwgs.User) (width 0.15))
      (fp_line (start 9 -8.5) (end 9 8.5) (layer Dwgs.User) (width 0.15))
      (fp_line (start 9 8.5) (end -9 8.5) (layer Dwgs.User) (width 0.15))
      (fp_line (start -9 8.5) (end -9 -8.5) (layer Dwgs.User) (width 0.15))
      `
    function pins(def_neg, def_pos, def_side) {
      if(p.param.hotswap) {
        return `
          ${'' /* holes */}
          (pad "" np_thru_hole circle (at ${def_pos}5 -3.75) (size 3 3) (drill 3) (layers *.Cu *.Mask))
          (pad "" np_thru_hole circle (at 0 -5.95) (size 3 3) (drill 3) (layers *.Cu *.Mask))
      
          ${'' /* net pads (other pad is with diode) */}
          (pad 1 smd rect (at ${def_neg}3.275 -5.95 ${p.rot}) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask)  ${p.net.from.str})

          ${''/* right hotswap pad and trace to diode */}
          (pad "" smd custom (at 8.275 -3.75 ${ p.rot }) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask)
            (clearance 0.2)
            (options (clearance outline) (anchor rect))
            (primitives
              (gr_line (start -0.5 1) (end -0.5 4.6) (width 0.2))
              (gr_line (start -3.3284 7.4284) (end -6.5 7.4284) (width 0.2))
              (gr_line (start -0.499981 4.599974) (end -3.328408 7.428401) (width 0.2))
            ))
        `
      } else {
          return `
            ${''/* pins (other pad is with diode) */}
            (pad 1 thru_hole circle (at ${def_pos}5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net.from.str})
          `
      }
    }
    if(p.param.reverse) {
      return `
        ${standard}
        ${p.param.keycaps ? keycap : ''}
        ${pins('-', '', 'B')}
        ${pins('', '-', 'F')})
        `
    } else {
      return `
        ${standard}
        ${p.param.keycaps ? keycap : ''}
        ${pins('-', '', 'B')})
        `
    }
  }
}
\ No newline at end of file

M pseudacris/pseudacris.yaml => pseudacris/pseudacris.yaml +41 -33
@@ 23,7 23,7 @@ points:
        padding: 17
        footprints:
          choc:
            type: choc
            type: choc_with_diode
            params:
              hotswap: true
            nets:


@@ 37,11 37,12 @@ points:
            mirror.column_net: P18
          rows:
            bottom:
              bind: [0.5ky, 1, 0, 0]
              #     [t, r, b, l]
              bind: [0.5ky, 1, 0, 2.5]
            home:
              bind: [0.5ky, 0.5kx, 0.5ky, 0]
              bind: [0.5ky, 0.5kx, 0.5ky, 2.5]
            top:
              bind: [0, 0.5kx, 0.5ky, 0]
              bind: [0.25, 0.5kx, 0.5ky, 2.5]
        ring:
          rotate: -pinky_splay
          stagger: 7


@@ 55,7 56,7 @@ points:
            home:
              bind: [0.5ky, 0.5kx, 0.5ky, 0.5kx]
            top:
              bind: [0, 0.5kx, 0.5ky, 0]
              bind: [0, 0.5ky, 0.5ky, 2.5]
        middle:
          rotate: -ring_splay
          stagger: 3


@@ 69,7 70,7 @@ points:
            home:
              bind: [0.5ky, 0.5kx, 0.5ky, 0.5kx]
            top:
              bind: [0, 0, 0.5ky, 0]
              bind: [0, 0.5ky, 0.5ky, 2.5]
        index:
          stagger: -6
          spread: kx


@@ 114,7 115,7 @@ points:
        padding: 17.5
        footprints:
          choc:
            type: choc
            type: choc_with_diode
            params:
              hotswap: true
            nets:


@@ 175,56 176,60 @@ outlines:
      - type: keys
        side: both
        size: 16
    _center:
    _center_positive:
      - type: polygon
        points:
          - ref: matrix_inner_top
            shift: [cx/2, cy/2-1]
          - ref: mirror_matrix_inner_top
            shift: [cx/2, cy/2-1]
          - ref: matrix_middle_top
            shift: [cx/2, cy/2+1]
          - ref: mirror_matrix_middle_top
            shift: [cx/2, cy/2+1]
          - ref: mirror_matrix_middle_bottom
            shift: [cx/2, 0]
          - ref: mirror_thumbfan_home_thumb
            shift: [-cx/3, cy/2]
            shift: [-cx/2, 0]
          - ref: mirror_thumbfan_far_thumb
            shift: [cx/2, -cy/2+0.5]
            shift: [cx/2, -cy/2]
          - ref: thumbfan_far_thumb
            shift: [cx/2, -cy/2+0.5]
            shift: [cx/2, -cy/2]
          - ref: thumbfan_home_thumb
            shift: [-cx/3, cy/2]
      - type: circle # Bottom center arc
        operation: subtract
            shift: [-cx/2, 0]
          - ref: matrix_middle_bottom
            shift: [cx/2, 0]
    _bottom_center_arc:
      - type: circle
        anchor:
          ref:
            - thumbfan_far_thumb
            - mirror_thumbfan_far_thumb
          shift: [0, -38]
        radius: 31
      - type: circle # Top center arc
        operation: subtract
          shift: [0, -78.5]
        radius: 70
    _top_center_arc:
      - type: circle
        anchor:
          ref:
            - matrix_inner_top
            - mirror_matrix_inner_top
          shift: [0, 32]
        radius: 31
          shift: [0, 116.8]
        radius: 100
    _bottom_arc:
      - type: polygon
        mirror: true
        points:
          - ref: matrix_pinky_bottom
            shift: [cx/2, -cy/2+0.5]
            shift: [cx/2, -cy/2]
          - ref: thumbfan_near_thumb
            shift: [-cx/2, -cy/2+0.5]
            shift: [-cx/2, -cy/2]
          - ref: matrix_inner_bottom
            shift: [cx/2, cy/2]
          - ref: matrix_pinky_bottom
            shift: [cx/2, cy/2]
            shift: [cx/2-1, cy/2]
      - type: circle
        mirror: true
        operation: subtract
        anchor:
          ref: matrix_pinky_bottom
          shift: [0, -76.5]
        radius: 69
          shift: [-0.7, -74.3]
        radius: 67
    _keycaps:
      - type: keys
        side: both


@@ 247,7 252,9 @@ outlines:
        radius: mounting_hole_radius
    _panel:
      - _key_outline
      - +_center
      - +_center_positive
      - -_top_center_arc
      - -_bottom_center_arc
      - +_bottom_arc
    panel:
      - name: _panel


@@ 257,8 264,9 @@ outlines:
      - panel
      - ^_keycaps
    demo_center:
      - _center
      - _center_positive
      - ^_keycaps
      - ^_bottom_arc
    demo_battery:
      - panel
      - ^_mcu


@@ 299,7 307,7 @@ pcbs:
          ref:
            - thumbfan_far_thumb
            - mirror_thumbfan_far_thumb
          shift: [0, 2]
          shift: [0, 0]
      power:
        type: slider
        nets:


@@ 309,5 317,5 @@ pcbs:
          ref:
            - thumbfan_far_thumb
            - mirror_thumbfan_far_thumb
          shift: [0, -4]
          shift: [0, -5.5]
          rotate: 180