gokul/macro-six-usbc
A six-key macro keyboard PCB paired with a separate physical enclosure.
- Version
- 0.1.16
- License
- unset
- Stars
- 0
Use with the tscircuit CLI
tsci is the tscircuit CLI. Install it with npm install -g tscircuit.
tsci clone gokul/macro-six-usbc # download the package files into ./macro-six-usbc
tsci add gokul/macro-six-usbc # add it to your project as @tsci/gokul.macro-six-usbcIn 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.
firmware/tests/check-hex.py
"""Check Intel HEX checksums and preserve a 4 KiB DFU boot region."""
from pathlib import Path
address_base = 0
memory = {}
eof = False
for line in (Path(__file__).parents[1] / 'macro-six.hex').read_text().splitlines():
assert line.startswith(':')
data = bytes.fromhex(line[1:])
assert sum(data) % 256 == 0, 'invalid HEX checksum'
size, address, kind = data[0], int.from_bytes(data[1:3], 'big'), data[3]
assert len(data) == size + 5
payload = data[4:-1]
if kind == 0:
for offset, value in enumerate(payload):
absolute = address_base + address + offset
assert absolute < 0x7000, 'image enters reserved DFU boot region'
assert absolute not in memory, 'overlapping HEX records'
memory[absolute] = value
elif kind == 4:
address_base = int.from_bytes(payload, 'big') << 16
elif kind == 1:
eof = True
else:
raise AssertionError(f'unexpected record type {kind}')
assert eof and 0 in memory
print(f'PASS: {len(memory)} image bytes; highest address 0x{max(memory):04x}; boot region untouched')