1 import struct
2 VERSION = 0x0001
3 MAGIC = 0x4adc0104
4 PORTOUT = 0x0108
5 UNI = 0
6 import pdb
7 import util.TimeOps as timeops
8 argDict = {'flags': 0, 'startcode': 0x0fff, 'pad':0}
11 packet = bytearray()
12 for light in pixelStrip:
13 color = light.state(currentTime)
14 for channel in color:
15
16 packet.append(struct.pack('B', channel))
17 return packet
18
19
20
21
22
23
24 cache = {}
30 return helper
31
34 packet = bytearray()
35 subDict = dict(argDict)
36 subDict['len'] = 150
37 subDict['port'] = port
38 packet.extend(portOutPacket(subDict))
39
40 return packet
41
47
49 header = bytearray()
50 header.extend(struct.pack('L', MAGIC))
51 header.extend(struct.pack('H', VERSION))
52 header.extend(struct.pack('H', PORTOUT))
53 header.extend(struct.pack('L', 0))
54 return header
55
57 header = packheader()
58 header.extend(struct.pack('L', UNI))
59 return header
60
62 payload = bytearray()
63 payload.extend(struct.pack('B', argDict['port']))
64 payload.extend(struct.pack('B',0))
65 payload.extend(struct.pack('H', argDict['flags']))
66 payload.extend(struct.pack('H', argDict['len']))
67 payload.extend(struct.pack('H', argDict['startcode']))
68 return payload
70 header = bytearray()
71 header.extend(struct.pack('L', MAGIC))
72 header.extend(struct.pack('H', VERSION))
73 header.extend(struct.pack('H', 0x0109))
74 header.extend(struct.pack('L', 0))
75 header.extend(struct.pack('L', 0))
76 return header
77
79 packet = bytearray()
80 packet.extend(portOut())
81 packet.extend(portOutPayload(payloadArgs))
82 return packet
83