aboutsummaryrefslogtreecommitdiff
path: root/turtetris_slave/leds.py
diff options
context:
space:
mode:
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)