/* MACHINE-GENERATED ! */

frame pad {
	set px = (dx*X1+dy*Y1)/2

	set py = (dy*X1+dx*Y1)/2

	set pin = side*pins/4+i+1

	__0: vec @(px, py)
	__1: vec @(-px, -py)
	pad "$pin" __0 .
}

frame side {
	set pos = i-(pins/4-1)/2

	loop i = 0, pins/4-1

	__0: vec @(e*pos*dx, e*pos*dy)
	frame pad .
}

frame pads {
	table
	    { side, dx, dy }
	    { 0, 0, -1 }
	    { 1, 1, 0 }
	    { 2, 0, 1 }
	    { 3, -1, 0 }

	__0: vec @(dy*C1/2, -dx*C2/2)
	frame side .
}

frame index {
}

frame outline {
	set mx = D1/2

	set my = E1/2

	set cf = 0.8

	set rf = (1-cf)/2

	set r = mx*rf

	__0: vec @(mx, my)
	__1: vec @(-mx, -my)
	rect . __0 w
	__2: vec @(-mx*cf, my*cf)
	__3: vec .(0mm, r)
	circ __2 . w
}

package "$name"
unit mm

table
    { name, pins, X1, Y1, e, C1, C2, D1, E1 }
    { "LQFP32", 32, 0.55mm, 1.3mm, 0.8mm, 8.45mm, 8.45mm, 7mm, 7mm }

set X2 = X1+(pins/4-1)*E

set Y2 = X2

set w = 5mil

frame pads @
frame outline @
measy pad.__1 -> pad.__0 1mm
