forked from adammhaile/RPi-LPD8806
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved files into proper package and created setup.py script
- Loading branch information
1 parent
cf0c366
commit f8a0622
Showing
16 changed files
with
79 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
#!/usr/bin/python | ||
|
||
from time import sleep | ||
from LPD8806 import * | ||
from bootstrap import * | ||
|
||
num = 36*5*2; | ||
led = LEDStrip(num) | ||
led.setChannelOrder(ChannelOrder.BRG) | ||
led.all_off() | ||
|
||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
class LPD8806(object): | ||
"""Main driver for LPD8806 based LED strips""" | ||
|
||
def __init__(self, leds, use_py_spi = False, dev="/dev/spidev0.0"): | ||
self.leds = leds | ||
self.dev = dev | ||
self.use_py_spi = use_py_spi | ||
|
||
if self.use_py_spi: | ||
import spidev | ||
self.spi = spidev.SpiDev() | ||
self.spi.open(0,0) | ||
self.spi.max_speed_hz = 12000000 | ||
print 'py-spidev MHz: %d' % (self.spi.max_speed_hz / 1000000.0 ) | ||
else: | ||
self.spi = open(self.dev, "wb") | ||
|
||
#Push new data to strand | ||
def update(self, buffer): | ||
if self.use_py_spi: | ||
for x in range(self.leds): | ||
self.spi.xfer2([i for i in buffer[x]]) | ||
|
||
self.spi.xfer2([0x00,0x00,0x00]) #zero fill the last to prevent stray colors at the end | ||
self.spi.xfer2([0x00]) #once more with feeling - this helps :) | ||
else: | ||
for x in range(self.leds): | ||
self.spi.write(buffer[x]) | ||
self.spi.flush() | ||
#seems that the more lights we have the more you have to push zeros | ||
#not 100% sure why this is yet, but it seems to work | ||
self.spi.write(bytearray(b'\x00\x00\x00')) #zero fill the last to prevent stray colors at the end | ||
self.spi.flush() | ||
self.spi.write(bytearray(b'\x00\x00\x00')) | ||
self.spi.flush() | ||
self.spi.write(bytearray(b'\x00\x00\x00')) | ||
self.spi.flush() | ||
self.spi.write(bytearray(b'\x00\x00\x00')) | ||
self.spi.flush() |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
from distutils.core import setup | ||
|
||
setup( | ||
name=' | ||
name='RasPiLEDStrip', | ||
version='0.9b', | ||
description='Driver and Animation classes for driving LED Strips from the Raspberry Pi', | ||
author='Adam Haile', | ||
author_email='[email protected]', | ||
url='http://maniacallabs.com', | ||
license='LICENSE', | ||
packages=['raspledstrip'] | ||
) |
Oops, something went wrong.