aboutsummaryrefslogtreecommitdiff
path: root/turtetris_slave/leds.py
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2017-07-18 20:11:12 +0200
committerKarel Kočí <karel.koci@nic.cz>2017-07-19 10:15:02 +0200
commitdd8bcc2da80d15280b9aa94cec648fbdac576cc3 (patch)
treebac1f0e7b71b18414753e4ddfb507d70b79a0923 /turtetris_slave/leds.py
parent0a9a2fd752b03e1796ed6ce110ee939f0eb773e6 (diff)
downloadturris-tetris-dd8bcc2da80d15280b9aa94cec648fbdac576cc3.tar.gz
turris-tetris-dd8bcc2da80d15280b9aa94cec648fbdac576cc3.tar.bz2
turris-tetris-dd8bcc2da80d15280b9aa94cec648fbdac576cc3.zip
Add matrix
Diffstat (limited to 'turtetris_slave/leds.py')
-rw-r--r--turtetris_slave/leds.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/turtetris_slave/leds.py b/turtetris_slave/leds.py
new file mode 100644
index 0000000..cdafca2
--- /dev/null
+++ b/turtetris_slave/leds.py
@@ -0,0 +1,38 @@
+from subprocess import call
+
+
+def prepare():
+ "Prepare leds"
+ call("rainbow all enable intensity 10 FFFFFF", shell=True)
+
+
+def clear():
+ "Clear previous changes"
+ call("rainbow all auto", shell=True)
+
+
+__MAP__ = [
+ 'pwr',
+ 'lan0',
+ 'lan1',
+ 'lan2',
+ 'lan3',
+ 'lan4',
+ 'wan',
+ 'pci1',
+ 'pci2',
+ 'pci3',
+ 'usr1',
+ 'usr2'
+]
+
+
+def output(data):
+ "Output received data to leds"
+ args = ['rainbow']
+ for i in range(0, 12):
+ args.append(__MAP__[i])
+ args.append(str(data[i]['color']))
+ args.append('intensity')
+ args.append(str(data[i]['intens']))
+ call(args)