Skip to content

Commit

Permalink
fix: DMA channel picking on S3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tasssadar committed Nov 25, 2024
1 parent de331ca commit 8a4663e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/SmartLeds.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,10 @@ class SmartLed {

#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)
#define _SMARTLEDS_SPI_HOST SPI2_HOST
#define _SMARTLEDS_SPI_DMA_CHAN SPI_DMA_CH_AUTO
#else
#define _SMARTLEDS_SPI_HOST HSPI_HOST
#define _SMARTLEDS_SPI_DMA_CHAN 1
#endif

class Apa102 {
Expand Down Expand Up @@ -247,7 +249,7 @@ class Apa102 {
devcfg.queue_size = TRANS_COUNT;
devcfg.pre_cb = nullptr;

auto ret = spi_bus_initialize(_SMARTLEDS_SPI_HOST, &buscfg, 1);
auto ret = spi_bus_initialize(_SMARTLEDS_SPI_HOST, &buscfg, _SMARTLEDS_SPI_DMA_CHAN);
assert(ret == ESP_OK);

ret = spi_bus_add_device(_SMARTLEDS_SPI_HOST, &devcfg, &_spi);
Expand Down Expand Up @@ -375,7 +377,7 @@ class LDP8806 {
devcfg.queue_size = TRANS_COUNT_MAX;
devcfg.pre_cb = nullptr;

auto ret = spi_bus_initialize(_SMARTLEDS_SPI_HOST, &buscfg, 1);
auto ret = spi_bus_initialize(_SMARTLEDS_SPI_HOST, &buscfg, _SMARTLEDS_SPI_DMA_CHAN);
assert(ret == ESP_OK);

ret = spi_bus_add_device(_SMARTLEDS_SPI_HOST, &devcfg, &_spi);
Expand Down

0 comments on commit 8a4663e

Please sign in to comment.