ShiboSoftwareDev/linux-gameboy-advance

A multilayer PCB carrier/router with USB-C and battery power selection, buck regulation, microSD, LCD/backlight, UART/SPI/I²C service headers, controls, volume input, and RGB status LEDs, using vias and reviewed copper routing.

Version
1.0.123
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')