Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fadecandy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scanlime
Fadecandy
Commits
92b32090
Commit
92b32090
authored
11 years ago
by
Micah Elizabeth Scott
Browse files
Options
Downloads
Patches
Plain Diff
Send a simple color LUT in the usb-basic example
parent
942e16ef
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/usb-basic.py
+18
-0
18 additions, 0 deletions
examples/usb-basic.py
with
18 additions
and
0 deletions
examples/usb-basic.py
+
18
−
0
View file @
92b32090
...
...
@@ -21,6 +21,24 @@ dev.set_configuration()
print
"
Serial number: %s
"
%
usb
.
util
.
get_string
(
dev
,
255
,
dev
.
iSerialNumber
)
# Set up a default color LUT
lut
=
[
0
]
*
(
64
*
25
)
for
index
in
range
(
25
):
lut
[
index
*
64
]
=
index
|
0x40
lut
[
24
*
64
]
|=
0x20
for
channel
in
range
(
3
):
for
row
in
range
(
256
):
value
=
int
(
pow
(
row
/
256.0
,
2.2
)
*
0x10000
)
i
=
(
channel
<<
8
)
+
row
packetNum
=
i
/
31
packetIndex
=
i
%
31
lut
[
packetNum
*
64
+
2
+
packetIndex
*
2
]
=
value
&
0xFF
lut
[
packetNum
*
64
+
3
+
packetIndex
*
2
]
=
value
>>
8
dev
.
write
(
1
,
''
.
join
(
map
(
chr
,
lut
)))
print
"
LUT programmed
"
# Slowly push random frames to the device
while
True
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment