diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2020-11-29 00:50:10 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2020-11-29 00:50:10 -0700 |
commit | 1ec4e164df03fae8c42fd7aea2614fa836bcc2d7 (patch) | |
tree | bf80e5375a26bbb5504ffd64a8b08bb7a0bbbfa4 /include/drv/ws2812B/ws2812b.h | |
parent | fd674424d19cf12c1186394606729cff236d5bdf (diff) | |
download | stm32l4-1ec4e164df03fae8c42fd7aea2614fa836bcc2d7.tar.gz stm32l4-1ec4e164df03fae8c42fd7aea2614fa836bcc2d7.tar.bz2 stm32l4-1ec4e164df03fae8c42fd7aea2614fa836bcc2d7.zip |
Have a stable red/green pattern on my LED strip.
I finally got a stable red/green pattern to show up on the LED strip.
Unfortunately I had to do this manually because my driver is broken. No
Dma, interrupts or drivers, but manually writing to the spi bus.
Currently the driver assums the data sheet doesn't lie and inflates each
bit 3:1 so a 1 is a 110 pattern and a 0 is a 100 pattern. This should be
well within the tolerances at 2.5Mhz, but alas it's not.
I figured out that it's better to inflate each bit to a 4:1 ratio so a 1
is a 1100 pattern and a 0 is a 1000 pattern. This appears to produce
cleaner results.
Diffstat (limited to 'include/drv/ws2812B/ws2812b.h')
-rw-r--r-- | include/drv/ws2812B/ws2812b.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/drv/ws2812B/ws2812b.h b/include/drv/ws2812B/ws2812b.h index cdbb41a..bc86cc5 100644 --- a/include/drv/ws2812B/ws2812b.h +++ b/include/drv/ws2812B/ws2812b.h @@ -15,4 +15,7 @@ static_assert(sizeof(rgb_t) == 3, "Sizeof rgb_t should be 3."); uint8_t* ws2812b_compile_rgb(rgb_t* out, size_t arr_len); +/* Returns sin((n - 128) / 256) * 256. */ +uint8_t byte_sin(uint8_t n); + #endif /* WS2812B_H_ */ |