1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
WriteFrame(unsigned int dacNum, int pps, std::uint8_t flags, HeliosPoint* points, int numOfPoints);
in 1024 points:
scale up x from 0 to 100%
scale down y from 0 to 100%
scale R, G and B up from 0 to 255 4 times out of sync
"""
import ctypes
#Define point structure
class HeliosPoint(ctypes.Structure):
#_pack_=1
_fields_ = [('x', ctypes.c_uint16),
('y', ctypes.c_uint16),
('r', ctypes.c_uint8),
('g', ctypes.c_uint8),
('b', ctypes.c_uint8),
('i', ctypes.c_uint8)]
#Load and initialize library
HeliosLib = ctypes.cdll.LoadLibrary("./libHeliosDacAPI.dylib")
numDevices = HeliosLib.OpenDevices()
frames=[0 for x in range(1024)]
r=0
g=85
b=170
intensity=256
def inc8(m):
return (m+1)%256
for i in range(1024):
frames[i]=HeliosPoint(int(i*16),int(16383-(i*16)),int(r),int(g),int(b),int(intensity))
r=inc8(r)
g=inc8(g)
b=inc8(b)
try:
while True:
HeliosLib.WriteFrame(0, 20000, 0, ctypes.pointer(frames[0]), 1024)
except KeyboardInterrupt:
pass
HeliosLib.CloseDevices()
|