drivers/ws281x: simple DMA implementation through SPI#20218
Closed
hugueslarrive wants to merge 10 commits intoRIOT-OS:masterfrom
Closed
drivers/ws281x: simple DMA implementation through SPI#20218hugueslarrive wants to merge 10 commits intoRIOT-OS:masterfrom
hugueslarrive wants to merge 10 commits intoRIOT-OS:masterfrom
Conversation
1fe581c to
b32008d
Compare
benpicco
reviewed
Jan 2, 2024
benpicco
reviewed
Jan 30, 2024
drivers/ws281x/spi.c
Outdated
| spiconf.dev = SPI_DEV(0); | ||
| spiconf.mode = SPI_MODE_0; | ||
| spiconf.clk = 4000000; | ||
| spiconf.cs = SPI_HWCS(0); |
Contributor
There was a problem hiding this comment.
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?
Contributor
Author
There was a problem hiding this comment.
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
benpicco
reviewed
Feb 21, 2024
Contributor
|
Please rebase - you can drop the ESP8266 changes now. |
Open
Contributor
|
Picked up by #22003. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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