Example #1
0
void check_key(void)
{
	char nKeyState = 0;
	if(watcher_data->flag & FLAG_PIN_BROADCAST){
		 nKeyState = key_process(key_broadcast,KEY_SHORTPRESS);
		 if(nKeyState > 0){
		 	if(watcher_data->flag & FLAG_TASK_BROADCAST){
		 		tts_stop();
		 	}
		 	watcher_data->flag &= ~FLAG_STATE_WAITE;
		 	watcher_data->flag |= FLAG_TASK_BROADCAST;
		 }
	}else if(watcher_data->flag & FLAG_PIN_SERVICE){
		 nKeyState = key_process(key_service,KEY_SHORTPRESS);
	}else if(watcher_data->flag & FLAG_PIN_ALARM){
		 nKeyState = key_process(key_alarm,KEY_SHORTPRESS);
	}
}
Example #2
0
void freq_main(void) 
{
	cli();
    counter_init();
	gate_init();
	stop();
	reset();
	ff_clr();
	key_init();
	
	setup_timers();

	setup_interrupts();
	adc_init();
	sti();

	/*clear counter*/
	TCNT2= 0;
	TCNT0= 0;
	TCNT1= 0xFF00;
	T0_ovc = T1_ovc =0;
	start();
	//fast clear screen...
	post_display(filter());//really result
	
	while(1) {

		key_process();	

		keep_live();
		
		mode = read_adc_mode();
	
		update_lcd_status();
	
	    if(is_stop()&&soft_stop){
		  	calc_freq();
			post_display(filter());//really result
				c_live() ; //mark succeufull ..
			if(loop>=(ST)){  //never clear
				reset();
			
			}
			loop=0;
		
		    start();
		}
  	}



}
Example #3
0
//////////////////////////////////////////////////////////////////////////
///
///     main主函数
///		@author		xul	<*****@*****.**>          
///		@date		2010-04-11                 
///     @note		不能删除
//////////////////////////////////////////////////////////////////////////
int main(void)
{
	init_devices();	//init devices
	timer0_init();	//初始化定时器
	decice_test();	//设备自我检测
	while(1)
	{
		key_process();//key process
		
		/*decode*/
		decode_process();
	//	watch_dog();//最后加上
	}
}
Example #4
0
void game_update(World * w)
{

	tick_sleep();

	tick(w);
	frame_count++;
	if (w->hero->exist == 0 || w->hero->hp <= 0) {
		scene = scene_game_over;
		return;
	}
	draw(w);
	key_process(w);

}
Example #5
0
void main()
{
	hd_writeonechar(0xa4);
	lcd_writecd(0,0x0c);
	lcd_writecd(0,0x01);
	delay_1ms(5);
	lcd_string(0x96,"0.");
	while(1)
	{
		if(!hd_key)
		{
			key_process(hd_keyconvert(hd_read(0x15)));
		}while(!hd_key);
		delay_1ms(5);
	}	
}