""" Stub replacement for rpi_ws281x that allows running without a Raspberry Pi. Pixel data is stored in memory; hardware calls are no-ops. """ def Color(r, g, b): return ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF) class _ws: WS2811_STRIP_GRB = 0x00081000 ws = _ws() class PixelStrip: def __init__(self, num, pin, freq_hz=800000, dma=5, invert=False, brightness=255, channel=0, strip_type=None, gamma=None): self._pixels = [0] * num def begin(self): pass def show(self): pass def setBrightness(self, brightness): pass def setPixelColor(self, n, color): if 0 <= n < len(self._pixels): self._pixels[n] = color def getPixelColor(self, n): if 0 <= n < len(self._pixels): return self._pixels[n] return 0