Various updates

RM68120 support for RP2040 added
Various other updates and typo corrections
This commit is contained in:
Bodmer committed 2023-02-20 19:03:44 +00:00
1 parent 0bad8c7acc
commit 34850973a0
20 files changed
+466 -501

No files matched your search

+24 -5
View File
@@ -41,11 +41,11 @@
#endif
#else
#ifdef USE_HSPI_PORT
#define DMA_CHANNEL 2
spi_host_device_t spi_host = (spi_host_device_t) DMA_CHANNEL; // Draws once then freezes
#define DMA_CHANNEL SPI_DMA_CH_AUTO
spi_host_device_t spi_host = (spi_host_device_t) SPI3_HOST; // Draws once then freezes
#else // use FSPI port
#define DMA_CHANNEL 1
spi_host_device_t spi_host = (spi_host_device_t) DMA_CHANNEL; // Draws once then freezes
#define DMA_CHANNEL SPI_DMA_CH_AUTO
spi_host_device_t spi_host = (spi_host_device_t) SPI2_HOST; // Draws once then freezes
#endif
#endif
#endif
@@ -767,6 +767,17 @@ void IRAM_ATTR dc_callback(spi_transaction_t *spi_tx)
else {DC_C;}
}
/***************************************************************************************
** Function name: dma_end_callback
** Description: Clear DMA run flag to stop retransmission loop
***************************************************************************************/
extern "C" void dma_end_callback();
void IRAM_ATTR dma_end_callback(spi_transaction_t *spi_tx)
{
WRITE_PERI_REG(SPI_DMA_CONF_REG(spi_host), 0);
}
/***************************************************************************************
** Function name: initDMA
** Description: Initialise the DMA engine - returns true if init OK
@@ -782,6 +793,10 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
.sclk_io_num = TFT_SCLK,
.quadwp_io_num = -1,
.quadhd_io_num = -1,
.data4_io_num = -1,
.data5_io_num = -1,
.data6_io_num = -1,
.data7_io_num = -1,
.max_transfer_sz = TFT_WIDTH * TFT_HEIGHT * 2 + 8, // TFT screen size
.flags = 0,
.intr_flags = 0
@@ -804,7 +819,11 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
.flags = SPI_DEVICE_NO_DUMMY, //0,
.queue_size = 1,
.pre_cb = 0, //dc_callback, //Callback to handle D/C line
.post_cb = 0
#ifdef CONFIG_IDF_TARGET_ESP32
.post_cb = 0
#else
.post_cb = dma_end_callback
#endif
};
ret = spi_bus_initialize(spi_host, &buscfg, DMA_CHANNEL);
ESP_ERROR_CHECK(ret);
+7 -2
View File
@@ -165,8 +165,13 @@
#define DC_C WAIT_FOR_STALL; \
tft_pio->sm[pio_sm].instr = pio_instr_clr_dc
// Flush has happened before this and mode changed back to 16 bit
#define DC_D tft_pio->sm[pio_sm].instr = pio_instr_set_dc
#ifndef RM68120_DRIVER
// Flush has happened before this and mode changed back to 16 bit
#define DC_D tft_pio->sm[pio_sm].instr = pio_instr_set_dc
#else
// Need to wait for stall since RM68120 commands are 16 bit
#define DC_D WAIT_FOR_STALL; tft_pio->sm[pio_sm].instr = pio_instr_set_dc
#endif
#endif
#endif