2016-03-28 00:58:14 +01:00
|
|
|
# APA102 driver for MicroPython on ESP8266
|
|
|
|
# MIT license; Copyright (c) 2016 Robert Foss, Daniel Busch
|
|
|
|
|
|
|
|
from esp import apa102_write
|
2016-10-19 21:09:51 +01:00
|
|
|
from neopixel import NeoPixel
|
2016-03-28 00:58:14 +01:00
|
|
|
|
|
|
|
|
2016-10-19 21:09:51 +01:00
|
|
|
class APA102(NeoPixel):
|
|
|
|
ORDER = (0, 1, 2, 3)
|
2016-03-28 00:58:14 +01:00
|
|
|
|
2016-10-19 21:09:51 +01:00
|
|
|
def __init__(self, clock_pin, data_pin, n, bpp=4):
|
|
|
|
super().__init__(data_pin, n, bpp)
|
|
|
|
self.clock_pin = clock_pin
|
|
|
|
self.clock_pin.init(clock_pin.OUT)
|
2016-03-28 00:58:14 +01:00
|
|
|
|
|
|
|
def write(self):
|
2016-10-19 21:09:51 +01:00
|
|
|
apa102_write(self.clock_pin, self.pin, self.buf)
|