diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2023-11-29 11:05:18 +0100 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2023-11-29 11:05:18 +0100 |
commit | acc8625c563a3b05b1cbfdbc94d39870c7a71b42 (patch) | |
tree | e34722420c64be71768923d9b04b611293fcefea /prog/jelka/jelka.py | |
parent | b5 (diff) | |
download | r-acc8625c563a3b05b1cbfdbc94d39870c7a71b42.tar r-acc8625c563a3b05b1cbfdbc94d39870c7a71b42.tar.gz r-acc8625c563a3b05b1cbfdbc94d39870c7a71b42.tar.bz2 r-acc8625c563a3b05b1cbfdbc94d39870c7a71b42.tar.lz r-acc8625c563a3b05b1cbfdbc94d39870c7a71b42.tar.xz r-acc8625c563a3b05b1cbfdbc94d39870c7a71b42.tar.zst r-acc8625c563a3b05b1cbfdbc94d39870c7a71b42.zip |
Diffstat (limited to '')
-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') |