aboutsummaryrefslogtreecommitdiff
path: root/turtetris_slave/leds.py
blob: e780d0fb246d57de99e78b30135c3e91c342c7eb (plain)
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
from subprocess import call


def prepare():
    "Prepare leds"
    call("rainbow all enable 000000", 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('enable')
        args.append(str(data[i]))
    call(args)