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:

neopixel_spi.GRB = 'GRB'

Green Red Blue

neopixel_spi.GRBW = 'GRBW'

Green Red Blue White

class neopixel_spi.NeoPixel_SPI(spi, n, *, bpp=3, brightness=1.0, auto_write=True, pixel_order=None, frequency=6400000, reset_time=8e-05, bit0=192, bit1=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.
  • 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)
deinit()

Blank out the NeoPixels.

n

The number of neopixels in the chain (read-only)

neopixel_spi.RGB = 'RGB'

Red Green Blue

neopixel_spi.RGBW = 'RGBW'

Red Green Blue White