|
| 1 | +These are various hacked-up projects that use the pipe- |
| 2 | +fifo LED protocol as part of arcan >= 0.5.2. |
| 3 | + |
| 4 | +# Subprojects |
| 5 | + g810 - GPLv3, see README.md and LICENSE file. Adds support |
| 6 | + for reading protocol controls via stdin. |
| 7 | + |
| 8 | + arduino - arduino project and makefiles for programming an |
| 9 | + arduino device to use the protocol over serial or |
| 10 | + i2c in order to control PWM adafruit neopixel- LEDs. |
| 11 | + |
| 12 | +# Setup/Use |
| 13 | + |
| 14 | +fifos can be configured via: |
| 15 | + |
| 16 | + mkfifo c /path/to/fifo |
| 17 | + mkfifo c /path/to/fifo2 |
| 18 | + arcan_db add_appl_kv arcan ext_led /path/to/fifo |
| 19 | + arcan_db add_appl_kv arcan ext_led_2 /path/to/fifo2 |
| 20 | + |
| 21 | +and so on. |
| 22 | + |
| 23 | +for the arduino setup, the USB- serial port can be configured like: |
| 24 | + |
| 25 | + stty -F /dev/ttyACM0 cs8 9600 ignbrk -brkint -imaxbel -opost |
| 26 | + -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl |
| 27 | + -echoke noflsh -ixon -crtscts |
| 28 | + |
| 29 | +and then fed like: |
| 30 | + |
| 31 | + cat /path/to/fifo > /dev/ttyACM0 |
| 32 | + |
| 33 | +the g810 module, similarly: |
| 34 | + |
| 35 | + cat /path/to/fifo | g810-led --arcan-stdin |
| 36 | + |
| 37 | +# Protocol |
| 38 | + |
| 39 | +Each packet is a 2-byte tuple of opcode and argument. |
| 40 | + |
| 41 | +first byte is one of (ascii) 'A' 'a' 'r' 'g' 'b' 'i' 'c' or 'o'. |
| 42 | + |
| 43 | +'A' [ign] : set active LED index to 'all' |
| 44 | +'a' [num] : set active LED index to [num] |
| 45 | +'r' [num] : set current Red value to [num] |
| 46 | +'g' [num] : set current Green value to [num] |
| 47 | +'b' [num] : set current Blue value to [num] |
| 48 | +'i' [num] : set all (Red, Green, Blue) value to [num] |
| 49 | +'c' [num] : num = 0, commit - no buffer, > 0 - buffer |
| 50 | + |
| 51 | +with the buffer indication meaning that more values are to come before |
| 52 | +any update to led devices should be pushed. |
| 53 | + |
| 54 | +The arcan scripts can then use set\_led\_rgb(dev, ind, r, g, b, buf) calls |
| 55 | +to emit data to the respective devices. Advanced such use can be found in |
| 56 | +[durden](https://github.com/letoram/durden) iostatem.lua + devmaps/led/... |
| 57 | + |
| 58 | +devmaps/ contain example such devmaps for the setup shown above. A video |
| 59 | +of its use can be found at [gfycat](https://gfycat.com/AgonizingPleasingGuppy) |
| 60 | + |
0 commit comments