硬汉嵌入式论坛

 找回密码
 立即注册
查看: 4389|回复: 5
收起左侧

[有问必答] LCD_DrawChar函数问题

[复制链接]

24

主题

27

回帖

99

积分

初级会员

积分
99
发表于 2017-8-14 15:30:18 | 显示全部楼层 |阅读模式
代码中的
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);
  }
}
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117586
QQ
发表于 2017-8-14 16:10:55 | 显示全部楼层
这个函数在哪里找到的,我怎么没什么印象。是我们的工程代码吗
回复

使用道具 举报

24

主题

27

回帖

99

积分

初级会员

积分
99
 楼主| 发表于 2017-8-14 16:12:16 | 显示全部楼层

回 eric2013 的帖子

eric2013:这个函数在哪里找到的,我怎么没什么印象。是我们的工程代码吗 (2017-08-14 16:10) 
st官方的例程里面
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117586
QQ
发表于 2017-8-14 16:21:32 | 显示全部楼层

回 beiqibing000 的帖子

beiqibing000:st官方的例程里面 (2017-08-14 16:12) 
看不懂,你可以代数法,代入一个点阵大小的字符算算。
回复

使用道具 举报

24

主题

27

回帖

99

积分

初级会员

积分
99
 楼主| 发表于 2017-8-14 18:05:29 | 显示全部楼层

回 eric2013 的帖子

eric2013:看不懂,你可以代数法,代入一个点阵大小的字符算算。 (2017-08-14 16:21) 
想搞一个LED的字体显示   取了字模数组  存在内部flash中   不知道怎么显示英文    请问有显示英文的函数吗
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117586
QQ
发表于 2017-8-15 10:22:17 | 显示全部楼层

回 beiqibing000 的帖子

beiqibing000:想搞一个LED的字体显示   取了字模数组  存在内部flash中   不知道怎么显示英文    请问有显示英文的函数吗  (2017-08-14 18:05) 
可以看这个帖子里面的小字库:
https://forum.anfulai.cn/forum.php?mod=viewthread&tid=14909
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-8-17 06:49 , Processed in 0.038817 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表