高中生
最后登录1970-1-1
在线时间 小时
注册时间2015-10-26
|
HI 火哥在使用F4板子时,看到程序LCD里面有一断程序如下:
void LCD_DrawChar(uint16_t Xpos, uint16_t Ypos, const uint16_t *c)
{
uint32_t index = 0, counter = 0, xpos =0;
uint32_t Xaddress = 0;
xpos = Xpos*LCD_PIXEL_WIDTH*3;
Xaddress += Ypos;
for(index = 0; index < LCD_Currentfonts->Height; index++)
{
for(counter = 0; counter < LCD_Currentfonts->Width; counter++)
{
if((((c[index] & ((0x80 << ((LCD_Currentfonts->Width / 12 ) * 8 ) ) >> counter)) == 0x00) &&(LCD_Currentfonts->Width <= 12))||
(((c[index] & (0x1 << counter)) == 0x00)&&(LCD_Currentfonts->Width > 12 )))
{
*(__IO uint16_t*)(CurrentFrameBuffer + (3*Xaddress) + xpos) = (0x00FFFF & CurrentBackColor); //GB
*(__IO uint8_t*)(CurrentFrameBuffer + (3*Xaddress) + xpos+2) = (0xFF0000 & CurrentBackColor) >> 16; //R
}
else
{
*(__IO uint16_t*)(CurrentFrameBuffer + (3*Xaddress) + xpos) = (0x00FFFF & CurrentTextColor); //GB
*(__IO uint8_t*)(CurrentFrameBuffer + (3*Xaddress) + xpos+2) = (0xFF0000 & CurrentTextColor) >> 16; //R
}
Xaddress++;
}
Xaddress += (LCD_PIXEL_WIDTH - LCD_Currentfonts->Width);
这个是一个点亮字符的小程序,只有最后这一句 Xaddress += (LCD_PIXEL_WIDTH - LCD_Currentfonts->Width);我没有看明白,按理说LCD_PIXEL_WIDTH应该是800,LCD_Currentfonts->Width是16。那么Xaddress为什么是这样的值?
我的解理是Xaddress 应该跳到此时Xpos+1的Ypos列。请指点下,谢谢!
|
|