summaryrefslogtreecommitdiffstats
path: root/prog/jelka/jelka.py
blob: cd8d281d6710c73d8d23dda27474f05470fe171d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python3
# API za umetnike -- produkcija
from mmap import mmap
from sys import stdout, argv
from io import FileIO
from jelka_config import luči
shmf = open("/dev/shm/jelka", mode="r+b")
buffer = mmap(shmf.fileno(), 0)
w = FileIO(int(argv[1]), mode="w", closefd=False)
def nastavi(luč, barva):
	buffer[luč*3] = barva[0]
	buffer[luč*3+1] = barva[1]
	buffer[luč*3+2] = barva[2]
def pokaži(tupli):
	for i in range(luči):
		nastavi(i, tupli[i])
def izriši():
	w.write(b'\n')