📄 remote1.c
字号:
for(i=0;i<100;i++)
dlms( );
}
readaddr = numcodeaddr + (IRcode%10)* curr_param_file_info.code_length;
code_handle( readaddr, curr_param_file_info.code_type );
}
}
else
{
Nmode = (fun_ctrlH&0xe0)>>5;
if( Nmode==1 )
code_handle( readaddr, curr_param_file_info.code_type );
else if( Nmode==2 ) //include reverse display
{
code_handle( readaddr, curr_param_file_info.code_type );
display_hanzi_str(param[Num],Num,0,1);
}
else if( Nmode==3 )//next display
{
clear( );
old_page_flag = page_flag;
display( fun_ctrlL,0 );
}
else if( Nmode==4 ) //go to the last display
{
clear( );
m = page_flag;
display( old_page_flag,0 );
old_page_flag = m;
}
else if( Nmode==5 ) //go to the input mode
{
TR0 = 0;
old_key_value = 0;
m = curr_chan/10;
old_page_flag = page_flag;
clear( );
display( m,1 );
open_cursor( );
m = curr_chan%10;
set_cursor( m,3 );
in_enable = 1;
}
}
}
/**************************************************************************\
*
* 函数名 :void timer0_init( void )
*
* 功 能 :init timer 0
*
* 参 数 :none
*
* 返回值 : none
*
\**************************************************************************/
void timer0_init( void )
{
TMOD |= 0x01;
TH0 = 0;
TL0 = 0;
EA = 1;
ET0 = 1;
t0_counter = 0;
}
/**************************************************************************\
*
* 函数名 :timer0( void ) interrupt 1 using 1
*
* 功 能 :按键计时
*
* 参 数 :none
*
* 返回值 : none
*
\**************************************************************************/
timer0( void ) interrupt 1 using 1
{
if(t0_counter == 50)
{
open_cursor( );
t0_counter = 0;
TR0 = 0;//关闭定时器
}
else
{
t0_counter++;
TH0 = 0;
TL0 = 0;
}
}
/**************************************************************************\
*
* 函数名 :void char_input( void )
*
* 功 能 :handle input mode 0
*
* 参 数 :none
*
* 返回值 : none
*
\**************************************************************************/
void char_input( void )
{
switch(key_value)
{
case 0x21: //number key
param[cursor_x][cursor_y-3] = '0';
disp_char('0',cursor_x,cursor_y,0);
break;
case 0x22:
param[cursor_x][cursor_y-3] = '1';
disp_char('1',cursor_x,cursor_y,0);
break;
case 0x24://diplex key
if(key_counter>4)
key_counter = 0;
param[cursor_x][cursor_y-3] = keytable[0][key_counter];//for saving
disp_char(param[cursor_x][cursor_y-3],cursor_x,cursor_y,0);// display
break;
case 0x28://diplex key
if(key_counter>4)
key_counter = 0;
param[cursor_x][cursor_y-3] = keytable[1][key_counter];
disp_char(param[cursor_x][cursor_y-3],cursor_x,cursor_y,0);
break;
case 0x30://diplex key
if(key_counter>3)
key_counter = 0;
param[cursor_x][cursor_y-3] = keytable[2][key_counter];
disp_char(param[cursor_x][cursor_y-3],cursor_x,cursor_y,0);
break;
case 0x41://diplex key
if(key_counter>3)
key_counter = 0;
param[cursor_x][cursor_y-3] = keytable[3][key_counter];
disp_char(param[cursor_x][cursor_y-3],cursor_x,cursor_y,0);
break;
case 0x42://diplex key
if(key_counter>3)
key_counter = 0;
param[cursor_x][cursor_y-3] = keytable[4][key_counter];
disp_char(param[cursor_x][cursor_y-3],cursor_x,cursor_y,0);
break;
case 0x44://diplex key
if(key_counter>4)
key_counter = 0;
param[cursor_x][cursor_y-3] = keytable[5][key_counter];
disp_char(param[cursor_x][cursor_y-3],cursor_x,cursor_y,0);
break;
case 0x48://diplex key
if(key_counter>3)
key_counter = 0;
param[cursor_x][cursor_y-3] = keytable[6][key_counter];
disp_char(param[cursor_x][cursor_y-3],cursor_x,cursor_y,0);
break;
case 0x50://diplex key
if(key_counter>4)
key_counter = 0;
param[cursor_x][cursor_y-3] = keytable[7][key_counter];
disp_char(param[cursor_x][cursor_y-3],cursor_x,cursor_y,0);
break;
}
}
/**************************************************************************\
*
* 函数名 :void input_handle( void )
*
* 功 能 :handle input mode 0
*
* 参 数 :none
*
* 返回值 : none
*
\**************************************************************************/
void input_handle( void )
{
uchar i;
uchar m;
uchar tx;
uchar ty;
uchar nextpage;
uint readaddr;
if( (key_value>=0x21)&&(key_value<=0x50) )//when data key
{
if( (old_key_value == key_value)&&(TR0 == 1) )//when the same key
{
key_counter++; //the table next char
if( (cursor_x==0)&&(cursor_y==0) )//modify the cursor station
set_cursor(9,7);
else
cursor_last_station();
}
else //when the new key
{
if(cursor_y<3)
set_cursor(cursor_x,3);
TR0 = 0;
key_counter = 0;
timer0_init( ); //restart the timer0
TR0 = 1;
old_key_value = key_value;
close_cursor( );
}
char_input( );
}
else
{
switch(key_value)//key handle
{
case 0x81://下翻屏
TR0 = 0;
close_cursor( );
disp_save( );
readaddr = page_flag * param_size + disp_base_addr + 10*(12+curr_param_file_info.code_length) + 1;
nextpage = FLASH_read_B( readaddr );
clear( );
display( nextpage,1 );
open_cursor( );
set_cursor(0,3);
old_key_value = 0;
break;
case 0x82://上翻屏
TR0 = 0;
close_cursor( );
disp_save( );
readaddr = page_flag * param_size + disp_base_addr + 10*(12+curr_param_file_info.code_length) + 2;
nextpage = FLASH_read_B( readaddr );
clear( );
display( nextpage,1 );
open_cursor( );
set_cursor(0,3);
old_key_value = 0;
break;
case 0x84://next cursor station
if( (cursor_y>=3)&&(param[cursor_x][cursor_y-3]==0) )
param[cursor_x][cursor_y-3] = 32;
cursor_next_station( );
if(cursor_y<3)
set_cursor(cursor_x,3);
break;
case 0x90://last cursor station
cursor_last_station( );
if(cursor_y<3)
{
if(cursor_x>0)
set_cursor(cursor_x-1,7);
else
set_cursor(0,3);
}
break;
case 0xe1://next row
for(i=0;i<8;i++)
{
if( (cursor_y>=3)&&(param[cursor_x][cursor_y-3]==0) )
param[cursor_x][cursor_y-3] = 32;
cursor_next_station( );
}
break;
case 0xe2://last row
for(i=0;i<8;i++)
cursor_last_station( );
break;
case 0xd0://clear key
tx = cursor_x;
ty = cursor_y;
if(cursor_y>3)//when the same row
{
disp_char(32,tx,ty-1,0);
param[tx][ty-4] = 32;
set_cursor( tx,ty-1 );
}
else if(cursor_x>0)//when not
{
disp_char(32,tx-1,7,0);
param[tx-1][4] = 32;
set_cursor(tx-1,7);
}
break;
case 0xe4://save and exit input mode
TR0 = 0;
close_cursor( );
in_enable = 0;
disp_save( );
clear( );
nextpage = page_flag;
m = page_flag;
while( !display( nextpage,0 ) )
{
readaddr = page_flag * param_size + disp_base_addr + 10*(12+curr_param_file_info.code_length) + 2;
nextpage = FLASH_read_B( readaddr );
clear( );
if(nextpage==m)
{
display( nextpage,1 );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -