simap / pixelblaze_output_expander

24 stars 4 forks source link

Document APA102 support #5

Open simap opened 3 years ago

simap commented 3 years ago

Oops, silly me.

simap commented 3 years ago

For anyone looking:

The source can give you hints here: https://github.com/simap/pixelblaze_output_expander/blob/master/firmware/Core/Src/app.c#L59

The apa102 data is very similar to WS2812 types.

The apa102 clock frame has a frame header but no payload (like draw). This is needed to clear out the buffer in those bit positions when switching between types on a channel. I usually send all channels every frame, even if clocks don't change.

Frequency is not yet supported, or at least the intention is that it is a hint/request and the controllers may use something else. For example on micros using the DMA driven GPIO these will probably have a single timer driving all ports and wouldn't support per-port frequency settings. I had intended to use the lowest (including ws2812's 800khz of any port is set to it), and future controllers could be better, like an FPGA based one would be free to do per-port frequency.

However, I ran in to limitations with the STM32f103 and disabled the frequency handling code: https://github.com/simap/pixelblaze_output_expander/blob/master/firmware/Core/Src/app.c#L180

So for now both PB sends 800000Hz and the boards currently hard code that as well, but the protocol bits for frequency still exist.