标题: STM32在tft不带字库的时候显示汉字的程序 [打印本页]

作者: 666555888    时间: 2019-5-26 17:33
标题: STM32在tft不带字库的时候显示汉字的程序
/*******************************************************
* Name      : 写汉字函数32*32
* Parameter : x  :x坐标
                          y  :y坐标
                          *p :汉字串
                          wordColor:字体颜色
                          backColor:背景颜色
* Return    : void
* Function  : 写汉字*******************************************************/
void LCD_ShowChinese(uint16_t x, uint16_t y, uint8_t *p, uint16_t wordColor, uint16_t backColor)
{       
        uint16_t tPOINT_COLOR = POINT_COLOR,tBACK_COLOR=BACK_COLOR ;//记录原先的前景色、后景色
        uint8_t wordByte ;
        uint16_t wordNum;
        uint8_t color;
        u8 k=0;

        while(*p != '\0')
        {
                for(wordNum=0;wordNum<CH_MAX_INDEX_32;wordNum++)
                {
                        if(*p==GB_32[wordNum].Index[0] && *(p+1)==GB_32[wordNum].Index[1])
                        {
                                for(wordByte = 0;wordByte < 128; wordByte++)
                                {
                                        color = GB_32[wordNum].Msk[wordByte];
                                        for ( k = 0;k<8; k++)
                                        {
                                                if ((color&0x80) == 0x80)
                                                {
                                                        POINT_COLOR = wordColor;
                                                        LCD_DrawPoint(x+wordByte/4,y+k+((wordByte)%4)*8);
                                                }
                                                else
                                                {
                                                        POINT_COLOR = backColor;
                                                        LCD_DrawPoint(x+wordByte/4,y+k+((wordByte)%4)*8);
                                                }
                                                color = color<<1;
                                        }
                                }
                                p+=2;
                                x+=32;
                                if(x>lcddev.width)
                                {
                                        x=0;
                                        y+=32;
                                }
                        }
                }
        }
       
        POINT_COLOR = tPOINT_COLOR;
        BACK_COLOR = tBACK_COLOR;
}

LCD.zip

91.32 KB, 下载次数: 46, 下载积分: 黑币 -5


作者: a1098834549    时间: 2019-10-19 14:34
sys.h 是什么缺失的文件




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1