From b244e1ce372c032d5731615d60c32fb43f87749e Mon Sep 17 00:00:00 2001 From: Logan Kennelly Date: Sat, 3 Feb 2018 23:17:34 +0000 Subject: [PATCH] Support multiple SPI devices when using hardware mode --- apa102.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apa102.py b/apa102.py index 71cbfb9..7037168 100644 --- a/apa102.py +++ b/apa102.py @@ -133,6 +133,8 @@ def __init__(self, order='rgb', mosi=10, sclk=11, + bus=0, + device=0, max_speed_hz=8000000, led_order=None): """Initializes the library.""" @@ -151,7 +153,7 @@ def __init__(self, import Adafruit_GPIO.SPI as SPI # MOSI 10 and SCLK 11 is hardware SPI, which needs to be set-up differently if mosi == 10 and sclk == 11: - self.spi = SPI.SpiDev(0, 0, max_speed_hz) # Bus 0, chip select 0 + self.spi = SPI.SpiDev(bus, device, max_speed_hz) else: import Adafruit_GPIO as GPIO self.spi = SPI.BitBang(GPIO.get_platform_gpio(), sclk, mosi)