lvgl_helpers: Fix compilation error when using ESP-IDF v4.3 or below

This commit is contained in:
C47D 2021-06-22 13:05:58 -05:00
parent aff7d1fd18
commit b70d2dc151

View file

@ -202,14 +202,21 @@ bool lvgl_i2c_driver_init(int port, int sda_pin, int scl_pin, int speed_hz)
return ESP_OK != err;
}
/* Initialize spi bus master */
/* Initialize spi bus master
*
* NOTE: dma_chan type and value changed to int instead of spi_dma_chan_t
* for backwards compatibility with ESP-IDF versions prior v4.3.
*
* We could use the ESP_IDF_VERSION_VAL macro available in the "esp_idf_version.h"
* header available since ESP-IDF v4.
*/
bool lvgl_spi_driver_init(int host,
int miso_pin, int mosi_pin, int sclk_pin,
int max_transfer_sz,
int dma_channel,
int quadwp_pin, int quadhd_pin)
{
spi_dma_chan_t dma_chan = SPI_DMA_DISABLED;
int dma_chan = 0 /* SPI_DMA_DISABLED */;
#if defined (CONFIG_IDF_TARGET_ESP32)
assert((SPI_HOST <= host) && (VSPI_HOST >= host));
@ -231,7 +238,7 @@ bool lvgl_spi_driver_init(int host,
"SPI1_HOST", "SPI2_HOST", "SPI3_HOST"
};
dma_chan = SPI_DMA_CH_AUTO;
dma_chan = 3 /* SPI_DMA_CH_AUTO */;
#else
#error "Target chip not selected"
#endif