units:
  kx: cx
  ky: cy
  px: 2
  py: 2
  step: .5

points:
  zones:
    matrix:
      columns:
        pinky:
          key:
            column_net: P21
            mirror: { column_net: P2 }
        ring:
          key:
            stagger: 4
            spread: kx + step
            column_net: P20
            mirror: { column_net: P3 }
        middle:
          key:
            stagger: 5
            spread: kx + step
            column_net: P19
            mirror: { column_net: P4 }
        index:
          key:
            stagger: -5
            spread: kx + step
            column_net: P18
            mirror: { column_net: P5 }
        inner:
          key:
            stagger: -6
            spread: kx + step
            column_net: P15
            mirror: { column_net: P6 }
        thumb:
          rows:
            bottom:
              skip: false
          key:
            skip: true
            spread: kx + step
            stagger: 10
            column_net: P14
            mirror: { column_net: P7 }
      rows:
        bottom:
          row_net: P16
        home:
          spread: ky + step
          row_net: P10
        top:
          spread: ky + step
          row_net: P9
        num:
          spread: ky + step
          row_net: P8

  rotate: -23
  mirror:
    ref: matrix_thumb_bottom
    distance: 42

outlines:
  # outer border
  outer:
    - what: polygon
      points:
        - ref: matrix_inner_num
          shift: [10, 10]
        - ref: matrix_middle_num
          shift: [10, 10]
        - ref: matrix_middle_num
          shift: [-10, 10]
        - ref: matrix_pinky_num
          shift: [-10, 10]
        - ref: matrix_pinky_bottom
          shift: [-10, -10]
        - ref: matrix_pinky_bottom
          shift: [10, -10]
        - ref: matrix_inner_bottom
          shift: [-10, -10]
        - ref: matrix_inner_bottom
          shift: [10, -10]
        - ref: mirror_matrix_inner_bottom
          shift: [10, -10]
        - ref: mirror_matrix_inner_bottom
          shift: [-10, -10]
        - ref: mirror_matrix_pinky_bottom
          shift: [10, -10]
        - ref: mirror_matrix_pinky_bottom
          shift: [-10, -10]
        - ref: mirror_matrix_pinky_num
          shift: [-10, 10]
        - ref: mirror_matrix_middle_num
          shift: [-10, 10]
        - ref: mirror_matrix_middle_num
          shift: [10, 10]
        - ref: mirror_matrix_inner_num
          shift: [10, 10]

  # chip
  chip:
    - what: rectangle
      size: [18, 50]
      where:
        ref:
          aggregate.parts:
            - matrix_inner_bottom
            - mirror_matrix_inner_bottom
        shift: [0, 0]

  # 14mm holes for cherry switches
  keyholes:
    - what: rectangle
      where: true
      asym: source
      size: 13.5

  # keycaps
  keycaps:
    - what: rectangle
      where: true
      asym: source
      size: [17.95, 17.5]

  # switchplate
  switchplate:
    - outer
    - -keyholes
    - -chip

pcbs:
  main:
    outlines:
      outer:
        outline: outer

    footprints:
      keys:
        what: choc
        where: true
        params:
          from: "{{colrow}}"
          to: "{{column_net}}"
          keycaps: true
          hotswap: true
      #led:
      #  what: rgb
      #  where: true
      #  adjust:
      #    shift: [0, -5]
      #  params:
      #    din: "{{label}}"
      #    dout: P02
      diode:
        what: diode
        where: true
        params:
          from: "{{colrow}}"
          to: "{{row_net}}"
        adjust:
          shift: [-8, -0]
          rotate: 90
      reset:
        what: button
        params:
          from: RST
          to: GND
        where:
          ref:
            aggregate.parts:
              - matrix_inner_bottom
              - mirror_matrix_inner_bottom
          rotate: 90
      mcu:
        what: promicro
        where:
          rotate: 270
          ref:
            aggregate.parts:
              - matrix_inner_bottom
              - mirror_matrix_inner_bottom
          shift: [0, -4]
