Code: Select all
if (area > 1000) { // Do not use DMA for small areas
dmaStreamSetPeripheral(LCD_DMA_STREAM, &color);
dmaStreamSetMemory0(LCD_DMA_STREAM, LCD_RAM);
uint32_t i;
uint16_t splitarea;
for (i = (area/65535)+1; i > 0; i--) {
if (i <= 1) splitarea = area%65535;
else splitarea = 65535;
dmaStreamSetTransactionSize(LCD_DMA_STREAM, splitarea);
dmaStreamSetMode(LCD_DMA_STREAM, STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M | STM32_DMA_CR_EN);
while ((LCD_DMA_STREAM)->stream->NDTR > 0) chThdSleepMilliseconds(5);
}
}
else {
for(index = 0; index < area; index++)
GDISP_LLD(writedata)(color);
}
This function has to copy the content of a variable to the FSMC, no need to increase any address since the data has to remain the same. (just filling rectangles)
So basically I'm waiting for completion since the GLCD library runs on another thread.
Is that correct?
Thanks.