標(biāo)題: STM32在tft不帶字庫的時候顯示漢字的程序 [打印本頁]

作者: 666555888    時間: 2019-5-26 17:33
標(biāo)題: STM32在tft不帶字庫的時候顯示漢字的程序
/*******************************************************
* Name      : 寫漢字函數(shù)32*32
* Parameter : x  :x坐標(biāo)
                          y  :y坐標(biāo)
                          *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, 下載次數(shù): 48, 下載積分: 黑幣 -5


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




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1