-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers/ws281x: simple DMA implementation through SPI #20218
base: master
Are you sure you want to change the base?
Conversation
1fe581c
to
b32008d
Compare
drivers/ws281x/spi.c
Outdated
spiconf.dev = SPI_DEV(0); | ||
spiconf.mode = SPI_MODE_0; | ||
spiconf.clk = 4000000; | ||
spiconf.cs = SPI_HWCS(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those should be configurable (and why do you need a chip select?)
Would it be possible to extend ws281x_t
so we could have multiple instances of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made them configurable at compile time, but this doesn't allow multiple instances, which would have been great. The other compile time parameters WS281X_PARAM_PIN and WS281X_PARAM_NUMOF also prevent multiple instances. I don't know how to handle it properly.
f21d6c5
to
e1ba808
Compare
e1ba808
to
0fb47e8
Compare
Please rebase - you can drop the ESP8266 changes now. |
Contribution description
This is a simple way to drive the ws1812b using DMA through SPI. I tested it on a nucleo-f303k8 but it should work on any MCU with similar SPI/DMA peripherals and a 2.4 to 4 MHz SPI clock. It uses 0b1110 for bit '1' and 0b1000 for bit '0' which effectively divides the frequency by 4. However, this requires the generation of a buffer copy of four times the buffer size.
Testing procedure
ws2812b_edit.mp4
Issues/PRs references
https://forum.riot-os.org/t/spi-through-dma/4083