|
|
@ -45,7 +45,6 @@ |
|
|
|
#define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000) |
|
|
|
#define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE ((uint16_t)0x0200) |
|
|
|
|
|
|
|
|
|
|
|
void SDRAM_Initialization_Sequence(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command) { |
|
|
|
|
|
|
|
__IO uint32_t tmpmrd =0; |
|
|
@ -289,22 +288,21 @@ void TFT_LTDC::DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint |
|
|
|
uint16_t offline = TFT_WIDTH - (ex - sx); |
|
|
|
uint32_t addr = (uint32_t)&framebuffer[(TFT_WIDTH * sy) + sx]; |
|
|
|
|
|
|
|
DMA2D->CR &= ~(1 << 0); |
|
|
|
CBI(DMA2D->CR, 0); |
|
|
|
DMA2D->CR = 3 << 16; |
|
|
|
DMA2D->OPFCCR = 0X02; |
|
|
|
DMA2D->OOR = offline; |
|
|
|
DMA2D->OMAR = addr; |
|
|
|
DMA2D->NLR = (ey - sy) | ((ex - sx) << 16); |
|
|
|
DMA2D->OCOLR = color; |
|
|
|
DMA2D->CR |= 1<<0; |
|
|
|
SBI(DMA2D->CR, 0); |
|
|
|
|
|
|
|
uint32_t timeout = 0; |
|
|
|
while((DMA2D->ISR & (1<<1)) == 0) |
|
|
|
{ |
|
|
|
while (!TEST(DMA2D->ISR, 1)) { |
|
|
|
timeout++; |
|
|
|
if(timeout>0X1FFFFF)break; |
|
|
|
if (timeout > 0x1FFFFF) break; |
|
|
|
} |
|
|
|
DMA2D->IFCR |= 1<<1; |
|
|
|
SBI(DMA2D->IFCR, 1); |
|
|
|
} |
|
|
|
|
|
|
|
void TFT_LTDC::DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors) { |
|
|
@ -314,7 +312,7 @@ void TFT_LTDC::DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uin |
|
|
|
uint16_t offline = TFT_WIDTH - (ex - sx); |
|
|
|
uint32_t addr = (uint32_t)&framebuffer[(TFT_WIDTH * sy) + sx]; |
|
|
|
|
|
|
|
DMA2D->CR &= ~(1 << 0); |
|
|
|
CBI(DMA2D->CR, 0) |
|
|
|
DMA2D->CR = 0 << 16; |
|
|
|
DMA2D->FGPFCCR = 0X02; |
|
|
|
DMA2D->FGOR = 0; |
|
|
@ -322,15 +320,14 @@ void TFT_LTDC::DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uin |
|
|
|
DMA2D->FGMAR = (uint32_t)colors; |
|
|
|
DMA2D->OMAR = addr; |
|
|
|
DMA2D->NLR = (ey - sy) | ((ex - sx) << 16); |
|
|
|
DMA2D->CR |= 1<<0; |
|
|
|
SBI(DMA2D->CR, 0); |
|
|
|
|
|
|
|
uint32_t timeout = 0; |
|
|
|
while((DMA2D->ISR & (1<<1)) == 0) |
|
|
|
{ |
|
|
|
while (!TEST(DMA2D->ISR, 1)) { |
|
|
|
timeout++; |
|
|
|
if(timeout>0X1FFFFF)break; |
|
|
|
if (timeout > 0x1FFFFF) break; |
|
|
|
} |
|
|
|
DMA2D->IFCR |= 1<<1; |
|
|
|
SBI(DMA2D->IFCR, 1); |
|
|
|
} |
|
|
|
|
|
|
|
void TFT_LTDC::WriteData(uint16_t data) { |
|
|
|