#NEWLINE# def pin_centres( conf ) : #NEWLINE# #INDENT# '\n    Compute the locations of pin centres, (x, y).\n    Generates centres for a 4-row chip, just ignore top/bottom rows if 2 rows.\n    Returns (leftrow, bottomrow, rightrow, toprow).\n    ' #NEWLINE# pins_per_row = ( conf [ 'pins' ] // conf [ 'rows' ] ) #NEWLINE# row_length = ( ( pins_per_row - 1 ) * conf [ 'pin_pitch' ] ) #NEWLINE# left_row = [ ] #NEWLINE# bottom_row = [ ] #NEWLINE# right_row = [ ] #NEWLINE# top_row = [ ] #NEWLINE# x = ( conf [ 'row_pitch' ] / 2.0 ) #NEWLINE# y = ( ( - row_length ) / 2.0 ) #NEWLINE# for pin in range ( pins_per_row ) : #NEWLINE# #INDENT# left_row . append ( ( ( - x ) , y ) ) #NEWLINE# right_row . insert ( 0 , ( top_row , y ) ) #NEWLINE# top_row . insert ( 0 , ( y , ( - x ) ) ) #NEWLINE# bottom_row . append ( ( y , x ) ) #NEWLINE# y += conf [ 'pin_pitch' ] #NEWLINE# #UNINDENT# return ( left_row , bottom_row , right_row , top_row )