smart-leds-rs / apa102-spi-rs

SPI-based Driver for apa102 leds
Apache License 2.0
8 stars 5 forks source link

Fix SPI mode (should be CPOL = 0, CPHA = 0) #5

Closed twitchyliquid64 closed 5 years ago

twitchyliquid64 commented 5 years ago

Fixes #4

sajattack commented 5 years ago

Citation needed.

twitchyliquid64 commented 5 years ago

Have a look at the first logic analyzer capture: https://cpldcpu.wordpress.com/2014/11/30/understanding-the-apa102-superled/

Page 4 of the datasheet seems to show the rising edge of the clock: https://cdn-shop.adafruit.com/datasheets/APA102.pdf

Adafruit's library sets it to mode 0: https://github.com/adafruit/Adafruit_DotStar/blob/master/Adafruit_DotStar.cpp#L188

therealprof commented 5 years ago

@twitchyliquid64 I thought this SPI mode didn't work for you either?

twitchyliquid64 commented 5 years ago

@therealprof I found a bug in the SPI HAL I was using.

therealprof commented 5 years ago

Oh, good to know.