neopixel_spi
¶
SPI driven CircuitPython driver for NeoPixels.
Author(s): Carter Nelson
Implementation Notes¶
Hardware:
Hardware SPI port required on host platform.
Software and Dependencies:
Adafruit Blinka: https://github.com/adafruit/Adafruit_Blinka
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class neopixel_spi.NeoPixel_SPI(spi: SPI, n: int, *, bpp: int = 3, brightness: float = 1.0, auto_write: bool = True, pixel_order: str | Tuple[int, ...] | None = None, frequency: int = 6400000, reset_time: float = 8e-05, bit0: int = 192, bit1: int = 240)¶
A sequence of neopixels.
- Parameters:
spi (SPI) – The SPI bus to output neopixel data on.
n (int) – The number of neopixels in the chain
bpp (int) – Bytes per pixel. 3 for RGB and 4 for RGBW pixels.
brightness (float) – Brightness of the pixels between 0.0 and 1.0 where 1.0 is full brightness
auto_write (bool) – True if the neopixels should immediately change when set. If False,
show
must be called explicitly.pixel_order (tuple) – Set the pixel color channel order. GRBW is set by default. pixel_order may be a string or a tuple of integers with values between 0 and 3.
frequency (int) – SPI bus frequency. For 800kHz NeoPixels, use 6400000 (default). For 400kHz, use 3200000.
reset_time (float) – Reset low level time in seconds. Default is 80e-6.
bit0 (byte) – Bit pattern to set timing for a NeoPixel 0 bit.
bit1 (byte) – Bit pattern to set timing for a NeoPixel 1 bit.
Example:
import board import neopixel_spi pixels = neopixel_spi.NeoPixel_SPI(board.SPI(), 10) pixels.fill(0xff0000)