/**
* @brief 在 ILI9341 显示器上显示中英文字符串
* @param usX :在特定扫描方向下字符串的起始X坐标
* @param usY :在特定扫描方向下字符串的起始Y坐标
* @param pStr :要显示的字符串的首地址
* @param usColor_Background :选择字符串的背景色
* @param usColor_Background :选择字符串的前景色
* @retval 无
*/
void ILI9341_DispString_EN_CH ( uint16_t usX, uint16_t usY, const uint8_t * pStr, uint16_t usColor_Background, uint16_t usColor_Foreground )
{
uint16_t usCh;
while( * pStr != '\0' )
{
if ( * pStr <= 126 ) //英文字符
{
if ( ( usX - macILI9341_DispWindow_X_Star + macWIDTH_EN_CHAR ) > macILI9341_DispWindow_COLUMN )
{
usX = macILI9341_DispWindow_X_Star;
usY += macHEIGHT_EN_CHAR;
}
if ( ( usY - macILI9341_DispWindow_Y_Star + macHEIGHT_EN_CHAR ) > macILI9341_DispWindow_PAGE )
{
usX = macILI9341_DispWindow_X_Star;
usY = macILI9341_DispWindow_Y_Star;
}
ILI9341_DispChar_EN ( usX, usY, * pStr, usColor_Background, usColor_Foreground );
usX += macWIDTH_EN_CHAR;
pStr ++;
}
else //汉字字符
{
if ( ( usX - macILI9341_DispWindow_X_Star + macWIDTH_CH_CHAR ) > macILI9341_DispWindow_COLUMN )
{
usX = macILI9341_DispWindow_X_Star;
usY += macHEIGHT_CH_CHAR;
}
if ( ( usY - macILI9341_DispWindow_Y_Star + macHEIGHT_CH_CHAR ) > macILI9341_DispWindow_PAGE )
{
usX = macILI9341_DispWindow_X_Star;
usY = macILI9341_DispWindow_Y_Star;
}
usCh = * ( uint16_t * ) pStr;
usCh = ( usCh << 8 ) + ( usCh >> 8 );
ILI9341_DispChar_CH ( usX, usY, usCh, usColor_Background, usColor_Foreground );
usX += macWIDTH_CH_CHAR;
pStr += 2; //一个汉字两个字节
}
}
}
|