📄 s1d13700.c
字号:
s1d13700_write_data(0x39);
s1d13700_write_data(0xef);
s1d13700_write_data(0x28);
s1d13700_write_data(0x00);
// Display control
s1d13700_write_command(0x44);
s1d13700_write_data(0x00); // Bank 1
s1d13700_write_data(0x00);
s1d13700_write_data(0xef);
s1d13700_write_data(0x00); // Bank 2
s1d13700_write_data(0x40);
s1d13700_write_data(0xef);
s1d13700_write_data(0x00); // Bank 3
s1d13700_write_data(0x80);
s1d13700_write_data(0x00);
s1d13700_write_data(0x00);
// Set cursor form
//s1d13700_write_command(0x5d);
//s1d13700_write_data(0x07);
//s1d13700_write_data(0x87);
// Set horizontal pixel shift to zero
s1d13700_write_command(0x5a);
s1d13700_write_data(0x00);
// Set ovlay
s1d13700_write_command(0x5b);
s1d13700_write_data(0x0c);
// Display on/off
s1d13700_write_command(0x59);
s1d13700_write_data(0x16&0xfc);
// Set GrayScaler depth
//s1d13700_write_command(0x60);
//s1d13700_write_data(0x00);
}
/************************************************************
*Function Name : s1d13700_set_cursor
*Description : This function Set Cursor in specific
* location.
*Iuput : unsigned int x location
* unsigned int y location
* unsigned char block
*Return : none
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->S1D13700 Set Cursor Location----------------------------
void s1d13700_set_cursor(unsigned int x,unsigned int y,unsigned char block)
{
int location=0;
s1d13700_write_command(0x46);
location = x + (LCD_HORIZON_WIDTH / 8) * (y) + block * 0x4000;
s1d13700_write_data((unsigned char)(location));
s1d13700_write_data((unsigned char)(location >> 8));
}
/************************************************************
*Function Name : s1d13700_set_cursor_dir
*Description : This function set cursor movement dirction.
*Iuput : unsigned int dir ('r','l','u','d')
*Return : none
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->S1D13700 Set Cursor Direction---------------------------
void s1d13700_set_cursor_dir(unsigned char dir)
{
if(dir=='r')
{ s1d13700_write_command(0x4c); }
if(dir=='l')
{ s1d13700_write_command(0x4d); }
if(dir=='u')
{ s1d13700_write_command(0x4e); }
if(dir=='d')
{ s1d13700_write_command(0x4f); }
}
/************************************************************
*Function Name : s1d13700_write_locate
*Description : This function Set Cursor in specific
* location and then diaplay a byte there.
*Iuput : unsigned int x location
* unsigned int y location
* unsigned char data
*Return : none
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->Display a byte in a location-------------------------------------------
void s1d13700_write_locate(unsigned int x,unsigned int y,unsigned char data,unsigned char color)
{
int location=0;
s1d13700_write_command(0x46);
location = x + (LCD_HORIZON_WIDTH / 8) * (y);
s1d13700_write_data((unsigned char)(location));
s1d13700_write_data((unsigned char)(location >> 8));
s1d13700_write_command(0x42);
if(color==BLACK)
{ s1d13700_write_data(data); }
if(color==WHITE)
{ s1d13700_write_data(~data); }
}
//-->Display a byte in a location in layer 2--------------------------------
void s1d13700_write_locate_l2(unsigned int x,unsigned int y,unsigned char data,unsigned char color)
{
int location=0;
s1d13700_write_command(0x46);
location = x + (LCD_HORIZON_WIDTH / 8) * (y) + 0x4000;
s1d13700_write_data((unsigned char)(location));
s1d13700_write_data((unsigned char)(location >> 8));
s1d13700_write_command(0x42);
if(color==BLACK)
{ s1d13700_write_data(data); }
if(color==WHITE)
{ s1d13700_write_data(~data); }
}
/************************************************************
*Function Name : s1d13700_read_locate
*Description : This function sets cursor in specific
* location and then reads a byte value there.
*Iuput : unsigned int x location
* unsigned int y location
*Return : unsigned char data
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->Read a byte in a location----------------------------------
unsigned char s1d13700_read_locate(unsigned int x,unsigned int y)
{
int location=0;
unsigned char data;
s1d13700_write_command(0x46);
location = x + (LCD_HORIZON_WIDTH / 8) * (y);
s1d13700_write_data((unsigned char)(location));
s1d13700_write_data((unsigned char)(location >> 8));
s1d13700_write_command(0x43);
data = s1d13700_read_data();
return(data);
}
/************************************************************
*Function Name : fill_screen
*Description : This function fill the whole screen with
* the same value of a byte.
*Iuput : unsigned char data
*Return : none
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->Fulfill the Screen--------------------------------------
void fill_screen(unsigned char data)
{
unsigned int i;
s1d13700_set_cursor(0,0,0);
s1d13700_set_cursor_dir('r');
s1d13700_write_command(0x42);
for(i=0;i<9600;i++)
{ s1d13700_write_data(data); }
s1d13700_set_cursor(0,0,1);
s1d13700_set_cursor_dir('r');
s1d13700_write_command(0x42);
for(i=0;i<9600;i++)
{ s1d13700_write_data(data); }
}
/************************************************************
*Function Name : clear_screen
*Description : This function clean the whole screen with
* blank.
*Iuput : none
*Return : none
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->Clear Screen--------------------------------------------
void clear_screen(void)
{ fill_screen(0); }
/*
void wrhz(unsigned int row,unsigned int col)
{
int i,k;
unsigned int cursor,tempaddress;
unsigned int temprow,tempcol;
unsigned char addl,addh;
s1d13700_write_command(0x59);
s1d13700_write_data(0x06);
s1d13700_write_command(0x4f);
for(i=0;i<4;i++)
{
tempcol=col+i*2;
for(k=0;k<16;k++)
{
temprow=row+k;
s1d13700_write_locate(tempcol,temprow,hztab[i*32+2*k]);
}
for(k=0;k<16;k++)
{
temprow=row+k;
s1d13700_write_locate(tempcol+1,temprow,hztab[i*32+(2*k+1)]);
}
}
s1d13700_write_command(0x4c);
}
void LCD(void)
{ unsigned char data, i,j;
s1d13700_initialize();
clear_screen();
//fill_screen('A');
do{
clear_screen();
data = s1d13700_read_locate(4,7);
data = s1d13700_read_locate(2,7);
data = s1d13700_read_locate(1,7);
s1d13700_delay(1000);
fill_screen(0xff);
data = s1d13700_read_locate(4,7);
data = s1d13700_read_locate(2,7);
data = s1d13700_read_locate(1,7);
s1d13700_delay(1000);
clear_screen();
fill_screen(0xaa);
data = s1d13700_read_locate(4,7);
data = s1d13700_read_locate(2,7);
data = s1d13700_read_locate(1,7);
s1d13700_delay(1000);
clear_screen();
wrhz(0x00,0x00);
data = s1d13700_read_locate(4,7);
data = s1d13700_read_locate(2,7);
data = s1d13700_read_locate(1,7);
//wramap();
for(i=0;i<10;i++)
{
s1d13700_delay(1000);
}
clear_screen();
wrhz(0x00,0x00);
for(i=0;i<30;i++)
{
s1d13700_delay(1000);
}
}while(1);
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -