 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		| 0x04, 0x00, // # 0x04, 0x00, // # 0x0A, 0x00, // # # 0x0A, 0x00, // # # 0x11, 0x00, // # # 0x11, 0x00, // # # 0x20, 0x80, // # # 0x3F, 0x80, // ####### 0x40, 0x40, // # # 0x40, 0x40, // # # 0x80, 0x20, // # # 0x80, 0x20, // # # 0x00, 0x00, // 0x00, 0x00, // 0x00, 0x00, // 0x00, 0x00, // | 
| while(i < arrayLength) {
while (bitCounter < 8) {
if (letterArray << bitCounter != 0) {
setPixel(x, y, black);
else
setPixel(x,y, white);
bitCounter++;
x++;
if (x < 15) {
x = 0;
y++;
}
bitCounter = 0;
i++
}
} | 
 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		| uint8_t mask; /* same type as current_byte */ | 
| mask = (1 << 7); | 
| while(mask)
{
if(current_byte & mask)
{
GLCD_SetPixel_16bpp(current_x, current_y, Black);
}
mask = mask >> 1;
current_x++;
}
 | 
| ...####. ...#...# ...#...# ...####. ...#...# ...#...# ...####. | 
| ####.... #...#... #...#... ####.... #...#... #...#... ####.... | 
| mask = (1 << cwidth); | 
| current_x -= cwidth; current_y++; | 
| current_x += cwidth; | 
 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		| 
mask = (1 << 8);
while(mask)
{
if((current_byte & mask) != 0x00)
{
GLCD_SetPixel_16bpp(current_x, current_y, Black);
}
mask = mask >> 1;
current_x++;
} | 
| // @264 'W' (11 pixels wide) 0x00, 0x00, // 0x80, 0x20, // # # 0x80, 0x20, // # # 0x44, 0x40, // # # # 0x44, 0x40, // # # # 0x44, 0x40, // # # # 0x2A, 0x80, // # # # # 0x2A, 0x80, // # # # # 0x11, 0x00, // # # 0x11, 0x00, // # # 0x00, 0x00, // 0x00, 0x00, // | 
 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		| if (letterArray << bitCounter != 0) | 
| if (letterArray & (1 << bitCounter)) | 
| 
#define CHR_SIZE (16 * 16 / 8)
/* Your letterArray appears to be 8-bit, but we'll use 16-bit pointers instead */
const uint16_t*s;/* 'source' - this is where we read from */
const uint16_t*e;/* 'end' marker */
uint16_tbits;/* but we can do things faster using 16 bits */
uint16_ti;
s = (uint16_t *) &letterArray[(c - 32) * CHR_SIZE];/* point s to the beginning of the array */
e = &s[16];/* point e to the end #!# */
while(s < e)/* while we haven't reached the end */
{
bits = *s++;/* read the bits */
i = 16;/* using our 16 bits, draw a line of 16 pixels */
while(i--)
{
color = (bits & 0x8000) ? black : white;/* pick a color */
setPixel(x++, y, color);/* set pixel and advance x */
bits = bits << 1;/* shift out the bit we've just read */
}
x -= 16;/* go back to original x-position */
y++;/* next line */
}
y -= 16;/* restore y position */
x += 16;/* advance x position, ready for next character */
 | 
 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		| 
void color_lcd_print_char(char text, int color, unsigned char x, unsigned char y)
{
if((text > 31)&&(text < 127))
{
unsigned char current_x = x;
unsigned char current_y = y;
char current_byte;
char i, pos;
uint16_t startAt = descriptors[text - 63][1];
uint16_t endAt = descriptors[text - 62][1];
char string[256];
  sprintf(string, "text: %c, text: %d, startAt: %d, endAt: %d\n", text, text, startAt, endAt);
  UARTPuts_(LPC_UART0, string);
while (startAt < endAt)
{
current_byte = newFont[startAt];
pos = 8;
while (pos--)
{
if(((current_byte>>pos) & 0x01)==0x01)
{
GLCD_SetPixel_16bpp(current_x,current_y, Black);
}
current_x++;
}
current_x=x;
current_y++;
startAt++;
}
}
}
 | 
 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		| 
const uint16_t newFont[] =
{
// @0 'A' (7 pixels wide)
0x10, //    #
0x10, //    #
0x28, //   # #
0x28, //   # #
0x44, //  #   #
0x44, //  #   #
0x7C, //  #####
0x82, // #     #
0x82, // #     #
0x00, //
0x00, //
// @11 'B' (5 pixels wide)
0xF0, // ####
0x88, // #   #
0x88, // #   #
0x88, // #   #
0xF0, // ####
0x88, // #   #
0x88, // #   #
0x88, // #   #
0xF0, // ####
0x00, //
0x00, //
//etc etc for rest of alphabet
};
 | 
| 
const uint16_t descriptors[][2] =
{
{7, 0}, // A
{5, 11}, // B
{6, 22}, // C
//etc etc for the rest of the alphabet
};
 | 
| 
void color_lcd_print_char(char text, int color, unsigned char x, unsigned char y)
{
if((text > 31)&&(text < 127))
{
unsigned char current_x = x;
unsigned char current_y = y;
char current_byte;
char i, pos;
uint16_t startAt = descriptors[text - 65][1];
uint16_t endAt = descriptors[text - 64][1];
for(i = 0; i < endAt; i++)
{
current_byte = newFont[startAt + i];
for(pos = 0; pos < 8; pos++)
{
if(((current_byte>>pos) & 0x01)==0x01)
{
GLCD_SetPixel_16bpp(current_x,current_y, Black);
}
current_x++;
}
current_x=x;
current_y++;
}
}
}
 | 
| 
void color_lcd_print_string(char * text, char length, int color, unsigned char x, unsigned char y)
{
char i = 0;
while((text != '\0')&&(i<length))
{
color_lcd_print_char(text, color, x+i*10, y);
i++;
}
}
 | 
| 
color_lcd_print_string("ABCabc", 6, Black, 10, 10);
 | 
| 
__inline void GLCD_SetPixel_16bpp(uint16_t Xpos, uint16_t Ypos, uint16_t color) {
volatile uint16_t *pLCDbuf = (uint16_t *) LCD_VRAM_BASE_ADDR; /* LCD buffer start address */
pLCDbuf[Ypos * GLCD_X_SIZE + Xpos] = color;
}
 | 
 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		| #define CHR_WIDTH 16 #define CHR_HEIGHT 16 #define CHR_SIZE ((CHR_WIDTH * CHR_HEIGHT + 7) >> 3) uint16_t *screenBase; uint16_t *d; uint32_t skip; uint32_t linesize; const uint16_t pe; screenBase = ????;/* try and find this in the setPixel code */ linesize = ????;/* perhaps 1024 * ((BIT_DEPTH + 7) >> 3) */ d = screenBase + y * linesize * CHR_HEIGHT + x * CHR_WIDTH; /* have a look at LCD_GetWordOffset and LCD_GetBitOffset; you should be able to find the screen address and the pixel address then. */ | 
| 
skip = linesize * CHR_HEIGHT - CHR_WIDTH;
while(s < e)
{
bits = *s++;
pe = &d[16];
while(d < pe)
{
*d++ = (bits & 0x8000) ? black : white;
}
d += skip;
}
 | 
