ShiboSoftwareDev/linux-gameboy-advance

Restores PCB assembly metadata by assigning part numbers and 3D CAD models, removing test-point bodies, and validating top-side SMT solder-paste features without altering copper or pads.

Version
1.0.17
License
unset
Stars
0

scripts/test-rgb-frame.py

import importlib.util
from pathlib import Path
s=importlib.util.spec_from_file_location('rgb',Path(__file__).resolve().parents[1]/'firmware/rgb-demo.py')
m=importlib.util.module_from_spec(s);s.loader.exec_module(m)
# Asymmetric channel values catch the SK9822-A-specific GRB byte order.
assert m.frame(0x12,0x34,0x56)==bytes.fromhex('00 00 00 00 e2 34 12 56 ff ff ff ff 00 00 00 00')
assert m.frame(0,0,0,0)==bytes.fromhex('00 00 00 00 e0 00 00 00 ff ff ff ff 00 00 00 00')
for args in [(0,0,0,3),(0,0,0,-1),(256,0,0,2),(-1,0,0,2)]:
 try:m.frame(*args)
 except ValueError:pass
 else:raise AssertionError(f'accepted invalid or excessive brightness: {args}')
print('SK9822-A framing, GRB order, off frame and brightness limits passed')