中级会员
 
- 积分
- 240
- 金钱
- 240
- 注册时间
- 2017-7-1
- 在线时间
- 63 小时
|
1金钱
本帖最后由 beiqibing 于 2017-8-14 15:28 编辑
代码中的
if((((c[index] & ((0x80 << ((LCD_Currentfonts->Width / 12 ) * 8 ) ) >> counter)) == 0x00) &&(LCD_Currentfonts->Width <= 12))||
(((c[index] & (0x1 << counter)) == 0x00)&&(LCD_Currentfonts->Width > 12 )))
这段判断代码是怎么判断的 除以12 然后乘以8 又和12比较 里面的12 和8 发别代表什么??
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*2;
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 )))
{
/* Write data value to all SDRAM memory */
*(__IO uint16_t*) (CurrentFrameBuffer + (2*Xaddress) + xpos) = CurrentBackColor;
}
else
{
/* Write data value to all SDRAM memory */
*(__IO uint16_t*) (CurrentFrameBuffer + (2*Xaddress) + xpos) = CurrentTextColor;
}
Xaddress++;
}
Xaddress += (LCD_PIXEL_WIDTH - LCD_Currentfonts->Width);
}
}
|
|