diff options
Diffstat (limited to 'prog/jelka/jelka.py')
-rw-r--r-- | prog/jelka/jelka.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/prog/jelka/jelka.py b/prog/jelka/jelka.py new file mode 100644 index 0000000..cd8d281 --- /dev/null +++ b/prog/jelka/jelka.py @@ -0,0 +1,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') |