小学生
最后登录1970-1-1
在线时间 小时
注册时间2018-8-22
|
void LCD_DispChar_CH ( uint16_t usX, uint16_t usY, uint16_t usChar)
{
uint8_t ucPage, ucColumn;
uint8_t ucBuffer [ 24*24/8 ];
uint32_t usTemp;
uint32_t xpos =0;
uint32_t Xaddress = 0;
if(Ltdc_Handler.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565)
{ /* RGB565 format */
/*xpos表示当前行的显存偏移位置*/
xpos = usX*XSIZE_PHYS*2;
}
else
{ /* ARGB8888 format */
/*xpos表示当前行的显存偏移位置*/
xpos = usX*XSIZE_PHYS*4;
}
/*Xaddress表示像素点*/
Xaddress += usY;
macGetGBKCode ( ucBuffer, usChar ); //取字模数据
/*ucPage表示当前行数*/
for ( ucPage = 0; ucPage < macHEIGHT_CH_CHAR; ucPage ++ )
{
/* 取出3个字节的数据,在lcd上即是一个汉字的一行 */
usTemp = ucBuffer [ ucPage * 3 ];
usTemp = ( usTemp << 8 );
usTemp |= ucBuffer [ ucPage * 3 + 1 ];
usTemp = ( usTemp << 8 );
usTemp |= ucBuffer [ ucPage * 3 + 2];
for ( ucColumn = 0; ucColumn < macWIDTH_CH_CHAR; ucColumn ++ )
{
if ( usTemp & ( 0x01 << 23 ) ) //高位在前 (每次都在这里出现硬件错误)
{
if(Ltdc_Handler.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565)
{ /* RGB565 format */
//字体色
/* Write data value to all SDRAM memory */
*(__IO uint16_t*) (Ltdc_Handler.LayerCfg[ActiveLayer].FBStartAdress + (2*Xaddress) + xpos) = DrawProp[ActiveLayer].TextColor;
}
else
{ /* ARGB8888 format */
//字体色
/* Write data value to all SDRAM memory */
*(__IO uint32_t*) (Ltdc_Handler.LayerCfg[ActiveLayer].FBStartAdress + (4*Xaddress) + xpos) = DrawProp[ActiveLayer].TextColor;
}
}
else
{
//背景色
/* Write data value to all SDRAM memory */
if(Ltdc_Handler.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565)
{ /* RGB565 format */
//字体色
/* Write data value to all SDRAM memory */
*(__IO uint16_t*) (Ltdc_Handler.LayerCfg[ActiveLayer].FBStartAdress + (2*Xaddress) + xpos) = DrawProp[ActiveLayer].BackColor;
}
else
{ /* ARGB8888 format */
//字体色
/* Write data value to all SDRAM memory */
*(__IO uint32_t*) (Ltdc_Handler.LayerCfg[ActiveLayer].FBStartAdress + (4*Xaddress) + xpos) = DrawProp[ActiveLayer].BackColor;
}
}
/*指向当前行的下一个点*/
Xaddress++;
usTemp <<= 1;
}
/*显示完一行*/
/*指向字符显示矩阵下一行的第一个像素点*/
Xaddress += (XSIZE_PHYS - macWIDTH_CH_CHAR);
}
}
|
|