Had an old Unicorn HAT that wasn’t seeing much use However as a separate inky project has grown some legs and outgrown it’s pi zero; it now runs on the zero as a client and a Pi 4 as a server.
I wanted to use the Unicorn HAT for some simple colours as a sort of status board on the pi 4, so I know the other code is still running and what it’s doing.
So this code doesn’t have to run as root I’ve made a tiny daemon that opens a FIFO and reads in width * height many pixels worth of colour data and displays them on the unicorn.
My other project can then write to the pipe without worrying about the Unicorn HAT library or root permissions.
The project is here with the small daemon and a copy of the rainbow test program modified to work on it. It’s fast enough that the rainbow demo looks pretty good, with the condition you send it all data in one row so that’s enforced. I did have it allowing data pixel by pixel but I can’t quite see the use of that mode when writing all the data in one go isn’t so huge.
Data is a list of tuples in the rough form then json encoded:
[ ((x, y), (r, g, b)), ...]
I’m currently running it via systemd with a little service file.