rushabhcodes/wireless-split-keyboard

Wireless Split Keyboard — custom routed nRF52840 split PCBs with a printable enclosure

Version
0.4.5
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone rushabhcodes/wireless-split-keyboard  # download the package files into ./wireless-split-keyboard
tsci add rushabhcodes/wireless-split-keyboard    # add it to your project as @tsci/rushabhcodes.wireless-split-keyboard

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

scripts/sexpr.py

"""Small data-only KiCad S-expression reader. No board import or routing reuse."""
import re,json

def parse(text):
    tokens=re.findall(r'"(?:\\.|[^"\\])*"|[()]|[^\s()]+',text)
    stack=[]; root=None
    for t in tokens:
        if t=='(':
            item=[]
            if stack: stack[-1].append(item)
            else: root=item
            stack.append(item)
        elif t==')':stack.pop()
        else:
            if t.startswith('"'):value=json.loads(t)
            else:
                try:value=float(t)
                except ValueError:value=t
            stack[-1].append(value)
    return root

def fields(node,key):return [n for n in node[1:] if isinstance(n,list) and n and n[0]==key]
def field(node,key,default=None):
    matches=fields(node,key)
    return matches[0][1:] if matches else default