高中生
最后登录1970-1-1
在线时间 小时
注册时间2018-9-19
|
/**
* @brief Function for mixing up 2 colors with the given intensity.
* If the background color is completely transparent the
* foreground color should be used unchanged.
* @param Color
* @param BkColor
* @param Intens
* @retval LCD_COLOR
*/
static LCD_COLOR DMA_MixColors(LCD_COLOR Color, LCD_COLOR BkColor, U8 Intens)
{
uint32_t ColorFG, ColorBG, ColorDst;
if ((BkColor & 0xFF000000) == 0xFF000000)
{
return Color;
}
ColorFG = Color ^ 0xFF000000;
ColorBG = BkColor ^ 0xFF000000;
/* Set up mode */
DMA2D->CR = 0x00020000UL | (1 << 9); /* Control Register (Memory to memory with blending of FG and BG and TCIE) */
/* Set up pointers */
DMA2D->FGMAR = (uint32_t)&ColorFG; /* Foreground Memory Address Register */
DMA2D->BGMAR = (uint32_t)&ColorBG; /* Background Memory Address Register */
DMA2D->OMAR = (uint32_t)&ColorDst; /* Output Memory Address Register (Destination address) */
/* Set up pixel format */
DMA2D->FGPFCCR = LTDC_Pixelformat_ARGB8888
| (1UL << 16)
| ((uint32_t)Intens << 24);
DMA2D->BGPFCCR = LTDC_Pixelformat_ARGB8888
| (0UL << 16)
| ((uint32_t)(255 - Intens) << 24);
DMA2D->OPFCCR = LTDC_Pixelformat_ARGB8888;
/* Set up size */
DMA2D->NLR = (uint32_t)(1 << 16) | 1; /* Number of Line Register (Size configuration of area to be transfered) */
/* Execute operation */
DMA2D->CR |= DMA2D_CR_START; /* Control Register (Start operation) */
/* Wait until transfer is done */
while (DMA2D->CR & DMA2D_CR_START)
{
}
return (ColorDst ^ 0xFF000000);
}
/***************************************************/
其中的
ColorFG = Color ^ 0xFF000000;
ColorBG = BkColor ^ 0xFF000000;
两句为什么要这么处理?
|
|