Problem with APA102 and last led in chain

Thanks, that fixed the issue !

For those curious as to what the problem was. The APA102 controller, after writing out the LED data writes out the extra strobing that I mentioned above, then releases the SPI controller.

When bitbanging, this is just fine, because when the last writeByte call exits, it’s done writing data out. With hardware SPI, however, because I make aggressive use of buffered i/o, that last call to writeByte returning doesn’t mean that the SPI hardware has finished writing data out.

On the teensy 3/3.1 when releasing the harwdare SPI, we completely disable it (to allow for using/abusing combinations of SPI pins/devices, I have a longer post coming up on a particularly fun abuse of this for the teensy 3.1 :). However, since that immediately shuts down the hardware SPI, it may be doing it before that last few bytes of clock strobing get written out. Oops. The solution is to make sure that the SPI data has been all written out before releasing it.

Go enjoy another chocolate Easter bunny @Daniel_Garcia . Thanks for the fast fix, and under the hood info.