Skip to content

Commit 7a8f44b

Browse files
committed
fixes SPIBus invalid argument
1 parent 905b783 commit 7a8f44b

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

ext_mod/lcd_bus/esp32_src/spi_bus.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -254,24 +254,12 @@ mp_lcd_err_t spi_init(mp_obj_t obj, uint16_t width, uint16_t height, uint8_t bpp
254254
self->panel_io_config.trans_queue_depth = 10;
255255
}
256256

257-
int dma_chan = 0;
258-
259-
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3
260-
dma_chan = SPI_DMA_CH_AUTO;
261-
#else
262-
if (self->host == SPI2_HOST) {
263-
dma_chan = 1;
264-
} else {
265-
dma_chan = 2;
266-
}
267-
#endif
268-
269-
mp_lcd_err_t ret = spi_bus_initialize(self->host, &self->bus_config, dma_chan);
257+
mp_lcd_err_t ret = spi_bus_initialize(self->host, &self->bus_config, SPI_DMA_CH_AUTO);
270258
if (ret != 0) {
271259
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("%d(spi_bus_initialize)"), ret);
272260
}
273261

274-
ret = esp_lcd_new_panel_io_spi(self->bus_handle, &self->panel_io_config, self->panel_io_handle.panel_io);
262+
ret = esp_lcd_new_panel_io_spi(self->bus_handle, &self->panel_io_config, &self->panel_io_handle.panel_io);
275263
if (ret != 0) {
276264
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("%d(esp_lcd_new_panel_io_spi)"), ret);
277265
}

0 commit comments

Comments
 (0)