Skip to main content
kulfi27
Associate II
February 27, 2020
Question

Configuration DMA2D pixel format conversion with blending

  • February 27, 2020
  • 2 replies
  • 1093 views

Hello, I have a problem with the configuration of the DMA2D peripheral, namely after decoding the JPG image I change the BMP format to RGB565 it works without a problem, now on the picture I would like to display the icon and here I have a problem whether the photo should be configured as background and icon as foregrund and what input format should be icons. Regards

This topic has been closed for replies.

2 replies

turboscrew
Senior III
February 28, 2020

"On the picture" implies that the picture is background. The icon format depends on the way you handle them. I would probably use alpha-masks and draw them in "color layers" - that makes changes in coloring easier - like when an icon is clicked, its borders could change. That just tends to take more space.

kulfi27
kulfi27Author
Associate II
March 27, 2020

Hello, I still haven't been able to properly start DMA2D, below the photo and configuration, maybe someone will be able to show me where I am making a mistake.

	 DMA2D->CR = DMA2D_CR_MODE_1; // Mem to Mem with Blending
	 DMA2D->OPFCCR = DMA2D_OPFCCR_CM_1; // out format RGB565
	 DMA2D->FGPFCCR = 0xff000000|DMA2D_FGPFCCR_CM_1; // foreg. in format RGB565
	 // DMA2D->FGCOLR = 0x00050605; // color register foregrund 565
	 DMA2D->FGOR = 0x00000000; // ofset foregrund
	 DMA2D->OOR = 0x0000017c; // output ofset 380
	 DMA2D->NLR = 0x00640064; // size of ikons 100*100
	 DMA2D->OMAR = (uint32_t )(LCD_FRAME_BUFFER+45300); // out buf plus ofset
	 DMA2D->FGMAR = (uint32_t )(ikon); // in ikon foregrund
 
	 DMA2D->BGMAR = (uint32_t )LCD_FRAME_BUFFER; // in picture backgrund
	 // DMA2D->BGOR = 0x000000ff;
	 DMA2D->BGPFCCR = 0xff000000|DMA2D_BGPFCCR_CM_1; // backg. in format RGB565
	 // DMA2D->BGCOLR = 0x00050605; // color register backgrund 565
	 // DMA2D->OOR = 0x000000ff;
 
	 DMA2D->CR |= DMA2D_CR_START;
 
	 tft_cls(BLACK);
 
	 tft_bitmap(0,0,(uint16_t*)LCD_FRAME_BUFFER,480,272);

0693W000000UtNZQA0.jpg