meta:
  engine: 4.0.5
  author: zoriya
  name: abyss
units:
  kx: cx
  ky: cy
  px: 2
  py: 2

  # dont forget that choc v2 is essentially mx
  plate_thickness: 1.2 # choc: 1.2, mx: 1.5
  kcox: 13.8 # key cutout (choc: 13.8, mx: 14)
  kcoy: 13.8 # key cutout (choc: 13.8, mx: 14)
points:
  zones:
    matrix:
      # Fix placement on KiCAD sheet.
      anchor:
        shift: [100, -100]
      key:
        padding: 1ky
        spread: 1kx
      columns:
        pinky:
          key.column_net: C1
          rows:
            top:
              skip: true
            home:
              row_net: R4
            bottom:
              column_net: C2
              row_net: R4
        ring:
          key.column_net: C1
          key.stagger: ky/2
        middle:
          key.column_net: C2
          key.stagger: ky/4
        index:
          key.column_net: C3
          key.stagger: -ky/2
        inner:
          key.column_net: C4
          key.stagger: ky/2
          rows:
            top:
              skip: true
            home:
              row_net: R1
            bottom:
              row_net: R2
      rows:
        bottom:
          row_net: R3
        home:
          row_net: R2
        top:
          row_net: R1
    thumb:
      key:
        padding: 1ky
        spread: 1kx
      anchor:
        ref: matrix_index_bottom
        shift: [-0.5kx, -1.25ky]
      columns:
        left:
          key.column_net: C3
          key.row_net: R4
        home:
          key.column_net: C4
          key.row_net: R4
        right:
          key.column_net: C4
          key.row_net: R3
          key.splay: -7
          key.spread: (kx+ky)/2
          key.origin: [-0.5ky, -0.5kx]
          key.width: 1.5kx
          key.rotate: 90
      rows:
        cluster: {}
outlines:
  raw:
    - what: rectangle
      where: true
      bound: false
      size: [kx + px, ky + py]
    - what: rectangle
      where: thumb_right_cluster
      bound: false
      size: [1.5kx + px, ky + py]
  keys:
    - what: rectangle
      where: true
      bound: false
      size: [kx - 0.5, ky - 0.5]
    - what: rectangle
      where: thumb_right_cluster
      bound: false
      size: [1.5kx - 0.5, ky - 0.5]
  board:
    - what: polygon
      operation: stack
      points:
        - ref: matrix_middle_top
          shift: [-2.5kx - px, 0.5ky + py]
        - ref: matrix_middle_top
          shift: [0.5kx + px, 0.5ky + py]
        - ref: matrix_middle_top
          shift: [2.5kx + px, 0.5ky + py]
        - ref: thumb_left_cluster
          shift: [2kx + px, 0.75kx + py - 0.5]
        - ref: thumb_left_cluster
          # 3.29 is sin(7deg)*1.5kx
          shift: [2kx + .5ky + px + 2, 0.75kx + px - 0.5]
        - ref: thumb_left_cluster
          # 2.07 is sin(7deg)*ky
          shift: [2kx + .5ky + px + 2, -0.75kx - py - 2]
        - ref: thumb_left_cluster
          shift: [-0.5kx - px, -0.75kx - py - 2]
        - ref: matrix_pinky_bottom
          shift: [2kx - px, -0.5ky - py]
        - ref: matrix_pinky_bottom
          shift: [-0.5kx - px, -0.5ky - py]
  plate_keys:
    - what: rectangle
      where: true
      bound: false
      size: [kcox, kcoy]
  combo:
    - name: board
    - operation: stack
      name: keys
pcbs:
  abyss:
    outlines:
      main:
        outline: board
    footprints:
      choc_hotswap:
        what: choc
        where: true
        params:
          keycaps: true
          reverse: true
          hotswap: true
          from: "{{column_net}}"
          to: "{{colrow}}"
      diode:
        what: diode
        where: true
        params:
          from: "{{colrow}}"
          to: "{{row_net}}"
        adjust:
          shift: [0, -5]

      battery_connector:
        what: ceoloide/battery_connector_jst_ph_2
        params:
          BAT_P: BAT_P
          BAT_N: GND
          reversible: true
          include_courtyard: false
        where:
          ref: matrix_inner_home
          shift: [0, 0.75ky]
          rotate: -90
