📄 drvlcd_driver.cqm.c
字号:
}
void LcdGetHZBMP(U8 kQu, U8 kWei, U8 *buff) //取其他字模
{
int offset;
offset = (int)((U32)(kQu)*256+(U32)(kWei))*24+108932+4+19008;
PSA_AccessReservedArea((char *)buff, offset, 24);
}
#if 1
void drvLcd_PrintfChineseCharacter(U8 kPage,U8 kColumn,U8 kReverseDisplay,const U8 *pkPointer)
{
U8 count;
U8 buff[24];
U8 kHZQu, kHZWei;
//U8 *tempstring;
//i=0;
U8 pStrBuf[50]={0};
int i = 0,j = 0;
U16 k=0;
char c,m;
count=0;
while((c = *pkPointer++)!='\0')
{
if(c<0x80)
{
pStrBuf[j] = 0x00;
pStrBuf[j+1] = c;
//i++;
}
else
{
m = *pkPointer++;
k = (U16)((((U16)c)<<8) | ((U8)m));
k=GetCodeFromFlash1(k);
pStrBuf[j]=(char)((k&0xff00)>>8);
pStrBuf[j+1] =(char)(k&0x00ff);
}
j=j+2;
}
// gbk2unicode1((char *)pkPointer,(char *)tempstring);
i=0;
while(*(pStrBuf+i)!='\0')
{
kHZQu=*(pStrBuf+i);
kHZWei=*(pStrBuf+i+1);
LcdGetHZBMP(kHZQu,kHZWei,buff);
//LcdChineseCharacter((U8)(kPage),(kColumn+count*12),kReverseDisplay,(U8 *)buff);
drvLcd_WirteChar1((U8)(kPage),(U8)(kColumn+count*12),kReverseDisplay,(U8 *)buff);
count++;
i=i+2;
//if(i>=12)
// break;
}
}
#endif
/***********************************************************************************
* Function : fmDisplayBlinkInit
* Description : initialize for LCD Blinking,get some info for blinking
* input parameters : Page,Column,*String
* return parameter : none
************************************************************************************/
void drvLcd_BlinkInit(U8 kPage,U8 kColumn,const U8 *pString )
{
U16 i;
U8 Slength;
gBlink_on=1;
gfmBlinkSwitch=0;
if(gShift_on&&(gfmPage==kPage))
return;
gfmPage=kPage;
gfmColumn=kColumn;
Slength=TestWideString(pString);
//gpString=(U8 *)malloc(Slength+2);
//if ( gpString != NULL)
//{
for ( i =0; i < Slength; i ++)
{
*(gpString +i) = *(pString +i);
}
gpString[Slength] = 0;
gpString[Slength-1] = 0;
//}
//gpString[i] = 0;
//gpString[i+1] = 0;
//strcpy((char *)gpString,(char*)pString);
}
/***********************************************************************************
* Function : fmDisplayBlink
* Description : LCD Blinking Process,alternate between blank
* and display string
* input parameters : none
* return parameter : none
************************************************************************************/
void drvLcd_Blink(void)
{
U8 slength,pcount;
pcount=0;
if(gBlink_on==0) return;
gfmBlinkSwitch^=1;
slength=strlen((char*)gpString);
if(gfmBlinkSwitch){
//for(i=0;i<16;i++)
//{
//drvLcd_SetPageColumn( gfmPage, gfmColumn);
// displaybyte(gfmPage,(gfmColumn+cont),0xff,0xff,0xff);
// }
//for(i=0;i<2;i++){
// drvLcd_SetPageColumn( gfmPage+i, gfmColumn);
// for(j=0;j<slength*8;j++)
// drvLcd_WriteData(0x00);
// }
drvLcd_ClearLine(gfmPage);
}
else
drvLcd_DisplayString(gfmPage, gfmColumn, 0, gpString, &pcount,1);
}
/***********************************************************************************
* Function : fmDisplayShiftInit
* Description : initialize for LCD shifting,get some info for shifting
* input parameters : Page,Column,*String
* return parameter : none
************************************************************************************/
void drvLcd_ShiftInit(U8 kPage, U8 kColumn,const U8 *pString)
{
U8 Slength;
int i;
gShift_i=0;
gShift_on=1;
gfmPage=kPage;
gfmColumn=kColumn;
gEngCharNum=0;
ShiftiCount = 0;
gDisplayLeftDistance = 0;
ShiftloopCount = 0;
Slength=TestWideString(pString);
//Slength=strlen((char *)pString);
//gpString=(U8 *)malloc(Slength+2);
//if ( gpString != NULL)
//{
for ( i =0; i < Slength; i ++)
{
*(gpString + i) = *(pString +i);
}
gpString[Slength] = 0;
gpString[Slength+1] = 0;
//}
//for ( i =0; i < Slength; i ++)
//{
// gpString[i] = pString[i];
//}
//gpString[i] = 0;
//gpString[i+1] = 0;
//strcpy((char *)gpString,(U8*)pString);
}
/***********************************************************************************
* Function : fmDisplayShiftCancel
* Description : cancel shifting
* input parameters : none
* return parameter : none
************************************************************************************/
void drvLcd_ShiftCancel(void)
{
U16 i;
gShift_on=0;
ShiftiCount = 0;
ShiftloopCount = 0;
//free((U8*)gpString);
for(i=0;i<256;i++)
{
gpString[i]=0;
}
}
U16 strlenUnicode(U8 * pString)
{
int i;
U16 Count = 0;
for ( i = 0; ; i = i +2)
{
if ( pString[i] == '\0' && pString[i+1] == '\0')
{
return Count;
}
if ( pString[i] == '\0' && pString[i+1] < 0x80)
{
Count += 7;
}
else
{
Count += 12;
}
}
}
/***********************************************************************************
* Function : fmDisplayBlinkCancel
* Description : cancel blinking
* input parameters : none
* return parameter : none
************************************************************************************/
void drvLcd_BlinkCancel(void)
{
gBlink_on=0;
if(gDisplayStyle==DISP_SHIFT_BLINK)
{
gDisplayStyle=DISP_NORMAL;
return;
}
free((U8*)gpString);
}
/***********************************************************************************
* Function : fmDisplayBlink
* Description : LCD shifting Process,
* input parameters : shiftbit:shift bit num at a time according to the variant
* : shiftdir:direction to shift 0:backward ,1:forward
* return parameter : none
************************************************************************************/
void drvLcd_Shift(U8 kShiftbit, U8 kShiftdir)
{
U16 slength;
U16 slength1; //得到字符串根据字库设定的象素数
U8 pcount,chartype;
U8 temp;
//U8 BmpBuffer[32];
static U8 iddd = 0;
if(kShiftdir==1) return;//if shift toward right,return
if(gShift_on==0) return;
//gDisplayLeftDistance
//slength=strlen((char*)gpString);
slength1 = strlenUnicode(gpString);
//drvLcd_WriteChar(1,1,0,48+slength1/100);
//drvLcd_WriteChar(1,20,0,48+(slength1 -slength1/100*100) /10);
//drvLcd_WriteChar(1,40,0,48+(slength1 % 10));
if(gShift_i>=(slength1+STRING_BLANK_LENGTH+1))
{
ShiftloopCount=gShift_i=gShift_j=gEngCharNum=0;
ShiftiCount=0;
}
if(gShift_i<slength1)
{
if(gpString[ShiftiCount] == 0)
{
ShiftloopCount ++;
if ( gDisplayLeftDistance == 0 && ShiftiCount >=0)
{
ShiftiCount ++;
ShiftiCount ++;
ShiftloopCount = 1;
}
if ( gDisplayLeftDistance > 0)
{
gDisplayLeftDistance -- ;
}
else
{
if ( ShiftiCount == 0)
{
gDisplayLeftDistance =7 - ShiftloopCount;
}
else
{
if ( gpString[ShiftiCount-2] == 0)
{
gDisplayLeftDistance =7 - ShiftloopCount ;
}
else
{
gDisplayLeftDistance =12 - ShiftloopCount ;
}
}
}
chartype=ENGLISH_CHARACTER;
}
else
{
ShiftloopCount ++;
if ( gDisplayLeftDistance == 0 && ShiftiCount >= 0)
{
ShiftiCount ++;
ShiftiCount ++;
ShiftloopCount = 1;
}
if ( gDisplayLeftDistance > 0)
{
gDisplayLeftDistance -- ;
}
else
{
if ( ShiftiCount == 0)
{
gDisplayLeftDistance =12 - ShiftloopCount;
}
else
{
if ( gpString[ShiftiCount-2] == 0)
{
gDisplayLeftDistance =7 - ShiftloopCount ;
}
else
{
gDisplayLeftDistance =12 - ShiftloopCount ;
}
}
}
chartype=CHINESE_CHARACTER;
}
#ifdef LightBlue
{
if(chartype==ENGLISH_CHARACTER)
{
iddd ++;
pcount= gShift_i/12+1;
temp = ShiftiCount/2;
//drvLcd_WriteChar(1,60,0,65+temp);
drvLcd_DisplayString(gfmPage,gfmColumn+gDisplayLeftDistance,gReverse,gpString,&temp,gBlink_on);
//drvLcd_ScreenClear(112,gfmPage,123,gfmPage+11,0x6d,0xbe,0x00);
/* gavin add */
if(gDisplayState == DISP_MENU)
{
if(cFlag == TRUE)
drvLcd_WriteChar(gfmPage,119,1,'>');
else
drvLcd_ScreenClear(119,gfmPage,123,gfmPage+11,0x6d,0xbe,0x00);
}
/* end */
if(WordColor==1)
drvLcd_ScreenClear(gfmColumn,gfmPage,gfmColumn+gDisplayLeftDistance-1,gfmPage+11,0x6d,0xbe,0x00);
else if(WordColor==2)
{
if(gReverse==1)
{
drvLcd_ScreenClear(gfmColumn,gfmPage,gfmColumn+gDisplayLeftDistance-1,gfmPage+11,0x29,0x9b,0x00);
}
else
{
drvLcd_ScreenClear(gfmColumn,gfmPage,gfmColumn+gDisplayLeftDistance-1,gfmPage+11,0xdf,0x7f,0x00);
}
}
else
{
if(gReverse==1)
{
drvLcd_ScreenClear(gfmColumn,gfmPage,gfmColumn+gDisplayLeftDistance-1,gfmPage+11,0x29,0x9b,0x00);
}
else
{
drvLcd_ScreenClear(gfmColumn,gfmPage,gfmColumn+gDisplayLeftDistance-1,gfmPage+11,0x6d,0xbe,0x00);
}
}
}
else if(chartype==CHINESE_CHARACTER)
{
if((gEngCharNum%2)==0)
pcount= (gShift_i/16+1)*chartype;
else
pcount= ((gShift_i+8)/16)*chartype+1;
temp = ShiftiCount/2;
//drvLcd_WriteChar(1,60,0,65+temp);
drvLcd_DisplayString(gfmPage,gfmColumn+gDisplayLeftDistance,gReverse,gpString,&temp,gBlink_on);
//drvLcd_ScreenClear(112,gfmPage,123,gfmPage+11,0x6d,0xbe,0x00);
/* gavin add */
if(gDisplayState == DISP_MENU)
{
if(cFlag == TRUE)
drvLcd_WriteChar(gfmPage,119,1,'>');
else
drvLcd_ScreenClear(119,gfmPage,123,gfmPage+11,0x6d,0xbe,0x00);
}
/* end */
if(WordColor==1)
drvLcd_ScreenClear(gfmColumn,gfmPage,gfmColumn+gDisplayLeftDistance-1,gfmPage+11,0x6d,0xbe,0x00);
else if(WordColor==2)
{
if(gReverse==1)
{
drvLcd_ScreenClear(gfmColumn,gfmPage,gfmColumn+gDisplayLeftDistance-1,gfmPage+11,0x29,0x9b,0x00);
}
else
{
drvLcd_ScreenClear(gfmColumn,gfmPage,gfmColumn+gDisplayLeftDistance-1,gfmPage+11,0xdf,0x7f,0x00);
}
}
else
{
if(gReverse==1)
{
drvLcd_ScreenClear(gfmColumn,gfmPage,gfmColumn+gDisplayLeftDistance-1,gfmPage+11,0x29,0x9b,0x00);
}
else
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -