Skip to content

Commit 27fb38d

Browse files
committed
feat: add ESP-IDF 6.0 GDMA compatibility
1 parent e35156f commit 27fb38d

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

components/hub75/src/platforms/gdma/gdma_dma.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,23 @@ bool GdmaDma::init() {
135135
configure_gpio();
136136

137137
// Allocate GDMA channel
138-
gdma_channel_alloc_config_t dma_alloc_config = {.sibling_chan = nullptr,
139-
.direction = GDMA_CHANNEL_DIRECTION_TX,
140-
.flags = {.reserve_sibling = 0
138+
gdma_channel_alloc_config_t dma_alloc_config = {
139+
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
140+
.sibling_chan = nullptr,
141+
.direction = GDMA_CHANNEL_DIRECTION_TX,
142+
#endif
143+
.flags = {
144+
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
145+
.reserve_sibling = 0,
146+
#endif
141147
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
142-
,
143-
.isr_cache_safe = 0
148+
.isr_cache_safe = 0
144149
#endif
145-
}};
150+
}};
146151

147-
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
152+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
153+
esp_err_t err = gdma_new_ahb_channel(&dma_alloc_config, &dma_chan_, nullptr);
154+
#elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
148155
esp_err_t err = gdma_new_ahb_channel(&dma_alloc_config, &dma_chan_);
149156
#else
150157
esp_err_t err = gdma_new_channel(&dma_alloc_config, &dma_chan_);

0 commit comments

Comments
 (0)