// ************************************************************************** // IT8951Display_I80.c // // Implementation of example code for IT8951 Display via I80/SPI/I2C Bus (Host side) // // Copyright (c) 2008 ITE Tech. Inc. All Rights Reserved. // // Author: Eric Su, June 29, 2016 // ************************************************************************** //----------------------------------------------------------- // Select Host interface //----------------------------------------------------------- #define __SPI_2_I80_INF__ //Enable SPI interface , else i80 interface //#define __I2C_2_I80_INF //Enable I2C interface //------------------------------------------------------------------- // SPI Interface basic function //------------------------------------------------------------------- #define __HOST_LITTLE_ENDIAN__ //Big or Little Endian for your Host platform #ifdef __HOST_LITTLE_ENDIAN__ //Little Endian => its needs to convert for SPI to I80 #define MY_WORD_SWAP(x) ( ((x & 0xff00)>>8) | ((x & 0x00ff)<<8) ) #else //Big Endian => No need to convert #define MY_WORD_SWAP(x) (x) #endif #include "call.h" #include "ite_display_i80.h" #include "malloc.h" #include "rtc_func.h" #include "fsl_gpio.h" #include "render_bmp.h" #include "hindiMapping.h" int word_count=0; //static GPIO_Type *const maGpioBases2[] = GPIO_BASE_PTRS; //static int m=0; //static uint8_t counterForInitHost=0; void delay_Ms(){ int i = 0; for(i = 0; i < 4000000; i++ ); } void IT8951MemBurstWrite(TDWord ulMemAddr , TDWord ulWriteSize) { TWord usArg[4]; //Setting Arguments for Memory Burst Write usArg[0] = (TWord)(ulMemAddr & 0x0000FFFF); //addr[15:0] usArg[1] = (TWord)( (ulMemAddr >> 16) & 0x0000FFFF ); //addr[25:16] usArg[2] = (TWord)(ulWriteSize & 0x0000FFFF); //Cnt[15:0] usArg[3] = (TWord)( (ulWriteSize >> 16) & 0x0000FFFF ); //Cnt[25:16] //Send Cmd and Arg LCDSendCmdArg(IT8951_TCON_MEM_BST_WR , usArg , 4); } //---------------------------------------------------------------------- //---------------------------------------------------------------------- void IT8951MemBurstWriteStart() { LCDWriteCmdCode(IT8951_TCON_MEM_BST_WR); } //--------------------------------------------------------------------- // //-------------------------------------------------------------------- void IT8951MemBurstEnd(void) { LCDWriteCmdCode(IT8951_TCON_MEM_BST_END); } TByte readBusyPinStatus() { return GpioReadPinInput(&BusyStatusPin); } //----------------------------------------------------------- //Host controller function 1 ¡V Wait for host data Bus Ready //----------------------------------------------------------- void LCDWaitForReady() { //Regarding to HRDY //you may need to use a GPIO pin connected to HRDY of IT8951 TDWord ulData = readBusyPinStatus(); while(ulData == 0) { //Get status of HRDY ulData = readBusyPinStatus(); } } //------------------------------------------------------------------- // Write Command code //------------------------------------------------------------------- void LCDWriteCmdCode (TWord wCmd) { TWord wPreamble = 0; //Set Preamble for Write Command wPreamble = 0x6000; beginI80Cycle(); //Send Preamble LCDWaitForReady(); SPI_Write(&wPreamble, 2 , CS_L); //Send Command LCDWaitForReady(); SPI_Write(&wCmd, 2, CS_H); } //------------------------------------------------------------------- // Write 1 Word Data(2-bytes) //------------------------------------------------------------------- void LCDWriteData(TWord usData) { TWord wPreamble = 0; //m=0; //set type wPreamble = 0x0000; beginI80Cycle(); //Send Preamble LCDWaitForReady(); SPI_Write(&wPreamble, 2, CS_L); //Send Data LCDWaitForReady(); SPI_Write(&usData, 2, CS_H); } //------------------------------------------------------------------- // Burst Write Data //------------------------------------------------------------------- void LCDWriteNData(TWord* pwBuf, TDWord ulSizeWordCnt) { TWord wPreamble = 0; //set type wPreamble = 0x0000; beginI80Cycle(); //Send Preamble LCDWaitForReady(); SPI_Write(&wPreamble, 2, CS_L); //Send Data LCDWaitForReady(); SPI_WriteNData(pwBuf, ulSizeWordCnt,CS_L); } //------------------------------------------------------------------- // Read 1 Word Data //------------------------------------------------------------------- TWord LCDReadData() { TWord wPreamble = 0; TWord wRData; TWord wDummy; //set type and direction wPreamble = 0x1000; //Send Preamble before reading data wPreamble = MY_WORD_SWAP(wPreamble); LCDWaitForReady(); SPI_Write(&wPreamble, sizeof wPreamble, CS_L); //Read Dummy (under IT8951 SPI to I80 spec) LCDWaitForReady(); SPI_Read(&wDummy, sizeof(wDummy),CS_L); //Read Data LCDWaitForReady(); SPI_Read(&wRData, sizeof(wRData),CS_H); wRData = MY_WORD_SWAP(wRData); return wRData; } //------------------------------------------------------------------- // Read Burst N words Data //------------------------------------------------------------------- void LCDReadNData(TWord *pwBuf, TDWord ulSizeWordCnt) { TWord wPreamble = 0; TDWord i; TWord wDummy; //set type and direction wPreamble = 0x1000; beginI80Cycle(); //wPreamble = MY_WORD_SWAP(wPreamble); LCDWaitForReady(); SPI_Write(&wPreamble, 2, CS_L); //Read Dummy (under IT8951 SPI to I80 spec) LCDWaitForReady(); //delay_Ms(); SPI_Read(&wDummy, sizeof(wDummy),CS_L); LCDWaitForReady(); SPI_Read(pwBuf, ulSizeWordCnt * 2,CS_H); for(i=2;i< ulSizeWordCnt ; i++) { //PRINTF("%x ",*(pwBuf + i)); *(pwBuf + i) = MY_WORD_SWAP(* (pwBuf + i)); } } //----------------------------------------------------------- //Host controller function 5 ¡V Write command to host data Bus with aruments //----------------------------------------------------------- void LCDSendCmdArg(TWord usCmdCode,TWord* pArg, TWord usNumArg) { TWord i; //Send Cmd code LCDWriteCmdCode(usCmdCode); //Send Data for(i=0;i NonZero ¡V Busy, 0 - Free while(IT8951ReadReg(LUTAFSR)); } void getTemperature(void){ TWord tempArg = 0x0000; TWord tempData[2]; //Send I80 CMD For GET Temperature Info LCDSendCmdArg(USEDF_I80_CMD_TEMP_INFO,&tempArg,1); //Receive data of GET Temperature info LCDReadNData(tempData,2); // PRINTF("\r\nSENSOR TEMPERATURE : %x",tempData[0]); // PRINTF("\r\nMANUAL TEMPERATURE : %x",tempData[1]); } void setTemperature(TWord temp){ TWord tempArg[2] = {0x0001, temp}; //Send I80 CMD For GET Temperature Info LCDSendCmdArg(USEDF_I80_CMD_TEMP_INFO, tempArg, 2); } void IT8951DisplayArea1(TWord usX, TWord usY, TWord usW, TWord usH, TWord usDpyMode) { //Send I80 Display Command (User defined command of IT8951) LCDWaitForReady(); LCDWriteCmdCode(USDEF_I80_CMD_DPY_AREA); //0x0034 //Write arguments LCDWriteData(usX); LCDWriteData(usY); LCDWriteData(usW); LCDWriteData(usH); LCDWriteData(usDpyMode); } //-------------------------------------------------- //3.5. Initial Functions //-------------------------------------------------- //----------------------------------------------------------- //Initial function - 1 //----------------------------------------------------------- //Global variable I80IT8951DevInfo gstI80DevInfo; void GetIT8951SystemInfo(void* pBuf) { TWord *pusWord = (TWord *) pBuf; I80IT8951DevInfo *pstDevInfo; //Send I80 CMD //LCDWaitForReady(); //PRINTF("inside host init"); LCDWriteCmdCode(USDEF_I80_CMD_GET_DEV_INFO); //Burst Read Request for SPI interface only LCDReadNData(pusWord, sizeof(I80IT8951DevInfo)/2); pusWord += 1; //Show Device information of IT8951 pstDevInfo = (I80IT8951DevInfo *)(pusWord); //PRINTF("\r\nWIDTH : %d\r\n",pstDevInfo->usPanelW); //PRINTF("Height : %d\n\r\n",pstDevInfo->usPanelH); pstDevInfo->usImgBufAddrL = MY_WORD_SWAP(pstDevInfo->usImgBufAddrL); pstDevInfo->usImgBufAddrH = MY_WORD_SWAP(pstDevInfo->usImgBufAddrH); //PRINTF("\r\n%x%x",pstDevInfo->usImgBufAddrH,pstDevInfo->usImgBufAddrL); gulImgBufAddr = (((uint32_t)pstDevInfo->usImgBufAddrL) | ((uint32_t)pstDevInfo->usImgBufAddrH << 16)); //PRINTF("\r\nADDRESS L : 0x%x:::::",pstDevInfo->usImgBufAddrL ); //PRINTF("ADDRESS H : 0x%x\n",pstDevInfo->usImgBufAddrH ); // PRINTF("ADDRESS : 0x%x\r\n", gulImgBufAddr); //PRINTF("FWVERSION : %s\n\r\n",pstDevInfo->usFWVersion); //PRINTF("LUTVERSION : %s\n\r\n",pstDevInfo->usLUTVersion); } //----------------------------------------------------------- //Host Cmd 12 - LD_IMG_END //----------------------------------------------------------- void IT8951LoadImgEnd(void) { LCDWriteCmdCode(IT8951_TCON_LD_IMG_END); } //----------------------------------------------------------- //Host Cmd 5 - REG_WR //----------------------------------------------------------- void IT8951WriteReg(TWord usRegAddr,TWord usValue) { //I80 Mode //Send Cmd , Register Address and Write Value LCDWriteCmdCode(IT8951_TCON_REG_WR); LCDWriteData(usRegAddr); LCDWriteData(usValue); } //---------------------------------------------------------------- //3.7. Test Functions //---------------------------------------------------------------- //----------------------------------------------------------- //Test function 1 ¡VSoftware Initial flow for testing //----------------------------------------------------------- void HostInit() { //Get Device Info GetIT8951SystemInfo(&gstI80DevInfo); //Set to Enable I80 Packed mode IT8951WriteReg(I80CPCR, 0x0001); } //----------------------------------------------------------- //Initial function 2 ¡V Set Image buffer base address //----------------------------------------------------------- void IT8951SetImgBufBaseAddr(TDWord ulImgBufAddr) { TWord usWordH = (TWord)((ulImgBufAddr >> 16) & 0x0000FFFF); TWord usWordL = (TWord)( ulImgBufAddr & 0x0000FFFF); //Write LISAR Reg IT8951WriteReg(LISAR + 2 ,usWordH); IT8951WriteReg(LISAR ,usWordL); } //----------------------------------------------------------- //Host Cmd 11 - LD_IMG_AREA //----------------------------------------------------------- void IT8951LoadImgAreaStart(IT8951LdImgInfo* pstLdImgInfo ,IT8951AreaImgInfo* pstAreaImgInfo) { TWord usArg[5]; //Setting Argument for Load image start usArg[0] = (pstLdImgInfo->usEndianType << 8 ) |(pstLdImgInfo->usPixelFormat << 4) |(pstLdImgInfo->usRotate); usArg[1] = pstAreaImgInfo->usX; usArg[2] = pstAreaImgInfo->usY; usArg[3] = pstAreaImgInfo->usWidth; usArg[4] = pstAreaImgInfo->usHeight; //Send Cmd and Args LCDSendCmdArg(IT8951_TCON_LD_IMG_AREA , usArg , 5); } //----------------------------------------------------------- //Display function 2 ¡V Load Image Area process //----------------------------------------------------------- void IT8951HostAreaPackedPixelWrite(IT8951LdImgInfo* pstLdImgInfo,IT8951AreaImgInfo* pstAreaImgInfo) { IT8951SetImgBufBaseAddr(pstLdImgInfo->ulImgBufBaseAddr); //Send Load Image start Cmd IT8951LoadImgAreaStart(pstLdImgInfo , pstAreaImgInfo); LCDWriteNData((TWord*)gpFrameBuf2,60000);//((pstAreaImgInfo->usHeight*pstAreaImgInfo->usWidth))/8); IT8951LoadImgEnd(); } //----------------------------------------------------------- // Load 1bpp image flow (must display with IT8951DisplayArea1bpp() //----------------------------------------------------------- #if 1 void IT8951Load1bppImage(TByte* p1bppImgBuf, TWord usX, TWord usY, TWord usW, TWord usH) { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; //Setting Load image information stLdImgInfo.ulStartFBAddr = (TDWord *) p1bppImgBuf; stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN; stLdImgInfo.usPixelFormat = IT8951_8BPP; //we use 8bpp because IT8951 dose not support 1bpp mode for load image¡Aso we use Load 8bpp mode ,but the transfer size needs to be reduced to Size/8 stLdImgInfo.usRotate = IT8951_ROTATE_0; stLdImgInfo.ulImgBufBaseAddr = gulImgBufAddr; //Set Load Area stAreaImgInfo.usX = usX/8; stAreaImgInfo.usY = usY; stAreaImgInfo.usWidth = usW/8;//1bpp, Chaning Transfer size setting to 1/8X of 8bpp mode stAreaImgInfo.usHeight = usH; //Report("IT8951HostAreaPackedPixelWrite [wait]\n\r"); //Load Image from Host to IT8951 Image Buffer IT8951HostAreaPackedPixelWrite(&stLdImgInfo, &stAreaImgInfo);//Display function 2 } #endif #if 1 //Display Area with bitmap on EPD //----------------------------------------------------------- // Display Function 4 - for Display Area for 1-bpp mode format // the bitmap(1bpp) mode will be enable when Display // and restore to Default setting (disable) after displaying finished //----------------------------------------------------------- void IT8951DisplayArea1bpp(TWord usX, TWord usY, TWord usW, TWord usH, TWord usDpyMode, TByte ucBGGrayVal, TByte ucFGGrayVal) { //Set Display mode to 1 bpp mode - Set 0x18001138 Bit[18](0x1800113A Bit[2])to 1 IT8951WriteReg(UP1SR+2, IT8951ReadReg(UP1SR+2) | (1<<2)); //Set BitMap color table 0 and 1 , => Set Register[0x18001250]: //Bit[7:0]: ForeGround Color(G0~G15) for 1 //Bit[15:8]:Background Color(G0~G15) for 0 IT8951WriteReg(BGVR, (ucBGGrayVal<<8) | ucFGGrayVal); //Display IT8951DisplayArea1( usX, usY, usW, usH, usDpyMode); //PRINTF("\r\nBUSY"); IT8951WaitForDisplayReady(); //PRINTF("\r\nREADY"); //Restore to normal mode IT8951WriteReg(UP1SR+2, IT8951ReadReg(UP1SR+2) & ~(1<<2)); } //----------------------------------------------------------- //Test function 3 – Example of Display 1bpp Flow //----------------------------------------------------------- #endif void IT8951HostAreaPackedPixelWriteMaster(IT8951LdImgInfo* pstLdImgInfo,IT8951AreaImgInfo* pstAreaImgInfo) { TDWord i,j; //Source buffer address of Host TWord* pusFrameBuf = (TWord*)pstLdImgInfo->ulStartFBAddr; //Set Image buffer(IT8951) Base address IT8951SetImgBufBaseAddr(pstLdImgInfo->ulImgBufBaseAddr); //Send Load Image start Cmd IT8951LoadImgAreaStart(pstLdImgInfo , pstAreaImgInfo); LCDWriteNData((TWord*)gpFrameBuf2,(pstAreaImgInfo->usHeight*pstAreaImgInfo->usWidth));//60000); //PRINTF("---IT8951 Host Area Packed Pixel Write end---\r\n"); //Send Load Img End Command IT8951LoadImgEnd(); } void IT8951Load1bppImageMaster(TByte* p1bppImgBuf, TWord usX, TWord usY, TWord usW, TWord usH) { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; //Setting Load image information stLdImgInfo.ulStartFBAddr = (TDWord) gpFrameBuf2; stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN; stLdImgInfo.usPixelFormat = IT8951_8BPP; //we use 8bpp because IT8951 dose not support 1bpp mode for load image¡Aso we use Load 8bpp mode ,but the transfer size needs to be reduced to Size/8 stLdImgInfo.usRotate = IT8951_ROTATE_0; stLdImgInfo.ulImgBufBaseAddr = gulImgBufAddr; //Set Load Area stAreaImgInfo.usX = usX/8; stAreaImgInfo.usY = usY; stAreaImgInfo.usWidth = usW/8;//1bpp, Chaning Transfer size setting to 1/8X of 8bpp mode stAreaImgInfo.usHeight = usH; //PRINTF("IT8951HostAreaPackedPixelWrite [wait]\n\r"); //Load Image from Host to IT8951 Image Buffer IT8951HostAreaPackedPixelWriteMaster(&stLdImgInfo, &stAreaImgInfo);//Display function 2 } void IT8951Display1bppExampleMaster(char *text,uint16_t xcoordinate,uint16_t y_corrdinate,uint8_t fontType , uint8_t fontsize, uint8_t alignment, uint8_t bgcolor,int count) { IT8951AreaImgInfo stAreaImgInfo; uint8_t fontheight=0; //Host Initial //HostInit(); //Test Function 1 memset(gpFrameBuf2,bgcolor,60000); if(xcoordinate>0) ////////if shifting right (from x = 0) (fills tiles before x if refreshed) { IT8951WaitForDisplayReady(); IT8951SetImgBufBaseAddr(gulImgBufAddr); stAreaImgInfo.usX = 0; stAreaImgInfo.usY = y_corrdinate; stAreaImgInfo.usWidth =xcoordinate; if(fontType== 0x04 ) // language=='1') { stAreaImgInfo.usHeight =208;//depends on height of the font used } else if(fontType == 0x02 )//language=='3') { stAreaImgInfo.usHeight=61;//depends on height of the font used } else if(fontType == 0x01 ) //language=='5') { stAreaImgInfo.usHeight=93;//depends on height of the font used } IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//Display function 4, Arg } int Wcount=0; while(Wcount0) ////////if shifting right (from x = 0) (fills tiles before x if refreshed) { IT8951WaitForDisplayReady(); IT8951SetImgBufBaseAddr(gulImgBufAddr); stAreaImgInfo.usX = 0; stAreaImgInfo.usY = y_corrdinate; stAreaImgInfo.usWidth =xcoordinate; if(language=='1') { stAreaImgInfo.usHeight =208;//depends on height of the font used } else if(language=='3') { stAreaImgInfo.usHeight=61;//depends on height of the font used } IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//Display function 4, Arg } int Wcount=0; while(Wcount400) { sizeRemain-=400; LCDWriteNData(gpFrameBuf2,400*stAreaImgInfo.usHeight); } memset(gpFrameBuf2,bgcolor,sizeRemain*stAreaImgInfo.usHeight); LCDWriteNData(gpFrameBuf2,sizeRemain*stAreaImgInfo.usHeight); IT8951LoadImgEnd(); memset(&stAreaImgInfo,'\0',sizeof(stAreaImgInfo)); //for(i=0;i400) { PRINTF("\r\n this is remaining size:%d||size = %d",sizeRemain,400*stAreaImgInfo.usHeight); sizeRemain-=400; LCDWriteNData(gpFrameBuf2,400*stAreaImgInfo.usHeight); } memset(gpFrameBuf2,bgcolor,sizeRemain*stAreaImgInfo.usHeight); LCDWriteNData(gpFrameBuf2,sizeRemain*stAreaImgInfo.usHeight); */ /* LCDWriteNData(gpFrameBuf2,60000); IT8951LoadImgEnd(); IT8951WaitForDisplayReady(); //Display Area – (x,y,w,h) with mode 0(initial white only) or mode 2(gray) IT8951DisplayArea1(0,y_corrdinate,1872,stAreaImgInfo.usHeight, 2); */ } void IT8951DisplayEnglish22(char *text,uint16_t xcoordinate,uint16_t y_corrdinate,char language,uint16_t bgcolor) { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; memset(&stLdImgInfo,'\0',sizeof(stLdImgInfo)); memset(&stAreaImgInfo,'\0',sizeof(stAreaImgInfo)); char charc[2]; int buffwidth=0,xwidth,i=0,sizeRemain; int x0=xcoordinate; sizeRemain=xcoordinate; IT8951WaitForDisplayReady(); IT8951SetImgBufBaseAddr(gulImgBufAddr); stAreaImgInfo.usX = 0; stAreaImgInfo.usY = y_corrdinate; stAreaImgInfo.usWidth =xcoordinate; //stAreaImgInfo.usWidth =1876; if(language=='1') { stAreaImgInfo.usHeight =208;//depends on height of the font used } else if(language=='3') { stAreaImgInfo.usHeight=61;//depends on height of the font used } IT8951LoadImgAreaStart(&stLdImgInfo , &stAreaImgInfo); memset(gpFrameBuf2,bgcolor,(400*stAreaImgInfo.usHeight)); while(sizeRemain>400) { sizeRemain-=400; LCDWriteNData(gpFrameBuf2,400*stAreaImgInfo.usHeight); } memset(gpFrameBuf2,bgcolor,sizeRemain*stAreaImgInfo.usHeight); LCDWriteNData(gpFrameBuf2,sizeRemain*stAreaImgInfo.usHeight); IT8951LoadImgEnd(); memset(&stAreaImgInfo,'\0',sizeof(stAreaImgInfo)); //for(i=0;i400) { // PRINTF("\r\n this is remaining size:%d",sizeRemain); sizeRemain-=400; LCDWriteNData(gpFrameBuf2,400*stAreaImgInfo.usHeight); } memset(gpFrameBuf2,bgcolor,sizeRemain*stAreaImgInfo.usHeight); LCDWriteNData(gpFrameBuf2,sizeRemain*stAreaImgInfo.usHeight); IT8951LoadImgEnd(); IT8951WaitForDisplayReady(); //Display Area – (x,y,w,h) with mode 0(initial white only) or mode 2(gray) IT8951DisplayArea1(0,y_corrdinate,1872,stAreaImgInfo.usHeight, 2); } void IT8951DisplayEnglish2(char *text,uint16_t xcoordinate,uint16_t y_corrdinate,char language,uint16_t bgcolor) { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; memset(&stLdImgInfo,'\0',sizeof(stLdImgInfo)); memset(&stAreaImgInfo,'\0',sizeof(stAreaImgInfo)); char charc[2]; int buffwidth=0,xwidth,i=0,sizeRemain; int x0=xcoordinate; sizeRemain=xcoordinate; IT8951WaitForDisplayReady(); IT8951SetImgBufBaseAddr(gulImgBufAddr); stAreaImgInfo.usX = 0; stAreaImgInfo.usY = y_corrdinate; stAreaImgInfo.usWidth =xcoordinate; if(language=='1') { stAreaImgInfo.usHeight =208;//depends on height of the font used } else if(language=='3') { stAreaImgInfo.usHeight=61;//depends on height of the font used } IT8951LoadImgAreaStart(&stLdImgInfo , &stAreaImgInfo); memset(gpFrameBuf2,bgcolor,(400*stAreaImgInfo.usHeight)); while(sizeRemain>400) { sizeRemain-=400; LCDWriteNData(gpFrameBuf2,400*stAreaImgInfo.usHeight); } memset(gpFrameBuf2,bgcolor,sizeRemain*stAreaImgInfo.usHeight); LCDWriteNData(gpFrameBuf2,sizeRemain*stAreaImgInfo.usHeight); IT8951LoadImgEnd(); memset(&stAreaImgInfo,'\0',sizeof(stAreaImgInfo)); //for(i=0;i400) { PRINTF("\r\n this is remaining size:%d||size = %d",sizeRemain,400*stAreaImgInfo.usHeight); sizeRemain-=400; LCDWriteNData(gpFrameBuf2,400*stAreaImgInfo.usHeight); } memset(gpFrameBuf2,bgcolor,sizeRemain*stAreaImgInfo.usHeight); LCDWriteNData(gpFrameBuf2,sizeRemain*stAreaImgInfo.usHeight); */ //LCDWriteNData(gpFrameBuf2,60000); //IT8951LoadImgEnd(); IT8951WaitForDisplayReady(); //Display Area – (x,y,w,h) with mode 0(initial white only) or mode 2(gray) IT8951DisplayArea1(0,y_corrdinate,1872,stAreaImgInfo.usHeight, 2); } /*****************for hindi font rendering *********************************************/ void IT8951Displayhindi(char *text,uint16_t xcoordinate,uint16_t y_corrdinate) { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; memset(&stLdImgInfo,'\0',sizeof(stLdImgInfo)); memset(&stAreaImgInfo,'\0',sizeof(stAreaImgInfo)); char tempchar; int buffwidth=0,xwidth=0,i=0,x0=xcoordinate; int sizeRemain=xcoordinate; IT8951WaitForDisplayReady(); IT8951SetImgBufBaseAddr(gulImgBufAddr); stAreaImgInfo.usX = 0; stAreaImgInfo.usY = y_corrdinate; stAreaImgInfo.usWidth =xcoordinate; stAreaImgInfo.usHeight =204;//depends on height of the font used IT8951LoadImgAreaStart(&stLdImgInfo , &stAreaImgInfo); memset(gpFrameBuf2,0xff,(400*stAreaImgInfo.usHeight)); while(sizeRemain>400) { sizeRemain-=400; LCDWriteNData(gpFrameBuf2,400*stAreaImgInfo.usHeight); } memset(gpFrameBuf2,0xff,sizeRemain*stAreaImgInfo.usHeight); LCDWriteNData(gpFrameBuf2,sizeRemain*stAreaImgInfo.usHeight); IT8951LoadImgEnd(); char Text[100]; memset(Text,'\0',100); char *text2; char charc[3]; text2=Text; text2=(char*)ArrangeCharacters((mf_str*)&text); for(i=0;i400) { sizeRemain-=400; LCDWriteNData(gpFrameBuf2,400*stAreaImgInfo.usHeight); } memset(gpFrameBuf2,0xff,sizeRemain*stAreaImgInfo.usHeight); LCDWriteNData(gpFrameBuf2,sizeRemain*stAreaImgInfo.usHeight); IT8951LoadImgEnd(); //PRINTF("\r\n rthis is height%d",stAreaImgInfo.usHeight); IT8951WaitForDisplayReady(); //Display Area – (x,y,w,h) with mode 0(initial white only) or mode 2(gray) IT8951DisplayArea1(0, y_corrdinate,1872,stAreaImgInfo.usHeight, 2); } void IT8951DisplayExample(char *text,char language,uint8_t areaMode) { switch(areaMode) { case 1 : refresh(); break; case 2 : line1refresh(); break; case 3 : line2refresh(); break; case 4 : firstLogo(); secondLogo(); break; case 5 : line1Update(text,language); break; case 6 : line2Update(text,language); break; default : PRINTF("\r\n this is invalid"); } return; } void line1refresh() { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; memset(&stLdImgInfo,'\0',sizeof(stLdImgInfo)); memset(&stAreaImgInfo,'\0',sizeof(stAreaImgInfo)); int i=0; IT8951WaitForDisplayReady(); stLdImgInfo.ulStartFBAddr = (TDWord)(0x0000); stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN; stLdImgInfo.usPixelFormat = IT8951_8BPP; stLdImgInfo.usRotate = IT8951_ROTATE_0; stLdImgInfo.ulImgBufBaseAddr = gulImgBufAddr; IT8951SetImgBufBaseAddr(gulImgBufAddr); stAreaImgInfo.usX = 0; stAreaImgInfo.usY = 450; stAreaImgInfo.usWidth =1872; stAreaImgInfo.usHeight =240; IT8951LoadImgAreaStart(&stLdImgInfo , &stAreaImgInfo); memset(gpFrameBuf2,0xff,74880); for(i=0;i<3*2;i++) { LCDWriteNData((TWord*)gpFrameBuf2,74880); } IT8951LoadImgEnd(); IT8951WaitForDisplayReady(); IT8951DisplayArea1(0,450,1872,240,2); return; } void line2refresh() { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; memset(&stLdImgInfo,'\0',sizeof(stLdImgInfo)); memset(&stAreaImgInfo,'\0',sizeof(stAreaImgInfo)); int i=0; IT8951WaitForDisplayReady(); stLdImgInfo.ulStartFBAddr = (TDWord)(0x0000); stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN; stLdImgInfo.usPixelFormat = IT8951_8BPP; stLdImgInfo.usRotate = IT8951_ROTATE_0; stLdImgInfo.ulImgBufBaseAddr = gulImgBufAddr; IT8951SetImgBufBaseAddr(gulImgBufAddr); stAreaImgInfo.usX = 0; stAreaImgInfo.usY = 776; stAreaImgInfo.usWidth =1872; stAreaImgInfo.usHeight =240; IT8951LoadImgAreaStart(&stLdImgInfo , &stAreaImgInfo); memset(gpFrameBuf2,0xff,74880); for(i=0;i<3*2;i++) { LCDWriteNData((TWord*)gpFrameBuf2,74880); } IT8951LoadImgEnd(); IT8951WaitForDisplayReady(); IT8951DisplayArea1(0,776,1872,240,2); return; } void refresh() { IT8951AreaImgInfo stAreaImgInfo; uint8_t fontheight=0; //Host Initial HostInit(); //Test Function 1 //Prepare image //Write pixel 0x00(Black) to Frame Buffer //or you can create your image pattern here.. //memset(gpFrameBuf2, 0x00, (gstI80DevInfo.usPanelW * gstI80DevInfo.usPanelH)/8);//Host Frame Buffer(Source) memset(gpFrameBuf2,0xff,60000); { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 209;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 250;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 209+250;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 250;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 209+250+250;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 250;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 209+250+250+250;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 171;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } /* { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 209+250+250+250+250;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 130;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } */ { { //IT8951DisplayArea1bpp(0,y_corrdinate, gstI80DevInfo.usPanelW, stAreaImgInfo.usHeight, 2, 0x00, 0xFF);//gstI80DevInfo.usPanelH, 2, 0x00, 0xFF); IT8951DisplayArea1bpp(0,209,1600,930, 2, 0x00, 0xFF); } } } void refresh2() { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; memset(&stLdImgInfo,'\0',sizeof(stLdImgInfo)); memset(&stAreaImgInfo,'\0',sizeof(stAreaImgInfo)); int i=0; IT8951WaitForDisplayReady(); stLdImgInfo.ulStartFBAddr = (TDWord)(0x0000); stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN; stLdImgInfo.usPixelFormat = IT8951_8BPP; stLdImgInfo.usRotate = IT8951_ROTATE_0; stLdImgInfo.ulImgBufBaseAddr = gulImgBufAddr; IT8951SetImgBufBaseAddr(gulImgBufAddr); stAreaImgInfo.usX = 0; stAreaImgInfo.usY = 209; stAreaImgInfo.usWidth =1872; stAreaImgInfo.usHeight =1134; IT8951LoadImgAreaStart(&stLdImgInfo , &stAreaImgInfo); memset(gpFrameBuf2,0xff,73008); LCDWriteNData((TWord*)gpFrameBuf2,73008); LCDWriteNData((TWord*)gpFrameBuf2,73008); memset(gpFrameBuf2,0xff,82368); for(i=0;i<12*2;i++) { LCDWriteNData((TWord*)gpFrameBuf2,82368); } IT8951LoadImgEnd(); IT8951WaitForDisplayReady(); IT8951DisplayArea1(0,209,1872,1134,2); return; } void line1Update(char *text,char language) { if(language=='2') { IT8951Displayhindi(text,100,450); } else if(language=='1') { // PRINTF("\r\n I am here for calling english"); //strcpy(text,"Total Amount:$20.0"); IT8951DisplayEnglish(text,100,450,1,0xf0); } return; } void line2Update(char *text,char language) { if(language=='2') { IT8951Displayhindi(text,100,800); } else if(language=='1') { IT8951DisplayEnglish(text,100,800,1,0xf0); } return; } void firstLogo() { char text[50]; memset(text,'\0',sizeof(text)); strcpy(text,"Delhi Metro"); // IT8951Display1bppExampleMasterZeroCounter(text,390,0,'1',0x00,11); IT8951Display1bppExampleMaster(text , 390 , 0 , 0x04 , 0x00, 0x00 , 0x00 ,11); //IT8951Display1bppExampleMaster(text,832,0,'1',0x00); return; } void secondLogo() { char text[50]; memset(text,'\0',sizeof(text)); strcpy(text,"Satyam software Solutions Pvt.Ltd."); //PRINTF("INside Second logo"); //IT8951DisplayEnglish(text,512,1343,'3',0x00); //IT8951Display1bppExampleMasterZeroCounter(text,512,1133,'3',0x00,34); IT8951Display1bppExampleMaster(text , 512 , 1133 , 0x02 , 0x00, 0x00 , 0x00 ,34); return; } void IT8951HostAreaPackedPixelWriteIMAGE(IT8951LdImgInfo* pstLdImgInfo,IT8951AreaImgInfo* pstAreaImgInfo) { TDWord i,j; //Source buffer address of Host TWord* pusFrameBuf = (TWord*)pstLdImgInfo->ulStartFBAddr; //Set Image buffer(IT8951) Base address IT8951SetImgBufBaseAddr(pstLdImgInfo->ulImgBufBaseAddr); //Send Load Image start Cmd IT8951LoadImgAreaStart(pstLdImgInfo , pstAreaImgInfo); //PRINTF("---IT8951 Host Area Packed Pixel Write begin---\r\n"); //Host Write Data LCDWriteNData((TWord*)gpFrameBuf2,((pstAreaImgInfo->usHeight*pstAreaImgInfo->usWidth )%2==0 ? (pstAreaImgInfo->usHeight*pstAreaImgInfo->usWidth ) : (pstAreaImgInfo->usHeight*pstAreaImgInfo->usWidth +1 )));//84240); //PRINTF("---IT8951 Host Area Packed Pixel Write end---\r\n"); //Send Load Img End Command IT8951LoadImgEnd(); } void LoadImage(TByte* p1bppImgBuf, TWord usX, TWord usY, TWord usW, TWord usH) { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; //Setting Load image information stLdImgInfo.ulStartFBAddr = (TDWord) p1bppImgBuf; stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN; stLdImgInfo.usPixelFormat = IT8951_8BPP; stLdImgInfo.usRotate = IT8951_ROTATE_0; stLdImgInfo.ulImgBufBaseAddr = gulImgBufAddr; //Set Load Area stAreaImgInfo.usX = usX; stAreaImgInfo.usY = usY; stAreaImgInfo.usWidth = usW; stAreaImgInfo.usHeight = usH; //Load Image from Host to IT8951 Image Buffer IT8951HostAreaPackedPixelWriteIMAGE(&stLdImgInfo, &stAreaImgInfo);//Display function 2 } void IT8951DisplayImageCustom(uint16_t x_corrdinate,uint16_t y_corrdinate,uint16_t height,uint16_t width,int count,uint16_t display_y,uint16_t display_height) { //PRINTF("I = %d\n",i++); IT8951AreaImgInfo stAreaImgInfo; uint8_t fontheight=0; HostInit(); /////////////////START { IT8951WaitForDisplayReady(); //Load Image and Display //Set Load Area stAreaImgInfo.usX = x_corrdinate;//0; stAreaImgInfo.usY = y_corrdinate;//350; stAreaImgInfo.usWidth = width; stAreaImgInfo.usHeight = height;//1872 * y_corrdinate;//gstI80DevInfo.usPanelH;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; LoadImage(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { { if(count == 1) { //PRINTF("Display count 1"); IT8951DisplayArea1(x_corrdinate,display_y,width,display_height, 2); } } } } void IT8951DisplayImage(uint16_t y_corrdinate,int count) { //PRINTF("I = %d\n",i++); IT8951AreaImgInfo stAreaImgInfo; uint8_t fontheight=0; HostInit(); /////////////////START { IT8951WaitForDisplayReady(); //Load Image and Display //Set Load Area stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = y_corrdinate;//350; stAreaImgInfo.usWidth = gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 40;//1872 * y_corrdinate;//gstI80DevInfo.usPanelH;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; LoadImage(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { { if(count == 1) { //PRINTF("Display count 1"); IT8951DisplayArea1(0,0,1600,1200, 2); } } } } void IT8951HostAreaPackedPixelWriteBLEIMAGE( TByte* p1bppImgBuf , IT8951LdImgInfo* pstLdImgInfo,IT8951AreaImgInfo* pstAreaImgInfo) { TDWord i,j; //Source buffer address of Host TWord* pusFrameBuf = (TWord*)pstLdImgInfo->ulStartFBAddr; //Set Image buffer(IT8951) Base address IT8951SetImgBufBaseAddr(pstLdImgInfo->ulImgBufBaseAddr); //Send Load Image start Cmd IT8951LoadImgAreaStart(pstLdImgInfo , pstAreaImgInfo); //PRINTF("---IT8951 Host Area Packed Pixel Write begin BLE ---\r\n"); //Host Write Data LCDWriteNData((TWord*)gpFrameBuf2,50*50);//84240); //PRINTF("---IT8951 Host Area Packed Pixel Write end BLE ---\r\n"); //Send Load Img End Command IT8951LoadImgEnd(); } void BLELoadImage(TByte* p1bppImgBuf, TWord usX, TWord usY, TWord usW, TWord usH) { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; //Setting Load image information stLdImgInfo.ulStartFBAddr = (TDWord) p1bppImgBuf; stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN; stLdImgInfo.usPixelFormat = IT8951_8BPP; stLdImgInfo.usRotate = IT8951_ROTATE_0; stLdImgInfo.ulImgBufBaseAddr = gulImgBufAddr; //Set Load Area stAreaImgInfo.usX = usX; stAreaImgInfo.usY = usY; stAreaImgInfo.usWidth = usW; stAreaImgInfo.usHeight = usH; //Load Image from Host to IT8951 Image Buffer IT8951HostAreaPackedPixelWriteBLEIMAGE(p1bppImgBuf , &stLdImgInfo, &stAreaImgInfo);//Display function 2 } void IT8951HostAreaPackedPixelWriteIMAGE4bpp(IT8951LdImgInfo* pstLdImgInfo,IT8951AreaImgInfo* pstAreaImgInfo) { TDWord i,j; //Source buffer address of Host TWord* pusFrameBuf = (TWord*)pstLdImgInfo->ulStartFBAddr; //Set Image buffer(IT8951) Base address IT8951SetImgBufBaseAddr(pstLdImgInfo->ulImgBufBaseAddr); //Send Load Image start Cmd IT8951LoadImgAreaStart(pstLdImgInfo , pstAreaImgInfo); //PRINTF("---IT8951 Host Area Packed Pixel Write begin---\r\n"); //Host Write Data LCDWriteNData((TWord*)gpFrameBuf2,1600*(pstAreaImgInfo->usHeight)/2);//84240); //PRINTF("---IT8951 Host Area Packed Pixel Write end---\r\n"); //Send Load Img End Command IT8951LoadImgEnd(); } void LoadImage4bpp(TByte* p1bppImgBuf, TWord usX, TWord usY, TWord usW, TWord usH) { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; //Setting Load image information stLdImgInfo.ulStartFBAddr = (TDWord) p1bppImgBuf; stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN; stLdImgInfo.usPixelFormat = IT8951_4BPP;//IT8951_8BPP; stLdImgInfo.usRotate = IT8951_ROTATE_0; stLdImgInfo.ulImgBufBaseAddr = gulImgBufAddr; //Set Load Area stAreaImgInfo.usX = usX; stAreaImgInfo.usY = usY; stAreaImgInfo.usWidth = usW; stAreaImgInfo.usHeight = usH; //Load Image from Host to IT8951 Image Buffer IT8951HostAreaPackedPixelWriteIMAGE(&stLdImgInfo, &stAreaImgInfo);//Display function 2 } void IT8951DisplayImage4bppCustom(uint16_t x_corrdinate,uint16_t y_corrdinate,uint16_t height,uint16_t width,int count,uint16_t display_y,uint16_t display_height) { //PRINTF("I = %d\n",i++); IT8951AreaImgInfo stAreaImgInfo; uint8_t fontheight=0; HostInit(); /////////////////START { IT8951WaitForDisplayReady(); //Load Image and Display //Set Load Area stAreaImgInfo.usX = x_corrdinate;//0; stAreaImgInfo.usY = y_corrdinate;//350; stAreaImgInfo.usWidth = width; stAreaImgInfo.usHeight = height;//40;//1872 * y_corrdinate;//gstI80DevInfo.usPanelH;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; LoadImage4bpp(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { { if(count == 1) { //PRINTF("Display count 1"); IT8951DisplayArea1(x_corrdinate,display_y,width,display_height, 2); } } } } void IT8951DisplayImage4bpp(uint16_t y_corrdinate,int count) { //PRINTF("I = %d\n",i++); IT8951AreaImgInfo stAreaImgInfo; uint8_t fontheight=0; HostInit(); /////////////////START { IT8951WaitForDisplayReady(); //Load Image and Display //Set Load Area stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = y_corrdinate;//350; stAreaImgInfo.usWidth = gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 80;//40;//1872 * y_corrdinate;//gstI80DevInfo.usPanelH;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; LoadImage4bpp(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { { if(count == 1) { //PRINTF("Display count 1"); IT8951DisplayArea1(0,0,1600,1200, 2); } } } } void IT8951HostAreaPackedPixelWriteImage1bpMaster(IT8951LdImgInfo* pstLdImgInfo,IT8951AreaImgInfo* pstAreaImgInfo) { TDWord i,j; // PRINTF("INSIDE IT8951HostAreaPackedPixelWriteImage1bpMaster FUNCTION "); //Source buffer address of Host TWord* pusFrameBuf = (TWord*)pstLdImgInfo->ulStartFBAddr; //Set Image buffer(IT8951) Base address IT8951SetImgBufBaseAddr(pstLdImgInfo->ulImgBufBaseAddr); // PRINTF("After IT8951SetImgBufBaseAddr"); //Send Load Image start Cmd IT8951LoadImgAreaStart(pstLdImgInfo , pstAreaImgInfo); // PRINTF("After LoadImgAreaStart"); // LCDWriteNData((TWord*)gpFrameBuf2,(pstAreaImgInfo->usHeight*1600)/8);//60000); original LCDWriteNData((TWord*)gpFrameBuf2,((pstAreaImgInfo->usHeight*pstAreaImgInfo->usWidth )%2==0 ? (pstAreaImgInfo->usHeight*pstAreaImgInfo->usWidth ) : (pstAreaImgInfo->usHeight*pstAreaImgInfo->usWidth +1 )));//60000); // PRINTF("After WriteNData"); //PRINTF("---IT8951 Host Area Packed Pixel Write end---\r\n"); //Send Load Img End Command IT8951LoadImgEnd(); } void IT8951Load1bppImageData(TByte* p1bppImgBuf, TWord usX, TWord usY, TWord usW, TWord usH) { // PRINTF("iNSIDE IT8951Load1bppImageData FUNCTION "); IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; //Setting Load image information stLdImgInfo.ulStartFBAddr = (TDWord) gpFrameBuf2; stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN; stLdImgInfo.usPixelFormat = IT8951_8BPP; //we use 8bpp because IT8951 dose not support 1bpp mode for load image¡Aso we use Load 8bpp mode ,but the transfer size needs to be reduced to Size/8 stLdImgInfo.usRotate = IT8951_ROTATE_0; stLdImgInfo.ulImgBufBaseAddr = gulImgBufAddr; //Set Load Area stAreaImgInfo.usX = usX/8; stAreaImgInfo.usY = usY; stAreaImgInfo.usWidth = usW/8;//1bpp, Chaning Transfer size setting to 1/8X of 8bpp mode stAreaImgInfo.usHeight = usH; // PRINTF("x=%d , y = %d, width = %d, height = %d",stAreaImgInfo.usX,stAreaImgInfo.usY,stAreaImgInfo.usWidth,stAreaImgInfo.usHeight); //PRINTF("IT8951HostAreaPackedPixelWrite [wait]\n\r"); //Load Image from Host to IT8951 Image Buffer IT8951HostAreaPackedPixelWriteImage1bpMaster(&stLdImgInfo, &stAreaImgInfo);//Display function 2 } void IT8951DisplayImage1bppTesting(uint16_t x_corrdinate,uint16_t y_corrdinate,uint16_t height,uint16_t width,int count,uint16_t display_y,uint16_t display_height) { //PRINTF("I = %d\n",i++); IT8951AreaImgInfo stAreaImgInfo; uint8_t fontheight=0; HostInit(); /////////////////START { IT8951WaitForDisplayReady(); //Load Image and Display //Set Load Area stAreaImgInfo.usX =x_corrdinate;// 0;//0; stAreaImgInfo.usY = y_corrdinate;//y_corrdinate;//350; stAreaImgInfo.usWidth = width;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = height;//40;//1872 * y_corrdinate;//gstI80DevInfo.usPanelH;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //LoadImage(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg IT8951Load1bppImageData(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { { if(count == 1) { //PRINTF("Display count 1"); //IT8951DisplayArea1(0,0,1600,1200, 2); //IT8951DisplayArea1bpp(0,0, 1600, 1200, 2, 0x00, 0xFF); // IT8951DisplayArea1bpp(x_corrdinate,y_corrdinate, width, height, 2, 0x00, 0xFF); IT8951DisplayArea1bpp(x_corrdinate,display_y, width,display_height , 2, 0x00, 0xFF); } } } } void IT8951DisplayImage1bpp(uint16_t y_corrdinate,int count) { //PRINTF("I = %d\n",i++); IT8951AreaImgInfo stAreaImgInfo; uint8_t fontheight=0; HostInit(); /////////////////START { IT8951WaitForDisplayReady(); //Load Image and Display //Set Load Area stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = y_corrdinate;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 300;//40;//1872 * y_corrdinate;//gstI80DevInfo.usPanelH;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //LoadImage(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg IT8951Load1bppImageData(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { { if(count == 1) { //PRINTF("Display count 1"); //IT8951DisplayArea1(0,0,1600,1200, 2); //IT8951DisplayArea1bpp(0,0, 1600, 1200, 2, 0x00, 0xFF); IT8951DisplayArea1bpp(0,0, 1600, 1200, 2, 0xFF, 0x00); } } } } void IT8951DisplayImageBleLOGO(TByte* p1bppImgBuf , uint16_t y_corrdinate,int count) { //PRINTF("\n Inside IT8951DisplayImageBleLOGO function I = %d\n",i++); IT8951AreaImgInfo stAreaImgInfo; uint8_t fontheight=0; HostInit(); /////////////////START { IT8951WaitForDisplayReady(); //Load Image and Display //Set Load Area stAreaImgInfo.usX = 5;//0; stAreaImgInfo.usY = y_corrdinate;//350; stAreaImgInfo.usWidth = 80;//80; stAreaImgInfo.usHeight = 60;//60;//1872 * y_corrdinate;//gstI80DevInfo.usPanelH;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; IT8951Load1bppImageData(p1bppImgBuf, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg //BLELoadImage(p1bppImgBuf, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } IT8951DisplayArea1bpp(5,1140,80,60, 2,0xFF, 0x00); } void fullrefresh() { IT8951AreaImgInfo stAreaImgInfo; uint8_t fontheight=0; //Host Initial HostInit(); //Test Function 1 //Prepare image //Write pixel 0x00(Black) to Frame Buffer //or you can create your image pattern here.. //memset(gpFrameBuf2, 0x00, (gstI80DevInfo.usPanelW * gstI80DevInfo.usPanelH)/8);//Host Frame Buffer(Source) memset(gpFrameBuf2,0xff,64000); { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 0;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 300;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 300;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 300;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 600;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 300;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 900;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 300;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 1200;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 300;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 1500;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 100;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } /* { IT8951WaitForDisplayReady(); stAreaImgInfo.usX = 0;//0; stAreaImgInfo.usY = 209+250+250+250+250;//350; stAreaImgInfo.usWidth = 1600;//gstI80DevInfo.usPanelW; stAreaImgInfo.usHeight = 130;//fontheight;//stAreaImgInfo.usHeight;//gstI80DevInfo.usPanelH; //Load Image from Host to IT8951 Image Buffer IT8951Load1bppImageMaster(gpFrameBuf2, stAreaImgInfo.usX, stAreaImgInfo.usY, stAreaImgInfo.usWidth, stAreaImgInfo.usHeight);//stAreaImgInfo.usHeight);//Display function 4, Arg } */ { { //IT8951DisplayArea1bpp(0,y_corrdinate, gstI80DevInfo.usPanelW, stAreaImgInfo.usHeight, 2, 0x00, 0xFF);//gstI80DevInfo.usPanelH, 2, 0x00, 0xFF); IT8951DisplayArea1bpp(0,0,1600,1200, 2, 0x00, 0xFF); } } }