diff --git a/config.yaml b/config.yaml index d97f0f4..286a1ff 100644 --- a/config.yaml +++ b/config.yaml @@ -260,8 +260,8 @@ pcbs: params: from: "{{colrow}}" to: "{{row_net}}" - mcu_l: - what: promicro + mcu_r: + what: promicro_flippable where: ref: - matrix_inner_top @@ -269,6 +269,7 @@ pcbs: rotate: 270 params: orientation: up + silk_layer: B.SilkS P4: row_top P5: row_home P6: row_bottom @@ -278,8 +279,8 @@ pcbs: P18: col_middle P19: col_ring P20: col_pinky - mcu_r: - what: promicro + mcu_l: + what: promicro_flippable where: ref: - matrix_inner_top @@ -287,6 +288,7 @@ pcbs: rotate: 270 params: orientation: down + silk_layer: F.SilkS pad_plus: what: pad where: diff --git a/footprints/promicro_flippable.js b/footprints/promicro_flippable.js new file mode 100644 index 0000000..6d53e4e --- /dev/null +++ b/footprints/promicro_flippable.js @@ -0,0 +1,143 @@ +// Arduino ProMicro atmega32u4au +// Params +// orientation: default is down +// if down, power led will face the pcb +// if up, power led will face away from pcb + +module.exports = { + params: { + designator: 'MCU', + orientation: 'down', + silk_layer: 'F.SilkS', + RAW: {type: 'net', value: 'RAW'}, + GND: {type: 'net', value: 'GND'}, + RST: {type: 'net', value: 'RST'}, + VCC: {type: 'net', value: 'VCC'}, + P21: {type: 'net', value: 'P21'}, + P20: {type: 'net', value: 'P20'}, + P19: {type: 'net', value: 'P19'}, + P18: {type: 'net', value: 'P18'}, + P15: {type: 'net', value: 'P15'}, + P14: {type: 'net', value: 'P14'}, + P16: {type: 'net', value: 'P16'}, + P10: {type: 'net', value: 'P10'}, + P1: {type: 'net', value: 'P1'}, + P0: {type: 'net', value: 'P0'}, + P2: {type: 'net', value: 'P2'}, + P3: {type: 'net', value: 'P3'}, + P4: {type: 'net', value: 'P4'}, + P5: {type: 'net', value: 'P5'}, + P6: {type: 'net', value: 'P6'}, + P7: {type: 'net', value: 'P7'}, + P8: {type: 'net', value: 'P8'}, + P9: {type: 'net', value: 'P9'} + }, + body: p => { + const standard = ` + (module ProMicro (layer F.Cu) (tedit 5B307E4C) + ${p.at /* parametric position */} + + ${'' /* footprint reference */} + (fp_text reference "${p.ref}" (at 0 0) (layer ${p.silk_layer}) ${p.ref_hide} (effects (font (size 1.27 1.27) (thickness 0.15)))) + (fp_text value "" (at 0 0) (layer ${p.silk_layer}) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) + + ${''/* illustration of the (possible) USB port overhang */} + (fp_line (start -19.304 -3.81) (end -14.224 -3.81) (layer Dwgs.User) (width 0.15)) + (fp_line (start -19.304 3.81) (end -19.304 -3.81) (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.81) (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 ${p.silk_layer}) (width 0.15)) + (fp_line (start 15.24 8.89) (end 15.24 -8.89) (layer ${p.silk_layer}) (width 0.15)) + (fp_line (start 15.24 -8.89) (end -17.78 -8.89) (layer ${p.silk_layer}) (width 0.15)) + (fp_line (start -17.78 -8.89) (end -17.78 8.89) (layer ${p.silk_layer}) (width 0.15)) + ` + function pins(def_neg, def_pos, silk_layer, font_effect) { + return ` + ${''/* extra border around "RAW", in case the rectangular shape is not distinctive enough */} + (fp_line (start -15.24 ${def_pos}6.35) (end -12.7 ${def_pos}6.35) (layer ${silk_layer}) (width 0.15)) + (fp_line (start -15.24 ${def_pos}6.35) (end -15.24 ${def_pos}8.89) (layer ${silk_layer}) (width 0.15)) + (fp_line (start -12.7 ${def_pos}6.35) (end -12.7 ${def_pos}8.89) (layer ${silk_layer}) (width 0.15)) + + ${''/* pin names */} + (fp_text user RAW (at -13.97 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user GND (at -11.43 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user RST (at -8.89 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user VCC (at -6.35 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P21 (at -3.81 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P20 (at -1.27 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P19 (at 1.27 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P18 (at 3.81 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P15 (at 6.35 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P14 (at 8.89 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P16 (at 11.43 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P10 (at 13.97 ${def_pos}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + + (fp_text user P01 (at -13.97 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P00 (at -11.43 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user GND (at -8.89 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user GND (at -6.35 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P02 (at -3.81 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P03 (at -1.27 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P04 (at 1.27 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P05 (at 3.81 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P06 (at 6.35 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P07 (at 8.89 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P08 (at 11.43 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + (fp_text user P09 (at 13.97 ${def_neg}4.8 ${p.rot + 90}) (layer ${silk_layer}) (effects (font (size 0.8 0.8) (thickness 0.15)) ${font_effect})) + + ${''/* and now the actual pins */} + (pad 1 thru_hole rect (at -13.97 ${def_pos}7.62 ${p.rot}) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.RAW.str}) + (pad 2 thru_hole circle (at -11.43 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.GND.str}) + (pad 3 thru_hole circle (at -8.89 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.RST.str}) + (pad 4 thru_hole circle (at -6.35 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.VCC.str}) + (pad 5 thru_hole circle (at -3.81 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P21.str}) + (pad 6 thru_hole circle (at -1.27 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P20.str}) + (pad 7 thru_hole circle (at 1.27 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P19.str}) + (pad 8 thru_hole circle (at 3.81 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P18.str}) + (pad 9 thru_hole circle (at 6.35 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P15.str}) + (pad 10 thru_hole circle (at 8.89 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P14.str}) + (pad 11 thru_hole circle (at 11.43 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P16.str}) + (pad 12 thru_hole circle (at 13.97 ${def_pos}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P10.str}) + + (pad 13 thru_hole circle (at -13.97 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P1.str}) + (pad 14 thru_hole circle (at -11.43 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P0.str}) + (pad 15 thru_hole circle (at -8.89 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.GND.str}) + (pad 16 thru_hole circle (at -6.35 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.GND.str}) + (pad 17 thru_hole circle (at -3.81 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P2.str}) + (pad 18 thru_hole circle (at -1.27 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P3.str}) + (pad 19 thru_hole circle (at 1.27 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P4.str}) + (pad 20 thru_hole circle (at 3.81 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P5.str}) + (pad 21 thru_hole circle (at 6.35 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P6.str}) + (pad 22 thru_hole circle (at 8.89 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P7.str}) + (pad 23 thru_hole circle (at 11.43 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P8.str}) + (pad 24 thru_hole circle (at 13.97 ${def_neg}7.62 0) (size 1.7526 1.7526) (drill 1.0922) (layers *.Cu *.SilkS *.Mask) ${p.P9.str}) + ` + } + if(p.orientation == 'down' && p.silk_layer == 'F.SilkS') { + return ` + ${standard} + ${pins('-', '', 'F.SilkS', '')}) + ` + } else if(p.orientation == 'down' && p.silk_layer == 'B.SilkS') { + return ` + ${standard} + ${pins('-', '', 'B.SilkS', '(justify mirror)')}) + ` + } else if(p.orientation == 'up' && p.silk_layer == 'F.SilkS') { + return ` + ${standard} + ${pins('', '-', 'F.SilkS', '')}) + ` + } else if(p.orientation == 'up' && p.silk_layer == 'B.SilkS') { + return ` + ${standard} + ${pins('', '-', 'B.SilkS', '(justify mirror)')}) + ` + } else { + throw new Error(`Invalid combination of orientation "${p.orientation}" and silk layer "${p.silk_layer}"; allowed values are up/down and F.SilkS/B.SilkS respectivelly`) + } + } +} +