This commit is contained in:
Felipe Martin 2017-01-18 08:48:50 +01:00
parent 2928baa002
commit 5900499a2f
1 changed files with 5 additions and 6 deletions

View File

@ -4,7 +4,7 @@ import usb.core
import usb.util import usb.util
class Leds: class Leds(object):
""" """
Helper class with static attributes to select Luxafor leds. Helper class with static attributes to select Luxafor leds.
@ -40,7 +40,7 @@ class Leds:
LED6 = 0x06 LED6 = 0x06
class Packet: class Packet(object):
byte0 = 0 byte0 = 0
byte1 = 0 byte1 = 0
byte2 = None byte2 = None
@ -60,7 +60,7 @@ class Packet:
return list(pkt) return list(pkt)
class Luxafor: class Luxafor(object):
VENDOR_ID = 0x04D8 VENDOR_ID = 0x04D8
PRODUCT_ID = 0xF372 PRODUCT_ID = 0xF372
@ -133,11 +133,10 @@ class Luxafor:
pkt.byte7 = repeat pkt.byte7 = repeat
self.device.write(self.DEVICE_ID, pkt.render()) self.device.write(self.DEVICE_ID, pkt.render())
def wave(self, red=255, green=255, blue=255, wave=1, led=Leds.ALL, def wave(self, red=255, green=255, blue=255, wave=1, duration=2, repeat=1):
duration=2, repeat=1):
pkt = Packet() pkt = Packet()
pkt.byte0 = 4 pkt.byte0 = 4
pkt.byte1 = led pkt.byte1 = wave
pkt.byte2 = red pkt.byte2 = red
pkt.byte3 = green pkt.byte3 = green
pkt.byte4 = blue pkt.byte4 = blue