From 8e5633a660e756cc3fe1b61fa79e40d480f13f7d Mon Sep 17 00:00:00 2001 From: Jochen Vothknecht <jochen3120@gmail.com> Date: Thu, 6 May 2021 20:50:58 +0200 Subject: [PATCH] Add ESP32_HexProg system --- TripwireHook.lib | 94 ++++++++++++++++----- TripwireHook.pretty/ESP32_HexProg.kicad_mod | 85 +++++++++++++++++++ scripting/hexGrid.py | 47 +++++++++++ 3 files changed, 204 insertions(+), 22 deletions(-) create mode 100644 TripwireHook.pretty/ESP32_HexProg.kicad_mod create mode 100755 scripting/hexGrid.py diff --git a/TripwireHook.lib b/TripwireHook.lib index f1a8f0e..dd71014 100644 --- a/TripwireHook.lib +++ b/TripwireHook.lib @@ -163,6 +163,28 @@ X SW 6 350 0 100 L 50 50 1 1 O ENDDRAW ENDDEF # +# D_TVS_UNI +# +DEF D_TVS_UNI D 0 40 N N 1 F N +F0 "D" 0 100 50 H V C CNN +F1 "D_TVS_UNI" 0 -100 50 H V C CNN +F2 "" 0 0 50 H I C CNN +F3 "" 0 0 50 H I C CNN +$FPLIST + TO-???* + *_Diode_* + *SingleDiode* + D_* +$ENDFPLIST +DRAW +P 2 0 1 0 50 0 -50 0 N +P 4 0 1 10 -30 50 -50 50 -50 -50 -70 -50 N +P 4 0 1 10 50 50 50 -50 -50 0 50 50 N +X A1 1 -150 0 100 R 50 50 1 1 P +X A2 2 150 0 100 L 50 50 1 1 P +ENDDRAW +ENDDEF +# # EP4CE6E22 # DEF EP4CE6E22 U 0 40 Y Y 9 L N @@ -444,6 +466,56 @@ X MSEL2 97 3200 -950 100 R 50 50 9 1 I ENDDRAW ENDDEF # +# ESP32_HexProg +# +DEF ESP32_HexProg U 0 40 Y Y 1 F N +F0 "U" -200 250 50 H V C CNN +F1 "ESP32_HexProg" 400 250 50 H V C CNN +F2 "TripwireHook:ESP32_HexProg" 100 -300 50 H I C CNN +F3 "" 0 100 50 H I C CNN +DRAW +S -50 50 50 -50 0 1 0 F +S -45 50 45 80 0 1 0 N +P 2 0 1 0 -50 -45 -55 -45 N +P 2 0 1 0 -50 -35 -55 -35 N +P 2 0 1 0 -50 -25 -55 -25 N +P 2 0 1 0 -50 -15 -55 -15 N +P 2 0 1 0 -50 -5 -55 -5 N +P 2 0 1 0 -50 5 -55 5 N +P 2 0 1 0 -50 15 -55 15 N +P 2 0 1 0 -50 25 -55 25 N +P 2 0 1 0 -50 35 -55 35 N +P 2 0 1 0 -50 45 -55 45 N +P 2 0 1 0 -35 -50 -35 -55 N +P 2 0 1 0 -25 -50 -25 -55 N +P 2 0 1 0 -15 -50 -15 -55 N +P 2 0 1 0 -5 -50 -5 -55 N +P 2 0 1 0 5 -50 5 -55 N +P 2 0 1 0 15 -50 15 -55 N +P 2 0 1 0 25 -50 25 -55 N +P 2 0 1 0 35 -50 35 -55 N +P 4 0 1 0 20 50 20 70 30 70 30 50 N +P 7 0 1 0 -150 100 0 250 150 100 150 -100 0 -250 -150 -100 -150 100 f +P 11 0 1 0 20 70 10 70 10 60 0 60 0 70 -10 70 -10 60 -20 60 -20 70 -30 70 -30 60 N +P 2 1 1 0 55 -45 50 -45 N +P 2 1 1 0 55 -35 50 -35 N +P 2 1 1 0 55 -25 50 -25 N +P 2 1 1 0 55 -15 50 -15 N +P 2 1 1 0 55 -5 50 -5 N +P 2 1 1 0 55 5 50 5 N +P 2 1 1 0 55 15 50 15 N +P 2 1 1 0 55 25 50 25 N +P 2 1 1 0 55 35 50 35 N +P 2 1 1 0 55 45 50 45 N +X ~ 3V3 0 -400 150 U 50 50 1 1 I +X ~ GND 0 400 150 D 50 50 1 1 I +X ~ RX -300 -100 150 R 50 50 1 1 I +X ~ TX -300 100 150 R 50 50 1 1 I +X ~ ~PROG 300 -100 150 L 31 50 1 1 I +X ~ ~RESET 300 100 150 L 31 50 1 1 I +ENDDRAW +ENDDEF +# # HPDL-1414 # DEF HPDL-1414 U 0 40 Y Y 1 F N @@ -695,26 +767,4 @@ X DIN 4 -300 0 100 R 50 50 1 1 I ENDDRAW ENDDEF # -# D_TVS_UNI -# -DEF D_TVS_UNI D 0 40 N N 1 F N -F0 "D" 0 100 50 H V C CNN -F1 "D_TVS_UNI" 0 -100 50 H V C CNN -F2 "" 0 0 50 H I C CNN -F3 "" 0 0 50 H I C CNN -$FPLIST - TO-???* - *_Diode_* - *SingleDiode* - D_* -$ENDFPLIST -DRAW -P 2 0 1 0 50 0 -50 0 N -P 4 0 1 10 -30 50 -50 50 -50 -50 -70 -50 N -P 4 0 1 10 50 50 50 -50 -50 0 50 50 N -X A1 1 -150 0 100 R 50 50 1 1 P -X A2 2 150 0 100 L 50 50 1 1 P -ENDDRAW -ENDDEF -# #End Library diff --git a/TripwireHook.pretty/ESP32_HexProg.kicad_mod b/TripwireHook.pretty/ESP32_HexProg.kicad_mod new file mode 100644 index 0000000..d5346fa --- /dev/null +++ b/TripwireHook.pretty/ESP32_HexProg.kicad_mod @@ -0,0 +1,85 @@ +(module ESP32_HexProg (layer F.Cu) (tedit 60943A15) + (fp_text reference REF** (at 0 -4) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_text value ESP32_HexProg (at 0 4) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_poly (pts (xy 1.09 -2.08) (xy 0.54 -1.14) (xy -0.54 -1.14) (xy -1.08 -2.08) + (xy -0.54 -3.02) (xy 0.55 -3.02)) (layer F.SilkS) (width 0.6)) + (fp_line (start -1.25 -1.98) (end -2.34 -1.98) (layer F.SilkS) (width 0.4)) + (fp_line (start 1.25 -1.98) (end 2.34 -1.98) (layer F.SilkS) (width 0.4)) + (fp_line (start -2.34 -1.98) (end -2.88 -1.04) (layer Dwgs.User) (width 0.12)) + (fp_line (start -2.88 -1.04) (end -2.34 -0.1) (layer Dwgs.User) (width 0.12)) + (fp_line (start -2.34 -0.1) (end -2.34 0.1) (layer Dwgs.User) (width 0.12)) + (fp_line (start -2.34 0.1) (end -2.88 1.04) (layer Dwgs.User) (width 0.12)) + (fp_line (start -2.88 1.04) (end -2.34 1.98) (layer Dwgs.User) (width 0.12)) + (fp_line (start -2.34 1.98) (end -1.26 1.98) (layer Dwgs.User) (width 0.12)) + (fp_line (start -1.26 1.98) (end -1.08 2.08) (layer Dwgs.User) (width 0.12)) + (fp_line (start -1.08 2.08) (end -0.54 3.02) (layer Dwgs.User) (width 0.12)) + (fp_line (start -0.54 3.02) (end 0.54 3.02) (layer Dwgs.User) (width 0.12)) + (fp_line (start 0.54 3.02) (end 1.08 2.08) (layer Dwgs.User) (width 0.12)) + (fp_line (start 1.08 2.08) (end 1.26 1.98) (layer Dwgs.User) (width 0.12)) + (fp_line (start 1.26 1.98) (end 2.34 1.98) (layer Dwgs.User) (width 0.12)) + (fp_line (start 2.35 -1.98) (end 2.89 -1.04) (layer Dwgs.User) (width 0.12)) + (fp_line (start 2.89 -1.04) (end 2.34 -0.1) (layer Dwgs.User) (width 0.12)) + (fp_line (start 2.34 -0.1) (end 2.34 0.1) (layer Dwgs.User) (width 0.12)) + (fp_line (start 2.34 0.1) (end 2.89 1.04) (layer Dwgs.User) (width 0.12)) + (fp_line (start 2.89 1.04) (end 2.34 1.98) (layer Dwgs.User) (width 0.12)) + (pad 3V3 smd custom (at 0 2.08 30) (size 1.5 1.5) (layers F.Cu F.Paste F.Mask) + (zone_connect 0) + (options (clearance outline) (anchor circle)) + (primitives + (gr_poly (pts + (xy 0.94 -0.54) (xy 0.94 0.54) (xy 0 1.08) (xy -0.93 0.54) (xy -0.93 -0.54) + (xy 0 -1.08)) (width 0.01)) + )) + (pad TX smd custom (at -1.8 -1.04 30) (size 1.5 1.5) (layers F.Cu F.Paste F.Mask) + (zone_connect 0) + (options (clearance outline) (anchor circle)) + (primitives + (gr_poly (pts + (xy 0.94 -0.54) (xy 0.94 0.54) (xy 0 1.08) (xy -0.93 0.54) (xy -0.93 -0.54) + (xy 0 -1.08)) (width 0.01)) + )) + (pad RX smd custom (at -1.8 1.04 30) (size 1.5 1.5) (layers F.Cu F.Paste F.Mask) + (zone_connect 0) + (options (clearance outline) (anchor circle)) + (primitives + (gr_poly (pts + (xy 0.94 -0.54) (xy 0.94 0.54) (xy 0 1.08) (xy -0.93 0.54) (xy -0.93 -0.54) + (xy 0 -1.08)) (width 0.01)) + )) + (pad ~RESET smd custom (at 1.8 -1.04 30) (size 1.5 1.5) (layers F.Cu F.Paste F.Mask) + (zone_connect 0) + (options (clearance outline) (anchor circle)) + (primitives + (gr_poly (pts + (xy 0.94 -0.54) (xy 0.94 0.54) (xy 0 1.08) (xy -0.93 0.54) (xy -0.93 -0.54) + (xy 0 -1.08)) (width 0.01)) + )) + (pad GND smd custom (at 0 -2.08 30) (size 1.5 1.5) (layers F.Cu F.Paste F.Mask) + (zone_connect 0) + (options (clearance outline) (anchor circle)) + (primitives + (gr_poly (pts + (xy 0.94 -0.54) (xy 0.94 0.54) (xy 0 1.08) (xy -0.93 0.54) (xy -0.93 -0.54) + (xy 0 -1.08)) (width 0.01)) + )) + (pad ~PROG smd custom (at 1.8 1.04 30) (size 1.5 1.5) (layers F.Cu F.Paste F.Mask) + (zone_connect 0) + (options (clearance outline) (anchor circle)) + (primitives + (gr_poly (pts + (xy 0.94 -0.54) (xy 0.94 0.54) (xy 0 1.08) (xy -0.93 0.54) (xy -0.93 -0.54) + (xy 0 -1.08)) (width 0.01)) + )) + (pad GND smd custom (at 0 0 30) (size 1.5 1.5) (layers F.Cu F.Paste F.Mask) + (zone_connect 0) + (options (clearance outline) (anchor circle)) + (primitives + (gr_poly (pts + (xy 0.94 -0.54) (xy 0.94 0.54) (xy 0 1.08) (xy -0.93 0.54) (xy -0.93 -0.54) + (xy 0 -1.08)) (width 0.01)) + )) +) diff --git a/scripting/hexGrid.py b/scripting/hexGrid.py new file mode 100755 index 0000000..84e6bf9 --- /dev/null +++ b/scripting/hexGrid.py @@ -0,0 +1,47 @@ +#!/usr/bin/env nix-shell +#!nix-shell -p python3 -i python --pure + +from math import * + + +# pointy top +def hex_to_pixel(hex_x, hex_y, size=1.2): + x = size * (sqrt(3) * hex_x + sqrt(3)/2 * hex_y) + y = size * ( 3/2 * hex_y) + + return (x, y) + +# flat top +def hex_to_pixel2(hex_x, hex_y, size=1.2): + x = size * ( 3/2 * hex_x ) + y = size * (sqrt(3)/2 * hex_x + sqrt(3) * hex_y) + + return (x, y) + + +def iter_print(hexList, f=hex_to_pixel): + for hex in hexList: + pixel = f(*hex) + + hex_str = '({: d}, {: d})'.format(hex[0], hex[1]) + pixel_str = '({: .2f}, {: .2f})'.format(pixel[0], pixel[1]) + + print('{0} -> {1}'.format(hex_str, pixel_str)) + + +if __name__ == '__main__': + hexList = [ + ( 0, 0), + ( 0, 1), + ( 1, 0), + ( 0, -1), + (-1, 0), + ( 1, 1), + (-1, -1), + + ( 0, -2), + ( 1, -2), + (-1, -2), + ] + + iter_print(hexList, hex_to_pixel2) -- GitLab