/***************************************************************************** * * Description: * Draw rectangular area with different boardser colors. Currently used * by example game. * ****************************************************************************/ void lcdRectBrd (uint8 x, uint8 y, uint8 xLen, uint8 yLen, uint8 color1, uint8 color2, uint8 color3) { uint32 i, j; //select controller selectLCD (TRUE); lcdWindow1 (x, y, x + xLen - 1, y + yLen - 1); lcdWrcmd (LCD_CMD_RAMWR); //write memory for (i = 0; i < xLen; i++) lcdWrdata (color2); for (j = 1; j < (yLen - 2); j++) { lcdWrdata (color2); for (i = 0; i < (xLen - 2); i++) lcdWrdata (color1); lcdWrdata (color3); } for (i = 0; i < xLen; i++) lcdWrdata (color3); //deselect controller selectLCD (FALSE); }
/***************************************************************************** * * Description: * Initialize LCD controller for a window (to write in). * Set start xy-position and xy-length. * Selects/deselects LCD controller. * ****************************************************************************/ void lcdWindow (uint8 xp, uint8 yp, uint8 xe, uint8 ye) { //select controller selectLCD (TRUE); lcdWindow1 (xp, yp, xe, ye); //deselect controller selectLCD (FALSE); }
/***************************************************************************** * * Description: * Draw a rectangular area with specified color. * ****************************************************************************/ void lcdRect (uint8 x, uint8 y, uint8 xLen, uint8 yLen, uint8 color) { uint32 i; uint32 len; //select controller selectLCD (TRUE); lcdWindow1 (x, y, x + xLen - 1, y + yLen - 1); lcdWrcmd (LCD_CMD_RAMWR); //write memory len = xLen * yLen; for (i = 0; i < len; i++) lcdWrdata (color); //deselect controller selectLCD (FALSE); }
/***************************************************************************** * * Description: * Clear screen (with current background color) * ****************************************************************************/ void lcdClrscr (void) { uint32 i; lcd_x = 0; lcd_y = 0; //select controller selectLCD (TRUE); lcdWindow1 (255, 255, 128, 128); lcdWrcmd (LCD_CMD_RAMWR); //write memory for (i = 0; i < 16900; i++) lcdWrdata (bkgColor); //deselect controller selectLCD (FALSE); }
/***************************************************************************** * * Description: * Draw rectangular area from bitmap. Specify xy-position and xy-length. * Compressed format is supported. * * In uncompressed color mode, pData points to an area of xLen * yLen * bytes with the icon. * In compressed mode the escapeChar is used to denote that the next * two bytes contain a length and a color (run length encoding) * Note that is is still possible to specify the color value that * equals the escape value in a compressed string. * ****************************************************************************/ void lcdIcon(tU8 x, tU8 y, tU8 xLen, tU8 yLen, tU8 compressionOn, tU8 escapeChar, const tU8* pData) { tU32 i,j; tS32 len; //select controller selectLCD(TRUE); lcdWindow1(x,y,x+xLen-1,y+yLen-1); lcdWrcmd(LCD_CMD_RAMWR); //write memory len = xLen*yLen; if (compressionOn == FALSE) { for(i=0; i<len; i++) lcdWrdata(*pData++); } else while(len > 0) { if(*pData == escapeChar) { pData++; j = *pData++; for(i=0;i<j;i++) lcdWrdata(*pData); pData++; len -= j; } else { lcdWrdata(*pData++); len--; } } //deselect controller selectLCD(FALSE); }