Code: Select all
void d_icon(int x,int y) //display first bit of 8x8 icon at x,y position
{
char i,j;
if (p_x%16 <8) //if x position is on upper byte of 16 bit
{
for (j=0;j<8;j++) //repeat for 8 vertical line
{
lcd_xy(p_x/16,(p_y+j)%64); //go to the location and y is re-adjust after adding j ( > 64 after adding j )
send_char(0); //send upperbyte with shifting according to the x position
send_char(0); //send lowerbyte with shifting according to the x position
}
}
else
{
for (j=0;j<8;j++)
{
lcd_xy(p_x/16,(p_y+j)%64); //go to the location and y is re-adjust after adding j ( > 64 after adding j )
send_char (0); //send dummy data to the upperbyte
send_char(0); //send lowerbyte data with shifting according to the x position
if(p_x/16 == 7) lcd_xy(0,p_y+j);
send_char(0); //send upperbyte of the next 'x' with shifting according to the x position
}
}
if (x%16 <8) //if x position is on upper byte of 16 bit
{
for (j=0;j<8;j++) //repeat for 8 vertical line
{
lcd_xy(x/16,(y+j)%64); //go to the location and y is re-adjust after adding j ( > 64 after adding j )
send_char(icon[j]>> x%8); //send upperbyte with shifting according to the x position
send_char(icon[j]<< (8-x%8)); //send lowerbyte with shifting according to the x position
}
}
else
{
for (j=0;j<8;j++)
{
lcd_xy(x/16,(y+j)%64); //go to the location and y is re-adjust after adding j ( > 64 after adding j )
send_char (0); //send dummy data to the upperbyte
send_char(icon[j]>> x%8); //send lowerbyte data with shifting according to the x position
if(x/16 == 7) lcd_xy(0,y+j);
send_char(icon[j]<< (8-x%8)); //send upperbyte of the next 'x' with shifting according to the x position
}
}
p_x = x; //save as previous location
p_y= y; //save as previous location
}
void lcd_xy(unsigned char x,unsigned char y) //set the xy position for graphic
{
if( y >= 32)
{ //if vertical more or equal 32
send_config(0x80+y-32); //adjust the vertical line
send_config(0x80+x+8); //for more detail refer GDRAM in user manual
}
else
{
send_config(0x80+y); //vertical (Y) max 63
send_config(0x80+x); //horizontal (X) max 8 (horizontal is divided by 16 bit data (represented in 2 bytes))
}
}