Adam Haile edited this page Mar 23, 2017 · 6 revisions

class _bibliopixel.drivers.spi_driver_base.DriverSPIBase

DriverSPIBase is a base class for building other drivers that control SPI strips on devices that have hardware SPI ports, like the Raspberry Pi or BeagleBone Black. DriverLPD8806 and DriverWS2801 both inherit from this class. See SPI Setup for more details on using hardware SPI.

Note: SPI devices typically require root access in order to write to the SPI port. Any scripts using this class should be run with sudo.


(num, c_order = ChannelOrder.GRB, use_py_spi = True, dev="/dev/spidev0.0", SPISpeed = 16):

  • num - Number of pixels to be controlled.
  • c_order - Optional: Channel order used by the attached display. Can be any of the six options in the ChannelOrder class. See Channel Order for more details.
  • use_py_spi - If True, SPI communication is handled by py-spidev which provides faster output. Otherwise a file access method is used.
  • dev - The SPI device path to use. See SPI Setup for more details.
  • SPISpeed - The SPI speed, in MHz, to use when communicating with the strip.



  • data - Pixel data in the format [R0, G0, B0, R1, G1, B1, ...]

The default update() implementation for SPI. It will call _fixData() and then send to pixel data to the SPI device. Only override this method if a different implementation is required.


This method is called in the default update() method and sends the data to the SPI port. If update() is overridden in an inheriting class, it will need to be called manually.



The path of the hardware SPI device to be used. On the Raspberry Pi and BeagleBone Black the default device path is /dev/spidev0.0


Holds True if py-spidev is being used for SPI communication, otherwise False.


Holds the currently set SPI speed.


The connected SPI device object. A py-spidev if use_py_spi == True, otherwise a file handle to the SPI device. Generally, this property need not be accessed as it is all handled in the update() method.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.