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


def prepare():
    "Prepare leds"
    call("rainbow all enable 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]))
    call(args)