spi: update examples to use the new GDMA driver

This commit is contained in:
Marius Vikhammer
2021-04-15 14:41:01 +08:00
parent 83445ba63e
commit 4de9cbcf0f
4 changed files with 8 additions and 20 deletions

View File

@@ -69,15 +69,12 @@ Pins in use. The SPI Master can use the GPIO mux, so feel free to change these i
#ifdef CONFIG_IDF_TARGET_ESP32
#define SENDER_HOST HSPI_HOST
#define DMA_CHAN 2
#elif defined CONFIG_IDF_TARGET_ESP32S2
#define SENDER_HOST SPI2_HOST
#define DMA_CHAN SENDER_HOST
#elif defined CONFIG_IDF_TARGET_ESP32C3
#define SENDER_HOST SPI2_HOST
#define DMA_CHAN SENDER_HOST
#define SENDER_HOST SPI2_HOST
#endif
@@ -156,7 +153,7 @@ void app_main(void)
gpio_isr_handler_add(GPIO_HANDSHAKE, gpio_handshake_isr_handler, NULL);
//Initialize the SPI bus and add the device we want to send stuff to.
ret=spi_bus_initialize(SENDER_HOST, &buscfg, DMA_CHAN);
ret=spi_bus_initialize(SENDER_HOST, &buscfg, SPI_DMA_CH_AUTO);
assert(ret==ESP_OK);
ret=spi_bus_add_device(SENDER_HOST, &devcfg, &handle);
assert(ret==ESP_OK);