Steve French wrote:
> Peter,
> Regarding your below code, do you think this is something that would work
> on Embedded Linux system in general (rPi and BBB and others) or is it
> specific to the rPi?
It is a completely generic way to drive the pixels on any Linux
system with an spidev interface. This includes both rpi and the
beagles and tons of other Linux boards. The only requirement for the
program to work as intended is that there is hardware SPI support
(spidev) and that the SPI hardware can be clocked at 4 MHz or 8 MHz
for WS2811 or WS2812B respectively. These two clock rates are likely
to be widely supported.
> I would be glad to test it on both the rPi and the BBB later this week
> if I can figure out how to use it.
Cool! I'd be happy to chat on IRC for some realtime back-and-forth if
you like. Let me know when is a good time for you.
> It appears as if everything is contained within the file called
> "spidev-ws2811_ws2812.c
..
> So do put that file somewhere inside of the OLA tree and re-build OLA to
> include it as a plug-in?
The source file compiles to a standalone program which isn't
integrated into OLA. It can be used to set colours of attached pixels
from the command line. Download the .c file and the Makefile,
(git clone may be easiest), run make, then run the program:
syntax: ./spidev-ws2811_ws2812 [-h] [-n] [-d /dev/spidevX.Y] [-l] rrggbb... [rrggbb...]
-h shows this help
-n do not open SPI device and instead hexdump SPI words
-d specify SPI device (default: /dev/spidev1.0)
-l enable low-speed mode
Specify -l for WS2811 speed. Do not specify -l for WS2812B speed.
If your SPI hardware is /dev/spidev1.0 (the default for -d) then you
can set the first pixel to pink simply by running:
./spidev-ws2811_ws2812 ff00ff
You can specify any number of colours/pixels, either as a single
really long argument or with each pixel colour as individual
argument, or any combination thereof.
Once it is clear that this works as intended it would most likely be
trivial to create a plugin for OLA which drives pixels directly the
same way.
> Just pointing out that there is another solution specific to the BBB that
> uses the built-in PRU (programmable realtime unit)
Yep, on the beaglebone the PRU is a good option.
//Peter