Compare commits

...

13 Commits
v0.1.0 ... main

Author SHA1 Message Date
cyteen fc087a132d Post treesitter save.
Build / Generate (push) Failing after 16m56s Details
No changes other than those made by treesitter in neovim.
2024-07-09 16:40:06 +01:00
Leo B 2095e7e80d
Fix pcbdraw/kikit calls (#29) 2024-02-10 19:49:31 +01:00
Oleg Kostyuk d5f78f63a1
Update README.md (#26) 2023-11-10 16:12:32 +01:00
Leo B 2db6ef659c Remove reference about the extra pins from the readme 2023-11-08 13:49:06 +01:00
Leo B 9c745f8c8c Remove duplicate build script and clean up Readme 2023-08-21 17:31:25 +02:00
Leo B 571c693253
Upgrade to Ergogen v4 (#25)
* Upgrade to Ergogen v4 and its new positioning / offset rules
* Make Samoklava a "bundle" that includes all of its custom footprints
2023-08-21 17:24:54 +02:00
Leo B fc3018e56b
Use 24-pin promicro footprint; unifomly align sliders (#23) 2022-08-28 15:01:08 +02:00
Leo B 4a574acd9e Update readme 2022-08-17 16:21:12 +02:00
Leo B f4b2a6f74f Revert "Add warning"
This reverts commit 66e57baf39.
2022-01-06 23:49:41 +01:00
Leo B 66e57baf39 Add warning 2022-01-06 23:44:41 +01:00
Leo B 93ac79ab2b Update board renders 2022-01-06 23:40:13 +01:00
Leo Batyuk e0fc722061
Add MIT license (#14)
Co-authored-by: Leo B <leo.the.soundmonster@gmail.com>
2022-01-06 23:38:51 +01:00
Leo Batyuk 89d18255f5
Update to ergogen 3.1.0 (#13)
Co-authored-by: Leo B <leo.the.soundmonster@gmail.com>
2022-01-06 23:38:00 +01:00
14 changed files with 1620 additions and 1955 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 The Samoklava project
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -10,7 +10,7 @@ setup:
npm install
# outputs from
output/pcbs/board.kicad_pcb output/pcbs/top_plate.kicad_pcb output/pcbs/bottom_plate.kicad_pcb &: samoklava.yaml
output/pcbs/board.kicad_pcb output/pcbs/top_plate.kicad_pcb output/pcbs/bottom_plate.kicad_pcb &: config.yaml
npm run gen
output/pcbs/%.dsn: output/pcbs/%.kicad_pcb
@ -34,15 +34,15 @@ output/routed_pcbs/%-drc/: output/routed_pcbs/%.kicad_pcb
output/routed_pcbs/%-front.png: output/routed_pcbs/%.kicad_pcb
mkdir -p $(shell dirname $@)
${container_cmd} run ${container_args} yaqwsx/kikit:v0.7 pcbdraw --style builtin:oshpark-afterdark.json $< $@
${container_cmd} run ${container_args} --entrypoint /usr/local/bin/pcbdraw yaqwsx/kikit:v1.3.0 plot --side front --style oshpark-afterdark $< $@
output/routed_pcbs/%-back.png: output/routed_pcbs/%.kicad_pcb
mkdir -p $(shell dirname $@)
${container_cmd} run ${container_args} yaqwsx/kikit:v0.7 pcbdraw -b --style builtin:oshpark-afterdark.json $< $@
${container_cmd} run ${container_args} --entrypoint /usr/local/bin/pcbdraw yaqwsx/kikit:v1.3.0 plot --side back --style oshpark-afterdark $< $@
output/gerbers/%/gerbers.zip: output/routed_pcbs/%.kicad_pcb
mkdir -p $(shell dirname $@)
${container_cmd} run ${container_args} yaqwsx/kikit:v0.7 kikit fab jlcpcb --no-assembly $< $(shell dirname $@)
${container_cmd} run ${container_args} yaqwsx/kikit:v1.3.0 fab jlcpcb --no-drc --no-assembly $< $(shell dirname $@)
clean:
rm -rf output

View File

@ -1,23 +1,32 @@
# samoklava
## An autogenerated split 36 key keyboard
## Disclaimer
This is an early experimental prototype. Please do not rely on the autogenerated files and double check them manually
before sending them off to a PCB fab. The author and other random strangers on the internet have been able to produce
working keyboard prototypes from this repo; this does not mean that everything will work every time.
The author(s) waive(s) responsibility for any damage or regulatory violations caused by using this software (see
license). Please consult your local regulations around radio frequencies and what's allowed for DIY projects in your
country.
left | right
-|-
![left](images/board-front.png) | ![right](images/board-back.png)
A 5x3 split keyboard with 3 thumbs. There is nothing unique about the keyboard layout. It's inspired by Corne and Kyria, and
has the exact number of keys needed for the [Miryoku](https://github.com/manna-harbour/miryoku) layout.
A 5x3 split keyboard with 3 thumb keys. There is nothing unique about the keyboard layout. It's inspired by Corne and
Kyria, and has the exact number of keys needed for the [Miryoku](https://github.com/manna-harbour/miryoku) layout.
The interesting thing about this keyboard is that it's a declarative design ("samoklava" can be loosely translated as
"keyboard that assembles itself" from Russian).
* Layout is declared using [Ergogen](https://github.com/mrzealot/ergogen/)
The interesting thing about this keyboard is that it's a declarative design:
* Layout is declared using [Ergogen](https://github.com/mrzealot/ergogen/). New: no fork needed!
* The build system uses Ergogen to translate YAML to a KiCad PCB and plate files for FR-4 fab or laser cutting
* uses [kicad-automation-scripts](https://github.com/productize/kicad-automation-scripts) and [FreeRouting](https://github.com/freerouting/freerouting) to **automatically route the traces on the PCB**
* uses [KiKit](https://github.com/yaqwsx/KiKit) to render PCB previews (see top of this file) and production-ready **Gerber files**
## Features
* Extra pins and a slider switch for battery for wireless Promicro clones (tested with nice!nano); the slider can be
* A slider switch for battery for wireless Promicro clones (tested with nice!nano); the slider can be
shorted with a jumper if `CONFIG_ZMK_SLEEP` is preferred.
* Wired operation with QMK should be possible but is not tested; TRRS footprints are included and routed. The pinout is
identical with a five-column Corne sans the RGBLEDs.
@ -27,7 +36,7 @@ The interesting thing about this keyboard is that it's a declarative design ("sa
If you would like to modify this:
* fork it
* change `samoklava.yaml` to your liking
* change `config.yaml` to your liking
* push your changes; the `build.yml` GitHub Workflow will pick it up, autoroute and generate Gerbers, all in a zip file.
See https://github.com/soundmonster/samoklava/actions
* or:
@ -36,3 +45,4 @@ If you would like to modify this:
* check the `output` folder for KiCad PCBs and Gerbers
See the [workflow](.github/workflows/build.yml) or the [Makefile](Makefile) for more details.
See [my ZMK config](https://github.com/soundmonster/samoklava-zmk-config) for a suggested keymap.

View File

@ -1,17 +0,0 @@
#!/bin/sh
# container_cmd=podman
container_cmd=docker
container_args="-w /board -v $(pwd):/board --rm"
rm -rf output
npm run gen
${container_cmd} run ${container_args} soundmonster/kicad-automation-scripts:latest /usr/lib/python2.7/dist-packages/kicad-automation/pcbnew_automation/export_dsn.py output/pcbs/main.kicad_pcb output/pcbs/main.dsn
${container_cmd} run ${container_args} soundmonster/freerouting_cli:v0.1.0 java -jar /opt/freerouting_cli.jar -de output/pcbs/main.dsn -do output/pcbs/main.ses
${container_cmd} run ${container_args} soundmonster/kicad-automation-scripts:latest /usr/lib/python2.7/dist-packages/kicad-automation/pcbnew_automation/import_ses.py output/pcbs/main.kicad_pcb output/pcbs/main.ses --output-file output/pcbs/main-routed.kicad_pcb
${container_cmd} run ${container_args} soundmonster/kicad-automation-scripts:latest /usr/lib/python2.7/dist-packages/kicad-automation/pcbnew_automation/run_drc.py output/pcbs/main-routed.kicad_pcb output/pcbs/drc/
# pcbdraw also supports a style file as JSON
${container_cmd} run ${container_args} yaqwsx/kikit:v0.7 pcbdraw --style builtin:set-white-enig.json output/pcbs/main-routed.kicad_pcb images/left.png
${container_cmd} run ${container_args} yaqwsx/kikit:v0.7 pcbdraw -b --style builtin:set-white-enig.json output/pcbs/main-routed.kicad_pcb images/right.png
${container_cmd} run ${container_args} yaqwsx/kikit:v0.7 kikit fab jlcpcb --no-assembly output/pcbs/main-routed.kicad_pcb production/pcb/main

407
config.yaml Normal file
View File

@ -0,0 +1,407 @@
meta:
engine: 4.0.4
name: samoklava
version: 0.3
author: soundmonster
url: https://github.com/soundmonster/samoklava
units:
kx: cx
ky: cy
px: 2
py: 2
points:
key:
footprints:
choc_hotswap:
type: choc
params:
hotswap: true
reverse: true
keycaps: true
nets:
from: =colrow
to: =column_net
diode:
type: diode
nets:
from: =colrow
to: =row_net
anchor:
shift: [0, -5]
zones:
matrix:
key.padding: ky
columns:
pinky:
key:
stagger: 0 ky
spread: kx
column_net: col_pinky
ring:
key:
stagger: 0.7 ky
spread: kx
column_net: col_ring
middle:
key:
stagger: 0.2 ky
spread: kx
column_net: col_middle
index:
key:
stagger: -0.2 ky
spread: kx
column_net: col_index
inner:
key:
stagger: -0.1 ky
spread: kx
column_net: col_inner
rows:
bottom:
row_net: row_bottom
home:
row_net: row_home
top:
row_net: row_top
thumbfan:
anchor:
ref: matrix_inner_bottom
shift: [-0.5 kx, -1 ky]
columns:
near:
key:
spread: kx
splay: -15
origin: [-0.5 kx, -0.5 ky]
column_net: col_middle
home:
key:
spread: kx
splay: -15
origin: [-0.5 kx, -0.5 ky]
column_net: col_index
far:
key:
spread: kx
splay: -15
origin: [-0.5 kx, -0.5 ky]
column_net: col_inner
rows:
thumb:
row_net: row_thumb
outlines:
# board dimensions according to JLCPCB: 122.28 mm x 101.05 mm
raw:
- what: rectangle
where: true
asym: source
size: [kx + px, ky + py]
corner: px
thumbfan_glue:
- what: polygon
points:
- ref: matrix_inner_bottom
shift: [0.5 kx + 0.5px, -0.5 ky + 0.5 py]
- ref: thumbfan_far_thumb
shift: [0.5 kx - 0.5px, 0.5 ky + 0.5 py]
- ref: thumbfan_far_thumb
shift: [0.5 kx - 0.5px, -0.5 ky - 0.5 py]
- ref: thumbfan_near_thumb
shift: [-0.5 kx + 0.5 px, -0.5 ky - 0.5 py]
- ref: matrix_pinky_bottom
shift: [0.5 kx - 0.5 py, -0.5 ky - 0.5 py]
- ref: matrix_pinky_home
- ref: matrix_inner_home
patch_outer:
- what: polygon
points:
- ref: matrix_ring_top
- ref: matrix_ring_bottom
- ref: matrix_pinky_bottom
shift: [-0.5 (kx + px), 0]
- ref: matrix_pinky_top
shift: [-0.5 (kx + px), 0]
patch_inner:
- what: polygon
points:
- ref: matrix_inner_top
shift: [0.5 (kx + px), 0]
- ref: matrix_inner_bottom
shift: [0.5 (kx + px), 0]
- ref: matrix_index_bottom
- ref: matrix_index_top
controller_area:
- what: rectangle
where:
- ref: matrix_inner_top
# re-tranalte to new anchor position
shift: [32/2 + 0 kx, 76.5/2 - 4.05 ky]
size: [32, 76.5]
corner: px
switches:
- what: rectangle
where: true
asym: source
size: 14
keycaps:
- what: rectangle
where: true
asym: source
size: [kx, ky]
corner: 1
keywell:
- "raw"
- "+patch_inner"
- "+patch_outer"
- "+thumbfan_glue"
base_outline:
- "keywell"
- "+controller_area"
screw_holes:
top_left:
what: circle
where:
- ref: matrix_ring_home
shift: [-0.5 kx, 0 ky]
radius: 1.05
bottom_left:
what: circle
where:
- ref: matrix_pinky_bottom
shift: [0.5 kx, 0]
radius: 1.05
top_right:
what: circle
where:
- ref: matrix_inner_top
shift: [-0.5 kx, 0]
radius: 1.05
palm:
what: circle
where:
- ref: matrix_index_bottom
shift: [0, -1.06 ky]
radius: 1.05
thumb:
what: circle
where:
- ref: thumbfan_far_thumb
shift: [-0.55 kx, 0]
radius: 1.05
mounting_holes:
$extends: outlines.screw_holes
top_left:
radius: 2.05
bottom_left:
radius: 2.05
top_right:
radius: 2.05
palm:
radius: 2.05
thumb:
radius: 2.05
bottom_outline:
- "base_outline"
# TODO use footprints with pad + via reinforcement as mounting holes
- "-screw_holes"
plate:
- "keywell"
- "-switches"
- "-screw_holes"
pcb:
- "base_outline"
# TODO use footprints with pad + via reinforcement as mounting holes
- "-mounting_holes"
pcbs:
top_plate:
outlines:
edge:
outline: plate
layer: Edge.Cuts
footprints:
jlc_order_number:
what: text
where:
ref:
- matrix_ring_home
shift: [-0.25 kx, 0.5 ky]
params:
text: "JLCJLCJLCJLC"
justify: left
bottom_plate:
outlines:
edge:
outline: bottom_outline
layer: Edge.Cuts
board:
outlines:
edge:
outline: pcb
layer: Edge.Cuts
footprints:
choc_hotswap:
what: choc
where:
- /matrix_.*/
- /thumbfan_.*/
params:
hotswap: true
reverse: true
keycaps: true
from: "{{colrow}}"
to: "{{column_net}}"
diode:
what: diode
where:
- /matrix_.*/
- /thumbfan_.*/
adjust.shift: [0, -5]
params:
from: "{{colrow}}"
to: "{{row_net}}"
mcu_l:
what: promicro
where:
ref:
- matrix_inner_top
shift: [20, -11]
rotate: 270
params:
orientation: up
P4: row_top
P5: row_home
P6: row_bottom
P7: row_thumb
P14: col_inner
P15: col_index
P18: col_middle
P19: col_ring
P20: col_pinky
mcu_r:
what: promicro
where:
ref:
- matrix_inner_top
shift: [22.5, -12.25]
rotate: 270
params:
orientation: down
pad_plus:
what: pad
where:
ref:
- matrix_inner_top
shift: [23, -6]
rotate: 0
params:
front: true
back: true
width: 1.5
height: 1.5
text: "B+"
net: Bplus
pad_minus:
what: pad
where:
ref:
- matrix_inner_top
shift: [23, -3]
rotate: 0
params:
front: true
back: true
width: 1.5
height: 1.5
text: "B-"
net: GND
trrs:
what: trrs_tight
where:
ref:
- matrix_inner_bottom
shift: [32, -15]
rotate: 270
params:
reverse: true
symmetric: false
# The naming of the nets on this footprint is different from the Corne schematics.
A: ""
B: VCC
C: GND
D: P0
jumper_l:
what: jumper
where:
ref:
- matrix_inner_bottom
shift: [23.5, 0]
rotate: 270
params:
side: B
from: Bplus
to: RAW
jumper_r:
what: jumper
where:
ref:
- matrix_inner_bottom
shift: [23.5, 0]
rotate: 270
params:
side: F
from: Bplus
to: RAW
slider_l:
what: slider_threeway
where:
ref:
- matrix_inner_bottom
shift: [30, 0]
rotate: 270
params:
side: F
from: RAW
left: Bplus
right: ""
slider_r:
what: slider_threeway
where:
ref:
- matrix_inner_bottom
shift: [30, 0]
rotate: 270
params:
side: B
from: RAW
left: ""
right: Bplus
reset:
what: reset_button
where:
ref:
- matrix_inner_bottom
shift: [17, 0]
rotate: 270
params:
from: GND
to: RST
info_l:
what: text
where:
ref:
- matrix_pinky_bottom
shift: [0.75 kx, 0]
params:
text: "samoklava v0.3\\nby soundmonster"
justify: left
info_r:
what: text
where:
ref:
- matrix_pinky_bottom
shift: [0.75 kx, 0]
params:
layer: B.SilkS
text: "samoklava v0.3\\nby soundmonster"
justify: right mirror

View File

@ -0,0 +1,43 @@
module.exports = {
params: {
designator: 'B', // for Button
from: undefined,
to: undefined
},
body: p => {
// this footprint goes to both sides by default so it ignores the layer setting
return `
(module kbd:ResetSW (layer F.Cu) (tedit 5B9559E6) (tstamp 61905781)
(descr "Two pin through hole Tactile Switch, the same as on the Corne")
(tags "Tactile Switch")
${p.at /* parametric position */}
${'' /* footprint reference */}
(fp_text reference "${p.ref}" (at 0 2.55) (layer F.SilkS) ${p.ref_hide} (effects (font (size 1 1) (thickness 0.15))))
(fp_text value "" (at 0 -2.55) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15))))
${'' /* outline */}
(fp_text user RESET (at 0 0 ${p.rot}) (layer F.SilkS) (effects (font (size 1 1) (thickness 0.15))))
(fp_text user RESET (at 0.127 0 ${p.rot}) (layer B.SilkS) (effects (font (size 1 1) (thickness 0.15)) (justify mirror)))
(fp_line (start 3 1.5) (end 3 1.75) (layer B.SilkS) (width 0.15))
(fp_line (start 3 1.75) (end -3 1.75) (layer B.SilkS) (width 0.15))
(fp_line (start -3 1.75) (end -3 1.5) (layer B.SilkS) (width 0.15))
(fp_line (start -3 -1.5) (end -3 -1.75) (layer B.SilkS) (width 0.15))
(fp_line (start -3 -1.75) (end 3 -1.75) (layer B.SilkS) (width 0.15))
(fp_line (start 3 -1.75) (end 3 -1.5) (layer B.SilkS) (width 0.15))
(fp_line (start -3 1.75) (end 3 1.75) (layer F.SilkS) (width 0.15))
(fp_line (start 3 1.75) (end 3 1.5) (layer F.SilkS) (width 0.15))
(fp_line (start -3 1.75) (end -3 1.5) (layer F.SilkS) (width 0.15))
(fp_line (start -3 -1.75) (end -3 -1.5) (layer F.SilkS) (width 0.15))
(fp_line (start -3 -1.75) (end 3 -1.75) (layer F.SilkS) (width 0.15))
(fp_line (start 3 -1.75) (end 3 -1.5) (layer F.SilkS) (width 0.15))
${'' /* pins */}
(pad 2 thru_hole circle (at -3.25 0 ${p.rot}) (size 2 2) (drill 1.3) (layers *.Cu *.Mask F.SilkS) ${p.from.str})
(pad 1 thru_hole circle (at 3.25 0 ${p.rot}) (size 2 2) (drill 1.3) (layers *.Cu *.Mask F.SilkS) ${p.to.str})
)
`
}
}

View File

@ -0,0 +1,55 @@
module.exports = {
params: {
designator: 'T', // for Toggle
side: 'F',
from: undefined,
left: undefined,
right: undefined
},
body: p => {
const left = p.side == 'F' ? '-' : ''
const right = p.side == 'F' ? '' : '-'
return `
(module E73:SPDT_C128955 (layer F.Cu) (tstamp 5BF2CC3C)
${p.at /* parametric position */}
${'' /* footprint reference */}
(fp_text reference "${p.ref}" (at 0 0) (layer F.SilkS) ${p.ref_hide} (effects (font (size 1.27 1.27) (thickness 0.15))))
(fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
${'' /* outline */}
(fp_line (start 1.95 -1.35) (end -1.95 -1.35) (layer ${p.side}.SilkS) (width 0.15))
(fp_line (start 0 -1.35) (end -3.3 -1.35) (layer ${p.side}.SilkS) (width 0.15))
(fp_line (start -3.3 -1.35) (end -3.3 1.5) (layer ${p.side}.SilkS) (width 0.15))
(fp_line (start -3.3 1.5) (end 3.3 1.5) (layer ${p.side}.SilkS) (width 0.15))
(fp_line (start 3.3 1.5) (end 3.3 -1.35) (layer ${p.side}.SilkS) (width 0.15))
(fp_line (start 0 -1.35) (end 3.3 -1.35) (layer ${p.side}.SilkS) (width 0.15))
${'' /* extra indicator for the slider */}
(fp_line (start -1.95 -3.85) (end 1.95 -3.85) (layer Dwgs.User) (width 0.15))
(fp_line (start 1.95 -3.85) (end 1.95 -1.35) (layer Dwgs.User) (width 0.15))
(fp_line (start -1.95 -1.35) (end -1.95 -3.85) (layer Dwgs.User) (width 0.15))
${'' /* bottom cutouts */}
(pad "" np_thru_hole circle (at 1.5 0) (size 1 1) (drill 0.9) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at -1.5 0) (size 1 1) (drill 0.9) (layers *.Cu *.Mask))
${'' /* pins */}
(pad 1 smd rect (at ${right}2.25 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.right.str})
(pad 2 smd rect (at ${left}0.75 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.from.str})
(pad 3 smd rect (at ${left}2.25 2.075 ${p.rot}) (size 0.9 1.25) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask) ${p.left.str})
${'' /* side mounts */}
(pad "" smd rect (at 3.7 -1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask))
(pad "" smd rect (at 3.7 1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask))
(pad "" smd rect (at -3.7 1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask))
(pad "" smd rect (at -3.7 -1.1 ${p.rot}) (size 0.9 0.9) (layers ${p.side}.Cu ${p.side}.Paste ${p.side}.Mask))
)
`
}
}

22
footprints/text.js Normal file
View File

@ -0,0 +1,22 @@
module.exports = {
params: {
layer: "F.SilkS",
text: "",
h_size: 1,
v_size: 1,
thickness: 0.15,
justify: "",
},
body: (p) => {
let justify = "";
if (p.justify != "") {
justify = `(justify ${p.justify})`;
}
return `
(gr_text "${p.text}" ${p.at} (layer ${p.layer})
(effects (font (size ${p.h_size} ${p.v_size}) (thickness ${p.thickness})) ${justify})
)
`;
},
};

103
footprints/trrs_tight.js Normal file
View File

@ -0,0 +1,103 @@
// TRRS-PJ-320A-dual
//
// Normal footprint:
// _________________
// | (2) (3) (4)|
// | |
// | (1) |
// |________________|
//
// Reverse footprint:
// _________________
// | (2) (3) (4)|
// | (1) |
// | (1) |
// |___(2)___(3)_(4)|
//
// Reverse & symmetric footprint:
// _________________
// | (1|2) (3) (4)|
// | |
// |_(1|2)___(3)_(4)|
//
// Nets
// A: corresponds to pin 1
// B: corresponds to pin 2
// C: corresponds to pin 3
// D: corresponds to pin 4
// Params
// reverse: default is false
// if true, will flip the footprint such that the pcb can be reversible
// symmetric: default is false
// if true, will only work if reverse is also true
// this will cause the footprint to be symmetrical on each half
// pins 1 and 2 must be identical if symmetric is true, as they will overlap
module.exports = {
params: {
designator: 'TRRS',
reverse: false,
symmetric: false,
A: undefined,
B: undefined,
C: undefined,
D: undefined
},
body: p => {
const standard = `
(module TRRS-PJ-320A-dual (layer F.Cu) (tedit 5970F8E5)
${p.at /* parametric position */}
${'' /* footprint reference */}
(fp_text reference "${p.ref}" (at 0 14.2) (layer Dwgs.User) (effects (font (size 1 1) (thickness 0.15))))
(fp_text value TRRS-PJ-320A-dual (at 0 -5.6) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15))))
${''/* corner marks */}
(fp_line (start 0.5 -2) (end -5.1 -2) (layer Dwgs.User) (width 0.15))
(fp_line (start -5.1 0) (end -5.1 -2) (layer Dwgs.User) (width 0.15))
(fp_line (start 0.5 0) (end 0.5 -2) (layer Dwgs.User) (width 0.15))
(fp_line (start -5.35 0) (end -5.35 12.1) (layer Dwgs.User) (width 0.15))
(fp_line (start 0.75 0) (end 0.75 12.1) (layer Dwgs.User) (width 0.15))
(fp_line (start 0.75 12.1) (end -5.35 12.1) (layer Dwgs.User) (width 0.15))
(fp_line (start 0.75 0) (end -5.35 0) (layer Dwgs.User) (width 0.15))
`
function stabilizers(def_pos) {
return `
(pad "" np_thru_hole circle (at ${def_pos} 8.6) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at ${def_pos} 1.6) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask))
`
}
function pins(def_neg, def_pos) {
return `
(pad 1 thru_hole oval (at ${def_neg} 11.3 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.A.str})
(pad 2 thru_hole oval (at ${def_pos} 10.2 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.B.str})
(pad 3 thru_hole oval (at ${def_pos} 6.2 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.C.str})
(pad 4 thru_hole oval (at ${def_pos} 3.2 ${p.rot}) (size 1.6 2.2) (drill oval 0.9 1.5) (layers *.Cu *.Mask) ${p.D.str})
`
}
if(p.reverse & p.symmetric) {
return `
${standard}
${stabilizers('-2.3')}
${pins('0', '-4.6')}
${pins('-4.6', '0')})
`
} else if(p.reverse) {
return `
${standard}
${stabilizers('-2.3')}
${stabilizers('0')}
${pins('-2.3', '2.3')}
${pins('0', '-4.6')})
`
} else {
return `
${standard}
${stabilizers('-2.3')}
${pins('-4.6', '0')})
`
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 KiB

After

Width:  |  Height:  |  Size: 294 KiB

2417
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
{
"scripts": {
"gen": "ergogen samoklava.yaml"
},
"dependencies": {
"ergogen": "github:soundmonster/ergogen#samoklava"
}
"scripts": {
"gen": "ergogen -d ."
},
"dependencies": {
"ergogen": "github:ergogen/ergogen#v4.0.4"
}
}

View File

@ -1,446 +0,0 @@
units:
kx: cx
ky: cy
px: 2
py: 2
points:
key:
footprints:
choc_hotswap:
type: choc
params:
hotswap: true
reverse: true
keycaps: true
nets:
# from: P1
# to: P2
from: =colrow
to: =column_net
diode:
type: diode
nets:
# from: P3
# to: P4
from: =colrow
to: =row_net
anchor:
shift: [0, -5]
zones:
matrix:
# anchor:
# rotate: 5
key.padding: ky
columns:
pinky:
stagger: 0 ky
spread: kx
key:
column_net: P20
ring:
stagger: 0.7 ky
spread: kx
key:
column_net: P19
middle:
stagger: 0.2 ky
spread: kx
key:
column_net: P18
index:
stagger: -0.2 ky
spread: kx
key:
column_net: P15
inner:
stagger: -0.1 ky
spread: kx
key:
column_net: P14
rows:
bottom:
row_net: P6
home:
row_net: P5
top:
row_net: P4
thumbfan:
anchor:
ref: matrix_inner_bottom
shift: [-1.5 kx, -1 ky]
columns:
near:
spread: kx
rotate: -15
origin: [-0.5 kx, -0.5 ky]
key:
column_net: P18
home:
spread: kx
rotate: -15
origin: [-0.5 kx, -0.5 ky]
key:
column_net: P15
far:
spread: kx
rotate: -15
origin: [-0.5 kx, -0.5 ky]
key:
column_net: P14
rows:
thumb:
row_net: P7
outlines:
# board dimensions according to JLCPCB: 122.28 mm x 101.05 mm
exports:
raw:
- type: keys
side: left
size: [kx + px, ky + py]
corner: px
thumbfan_glue:
- type: polygon
points:
- ref: matrix_inner_bottom
shift: [0.5 kx + 0.5px, -0.5 ky + 0.5 py]
- ref: thumbfan_far_thumb
shift: [0.5 kx - 0.5px, 0.5 ky + 0.5 py]
- ref: thumbfan_far_thumb
shift: [0.5 kx - 0.5px, -0.5 ky - 0.5 py]
- ref: thumbfan_near_thumb
shift: [-0.5 kx + 0.5 px, -0.5 ky - 0.5 py]
- ref: matrix_pinky_bottom
shift: [0.5 kx - 0.5 py, -0.5 ky - 0.5 py]
- ref: matrix_pinky_home
- ref: matrix_inner_home
patch_outer:
- type: polygon
points:
- ref: matrix_ring_top
- ref: matrix_ring_bottom
- ref: matrix_pinky_bottom
shift: [-0.5 (kx + px), 0]
- ref: matrix_pinky_top
shift: [-0.5 (kx + px), 0]
patch_inner:
- type: polygon
points:
- ref: matrix_inner_top
shift: [0.5 (kx + px), 0]
- ref: matrix_inner_bottom
shift: [0.5 (kx + px), 0]
- ref: matrix_index_bottom
- ref: matrix_index_top
controller_area:
main:
type: rectangle
anchor:
ref:
- matrix_inner_top
shift: [0 kx, -4.05 ky]
size: [32, 76.5]
corner: px
switches:
main:
type: keys
side: left
size: 14
bound: false
keycaps:
main:
type: keys
side: left
size: [kx, ky]
bound: false
corner: 1
keywell:
main:
type: outline
name: raw
patch_inner:
type: outline
name: patch_inner
operation: add
patch_outer:
type: outline
name: patch_outer
operation: add
thumbfan_glue:
type: outline
name: thumbfan_glue
operation: add
base_outline:
main:
type: outline
name: keywell
controller:
type: outline
name: controller_area
operation: add
screw_holes:
top_left:
type: circle
anchor:
- ref: matrix_ring_home
shift: [-0.5 kx, 0 ky]
radius: 1.05
bottom_left:
type: circle
anchor:
- ref: matrix_pinky_bottom
shift: [0.5 kx, 0]
radius: 1.05
top_right:
type: circle
anchor:
- ref: matrix_inner_top
shift: [-0.5 kx, 0]
radius: 1.05
palm:
type: circle
anchor:
- ref: matrix_index_bottom
shift: [0, -1.06 ky]
radius: 1.05
thumb:
type: circle
anchor:
- ref: thumbfan_far_thumb
shift: [-0.55 kx, 0]
radius: 1.05
mounting_holes:
$extends: outlines.exports.screw_holes
top_left:
radius: 2.05
bottom_left:
radius: 2.05
top_right:
radius: 2.05
palm:
radius: 2.05
thumb:
radius: 2.05
bottom_outline:
main:
type: outline
name: base_outline
screw_holes:
type: outline
# TODO use footprints with pad + via reinforcement as mounting holes
name: screw_holes
operation: subtract
plate:
main:
type: outline
name: keywell
switches:
type: outline
name: switches
operation: subtract
mounting_holes:
type: outline
# TODO use footprints with pad + via reinforcement as mounting holes
name: screw_holes
operation: subtract
pcb:
main:
type: outline
name: base_outline
mounting_holes:
type: outline
# TODO use plated through hole footprints as mounting holes
name: mounting_holes
operation: subtract
pcbs:
top_plate:
# include JLCJLCJLCJLC text somewhere
include_keys: false
outlines:
edge:
outline: plate
layer: Edge.Cuts
footprints:
jlc_order_number:
type: text
anchor:
ref:
- matrix_ring_home
shift: [-0.25 kx, 0.5 ky]
params:
text: "JLCJLCJLCJLC"
justify: left
bottom_plate:
include_keys: false
outlines:
edge:
outline: bottom_outline
layer: Edge.Cuts
board:
outlines:
edge:
outline: pcb
layer: Edge.Cuts
# TODO there's a way to add stuff to the silkscreen layer
footprints:
mcu_l:
type: promicro
params:
orientation: up
batteryPins: true
anchor:
ref:
- matrix_inner_top
shift: [20, -11]
rotate: 270
mcu_r:
type: promicro
params:
orientation: down
batteryPins: true
anchor:
ref:
- matrix_inner_top
shift: [22.5, -12.25]
rotate: 270
pad_plus:
type: pad
anchor:
ref:
- matrix_inner_top
shift: [23, -18]
rotate: 0
params:
front: true
back: true
width: 1.5
height: 1.5
text: "B+"
nets:
net: Braw
pad_minus:
type: pad
anchor:
ref:
- matrix_inner_top
shift: [23, -15]
rotate: 0
params:
front: true
back: true
width: 1.5
height: 1.5
text: "B-"
nets:
net: Bminus
trrs_l:
type: trrs
anchor:
ref:
- matrix_inner_bottom
shift: [32, -15]
rotate: 270
params:
reverse: false
symmetric: false
# The naming of the nets on this footprint is different from the Corne schematics.
nets:
A: ""
B: VCC
C: GND
D: P0
trrs_r:
type: trrs
anchor:
ref:
- matrix_inner_bottom
shift: [32, -13]
rotate: 270
params:
reverse: true
symmetric: false
# The naming of the nets on this footprint is different from the Corne schematics.
nets:
A: ""
B: VCC
C: GND
D: P0
jumper_l:
type: jumper
anchor:
ref:
- matrix_inner_bottom
shift: [23.5, 0]
rotate: 270
params:
side: B
nets:
from: Braw
to: Bplus
jumper_r:
type: jumper
anchor:
ref:
- matrix_inner_bottom
shift: [23.5, 0]
rotate: 270
params:
side: F
nets:
from: Braw
to: Bplus
slider_l:
type: slider
anchor:
ref:
- matrix_inner_bottom
shift: [30, 0]
rotate: 270
params:
side: F
nets:
from: Braw
to: Bplus
slider_r:
type: slider
anchor:
ref:
- matrix_inner_bottom
shift: [30, 0]
rotate: 270
params:
side: B
nets:
from: Braw
to: Bplus
reset:
type: button
anchor:
ref:
- matrix_inner_bottom
shift: [17, 0]
rotate: 270
params:
variant: 2_pin_th
nets:
from: GND
to: RST
info_l:
type: text
anchor:
ref:
- matrix_pinky_bottom
shift: [0.75 kx, 0]
params:
text: "samoklava v0.1\\nby soundmonster"
justify: left
info_r:
type: text
anchor:
ref:
- matrix_pinky_bottom
shift: [0.75 kx, 0]
params:
layer: B.SilkS
text: "samoklava v0.1\\nby soundmonster"
justify: right mirror