Can now have right angle pin headers on PCBs.
Fixed bugs right angle pin headers with rows not equal to two. Added more tests for pin headers.
This commit is contained in:
parent
7f65e5d539
commit
c99ed98a64
13
readme.md
13
readme.md
|
@ -2476,7 +2476,7 @@ Pin headers and sockets, etc.
|
|||
|:--- |:--- |
|
||||
| ```box_header(type, cols = 1, rows = 1, smt = false, cutout = false)``` | Draw box header |
|
||||
| ```idc_transition(type, cols = 5, skip = [], cutout = false)``` | Draw IDC transition header |
|
||||
| ```jst_xh_header(type, pin_count, right_angle=false, colour, pin_colour)``` | Draw JST XH connector |
|
||||
| ```jst_xh_header(type, pin_count, right_angle=false, colour = false, pin_colour = false)``` | Draw JST XH connector |
|
||||
| ```pin(type, length = undef)``` | Draw a header pin |
|
||||
| ```pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cutout = false, colour)``` | Draw pin header |
|
||||
| ```pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt = false, cutout = false, colour)``` | Draw pin socket |
|
||||
|
@ -2487,11 +2487,18 @@ Pin headers and sockets, etc.
|
|||
| Qty | Module call | BOM entry |
|
||||
| ---:|:--- |:---|
|
||||
| 1 | ```box_header(2p54header, 10, 2)``` | Box header 10 x 2 |
|
||||
| 1 | ```box_header(2p54header, 8, 1)``` | Box header 8 x 1 |
|
||||
| 1 | ```idc_transition(2p54header, 10)``` | IDC transition header 10 x 2 |
|
||||
| 1 | ```pin_header(2p54header, 10, 2)``` | Pin header 10 x 2 |
|
||||
| 1 | ```pin_header(2p54header, 10, 2, right_angle = true)``` | Pin header 10 x 2 right_angle |
|
||||
| 1 | ```pin_header(2p54header, 3, 1, right_angle = true)``` | Pin header 3 x 1 right_angle |
|
||||
| 1 | ```pin_header(2p54header, 3, 2, right_angle = true)``` | Pin header 3 x 2 right_angle |
|
||||
| 1 | ```pin_header(2p54header, 3, 3, right_angle = true)``` | Pin header 3 x 3 right_angle |
|
||||
| 1 | ```pin_header(2p54header, 8, 1)``` | Pin header 8 x 1 |
|
||||
| 1 | ```pin_socket(2p54header, 10, 2)``` | Pin socket 10 x 2 |
|
||||
| 1 | ```pin_socket(2p54header, 10, 2, right_angle = true)``` | Pin socket 10 x 2 right_angle |
|
||||
| 1 | ```pin_socket(2p54header, 3, 1, right_angle = true)``` | Pin socket 3 x 1 right_angle |
|
||||
| 1 | ```pin_socket(2p54header, 3, 2, right_angle = true)``` | Pin socket 3 x 2 right_angle |
|
||||
| 1 | ```pin_socket(2p54header, 3, 3, right_angle = true)``` | Pin socket 3 x 3 right_angle |
|
||||
| 1 | ```pin_socket(2p54header, 8, 1)``` | Pin socket 8 x 1 |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
|
|
@ -23,26 +23,53 @@ include <../vitamins/pin_headers.scad>
|
|||
|
||||
pins = 10;
|
||||
|
||||
module pin_headers()
|
||||
module pin_headers() {
|
||||
layout([for(p = pin_headers) hdr_pitch(p) * pins], 15) {
|
||||
idc_transition(pin_headers[$i], 10);
|
||||
|
||||
translate([0, 20])
|
||||
pin_header(pin_headers[$i], 10, 2, right_angle = true);
|
||||
pin_header(pin_headers[$i], 3, 2, right_angle = true);
|
||||
|
||||
translate([-10, 20])
|
||||
pin_header(pin_headers[$i], 3, 1, right_angle = true);
|
||||
|
||||
translate([10, 20])
|
||||
pin_header(pin_headers[$i], 3, 3, right_angle = true);
|
||||
|
||||
translate([0, 30])
|
||||
pin_header(pin_headers[$i], 8, 1);
|
||||
|
||||
translate([0, 40])
|
||||
pin_header(pin_headers[$i], 10, 2);
|
||||
|
||||
translate([0, 50])
|
||||
box_header(pin_headers[$i], 8, 1);
|
||||
|
||||
translate([0, 60])
|
||||
box_header(pin_headers[$i], 10, 2);
|
||||
|
||||
translate([0, 70])
|
||||
pin_socket(pin_headers[$i], 8, 1);
|
||||
|
||||
translate([0, 80])
|
||||
pin_socket(pin_headers[$i], 10, 2);
|
||||
|
||||
translate([0, 110])
|
||||
pin_socket(pin_headers[$i], 10, 2, right_angle = true);
|
||||
translate([-10, 105])
|
||||
pin_socket(pin_headers[$i], 3, 1, right_angle = true);
|
||||
|
||||
translate([0, 105])
|
||||
pin_socket(pin_headers[$i], 3, 2, right_angle = true);
|
||||
|
||||
translate([10, 105])
|
||||
pin_socket(pin_headers[$i], 3, 3, right_angle = true);
|
||||
}
|
||||
|
||||
translate([-20, 0])
|
||||
jst_xh_header(jst_xh_header, 5);
|
||||
|
||||
translate([-20, 20])
|
||||
jst_xh_header(jst_xh_header, 5, true);
|
||||
}
|
||||
|
||||
if($preview)
|
||||
pin_headers();
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 144 KiB |
|
@ -915,7 +915,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
|
|||
function param(n, default = 0) = len(comp) > n ? comp[n] : default;
|
||||
rotate(comp.z) {
|
||||
// Components that have a cutout parameter go in this section
|
||||
if(show(comp, "2p54header")) pin_header(2p54header, comp[4], comp[5], param(6, false), false, cutouts, colour = param(7, undef));
|
||||
if(show(comp, "2p54header")) pin_header(2p54header, comp[4], comp[5], param(6, false), param(8, false), cutouts, colour = param(7, undef));
|
||||
if(show(comp, "2p54boxhdr")) box_header(2p54header, comp[4], comp[5], param(6, false), cutouts);
|
||||
if(show(comp, "2p54socket")) pin_socket(2p54header, comp[4], comp[5], param(6, false), param(7, 0), param(8, false), cutouts, param(9, undef));
|
||||
if(show(comp, "chip")) chip(comp[4], comp[5], comp[6], param(7, grey(30)), cutouts);
|
||||
|
|
|
@ -58,18 +58,20 @@ module pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cu
|
|||
|
||||
translate_z(smt ? 3.5 - h : 0) {
|
||||
for(x = [0 : cols - 1], y = [0 : rows - 1]) {
|
||||
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), 0])
|
||||
// Vertical part of the pin
|
||||
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2)])
|
||||
if(right_angle)
|
||||
pin(type, hdr_pin_below(type) + width / 2 + (y - 0.5) * pitch);
|
||||
pin(type, hdr_pin_below(type) + (y + 0.5) * pitch);
|
||||
else
|
||||
pin(type);
|
||||
|
||||
if(right_angle) {
|
||||
w = hdr_pin_width(type);
|
||||
// Horizontal part of the pin
|
||||
rotate([-90, 0, 180])
|
||||
translate([pitch * (x - (cols - 1) / 2), -pitch * (y - (rows - 1) / 2) -width / 2, hdr_pin_below(type) - (y - 0.5) * pitch])
|
||||
translate([pitch * (x - (cols - 1) / 2), -pitch * (y - (rows - 1) / 2) - width / 2, hdr_pin_below(type) - (y - (rows - 1) / 2) * pitch])
|
||||
pin(type, hdr_pin_length(type) - hdr_pin_below(type) + ra_offset + pitch / 2 + (y - 0.5) * pitch);
|
||||
|
||||
// corner
|
||||
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2) - w / 2, pitch * (y - (rows - 1) / 2) + width / 2 - w / 2])
|
||||
rotate([0, -90, 0])
|
||||
color(hdr_pin_colour(type))
|
||||
|
@ -78,7 +80,8 @@ module pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cu
|
|||
square(w);
|
||||
}
|
||||
}
|
||||
translate([0, right_angle ? -ra_offset - pitch / 2 : 0, right_angle ? width / 2 : 0])
|
||||
// Insulator
|
||||
translate([0, right_angle ? -ra_offset - (rows - 1) * pitch / 2 : 0, right_angle ? width / 2 : 0])
|
||||
rotate([right_angle ? 90 : 0, 0, 0])
|
||||
color(base_colour)
|
||||
linear_extrude(h)
|
||||
|
@ -176,7 +179,7 @@ module pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt
|
|||
vitamin(str("pin_socket(", type[0], ", ", cols, ", ", rows, arg(right_angle, false, "right_angle"), arg(height, 0, "height"), arg(smt, false, "smt"),
|
||||
"): Pin socket ", cols, " x ", rows, right_angle ? " right_angle" : ""));
|
||||
color(base_colour)
|
||||
translate([0, right_angle ? -ra_offset - pitch / 2 : 0, right_angle ? width / 2 : 0])
|
||||
translate([0, right_angle ? -ra_offset - (rows - 1) * pitch / 2 : 0, right_angle ? width / 2 : 0])
|
||||
rotate([right_angle ? 90 : 0, 0, 0])
|
||||
translate_z(depth / 2)
|
||||
linear_extrude(depth, center = true)
|
||||
|
@ -192,11 +195,11 @@ module pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt
|
|||
for(x = [0 : cols - 1], y = [0 : rows -1]) {
|
||||
if(!smt)
|
||||
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), 0])
|
||||
pin(type, hdr_pin_below(type) + width / 2 + (y - 0.5) * pitch);
|
||||
pin(type, hdr_pin_below(type) + (y + 0.5) * pitch);
|
||||
|
||||
if(right_angle) {
|
||||
rotate([-90, 0, 0])
|
||||
translate([pitch * (x - (cols - 1) / 2), -pitch * (y - (rows - 1) / 2) -width / 2, 0])
|
||||
rotate([-90, 0, 180])
|
||||
translate([pitch * (x - (cols - 1) / 2), -pitch * (y - (rows - 1) / 2) - width / 2, hdr_pin_below(type) - (y - (rows - 1) / 2) * pitch])
|
||||
pin(type, hdr_pin_below(type) + (y - 0.5) * pitch);
|
||||
|
||||
w = hdr_pin_width(type);
|
||||
|
@ -210,7 +213,7 @@ module pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt
|
|||
}
|
||||
}
|
||||
|
||||
module jst_xh_header(type, pin_count, right_angle=false, colour, pin_colour) { //! Draw JST XH connector
|
||||
module jst_xh_header(type, pin_count, right_angle = false, colour = false, pin_colour = false) { //! Draw JST XH connector
|
||||
colour = colour ? colour : hdr_base_colour(type);
|
||||
pin_colour = pin_colour ? pin_colour : hdr_pin_colour(type);
|
||||
sizeY = 5.75;
|
||||
|
|
|
@ -17,15 +17,15 @@
|
|||
// If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
// p p b p p b Socket depth
|
||||
// i i e i i a
|
||||
// t n l n n s
|
||||
// c o e
|
||||
// h l w w c
|
||||
// c
|
||||
// p p b p p b Socket depth
|
||||
// i i e i i a
|
||||
// t n l n n s
|
||||
// c o e
|
||||
// h l w w c
|
||||
// c
|
||||
//
|
||||
2p54header = ["2p54header", 2.54, 11.6, 3.2, 0.66, "gold", grey(20), 8.5];
|
||||
jst_xh_header = ["JST XH header",2.5,10,3.4, 0.64, "gold", grey(90), 7];
|
||||
2p54header = ["2p54header", 2.54, 11.6, 3.2, 0.66, "gold", grey(20), 8.5];
|
||||
jst_xh_header = ["JST XH header",2.5, 10, 3.4, 0.64, "gold", grey(90), 7];
|
||||
|
||||
pin_headers = [ 2p54header ];
|
||||
|
||||
|
|
Loading…
Reference in New Issue