Skip to content

Commit b70d2dc

Browse files
committed
lvgl_helpers: Fix compilation error when using ESP-IDF v4.3 or below
1 parent aff7d1f commit b70d2dc

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lvgl_helpers.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,21 @@ bool lvgl_i2c_driver_init(int port, int sda_pin, int scl_pin, int speed_hz)
202202
return ESP_OK != err;
203203
}
204204

205-
/* Initialize spi bus master */
205+
/* Initialize spi bus master
206+
*
207+
* NOTE: dma_chan type and value changed to int instead of spi_dma_chan_t
208+
* for backwards compatibility with ESP-IDF versions prior v4.3.
209+
*
210+
* We could use the ESP_IDF_VERSION_VAL macro available in the "esp_idf_version.h"
211+
* header available since ESP-IDF v4.
212+
*/
206213
bool lvgl_spi_driver_init(int host,
207214
int miso_pin, int mosi_pin, int sclk_pin,
208215
int max_transfer_sz,
209216
int dma_channel,
210217
int quadwp_pin, int quadhd_pin)
211218
{
212-
spi_dma_chan_t dma_chan = SPI_DMA_DISABLED;
219+
int dma_chan = 0 /* SPI_DMA_DISABLED */;
213220

214221
#if defined (CONFIG_IDF_TARGET_ESP32)
215222
assert((SPI_HOST <= host) && (VSPI_HOST >= host));
@@ -231,7 +238,7 @@ bool lvgl_spi_driver_init(int host,
231238
"SPI1_HOST", "SPI2_HOST", "SPI3_HOST"
232239
};
233240

234-
dma_chan = SPI_DMA_CH_AUTO;
241+
dma_chan = 3 /* SPI_DMA_CH_AUTO */;
235242
#else
236243
#error "Target chip not selected"
237244
#endif

0 commit comments

Comments
 (0)