Example #1
0
pick_sequence()	//get data from Sequence
{
	//printf("Start pick_sequence() for Sequence=%d\n",Sequence);
	if (Old_Sequence != Sequence)
	{
		printf("New Sequence = %d\n",Sequence);
		Old_Sequence = Sequence;
	}
	while(1)
	{
		//printf("pick_sequence: Sequence = %d\n",Sequence);
		switch (Sequence)
		{
			case(0):
				//printf("Starting blink_none....\n");
				blink_none();
				break;
			case(1):
				//printf("Starting blink_all....\n");
        			blink_all();
				break;
			case(2):
				//printf("Starting test_dim....\n");
				test_dim();
				break;
			case(3):
				//printf("Starting time_display....\n");
        			time_display();
				break;
			case(4):
				//printf("Looping up_down_4....\n");
        			up_down_4();
				break;
			case(5):
				//printf("Starting time_display....\n");
        			time_display();
				break;
			case(6):
				//printf("Starting all_on....\n");
        			all_on();
				break;
			case(7):
				printf("Starting Random Blink\n");
				blink_random();
				break;
			default:
				//printf("Sorry I don't know what to do with %d\trunning blink_none\n",Sequence);
				blink_none();
				break;
		}
	}
}
Example #2
0
/*********************************************************** 
***** 
***** 主函数 
***** 
***********************************************************/  
void main( void )  
{  
    timer0_init();  
    time_set(5, 0);  //设置5小时倒计时  
    while(1)  
    {  
        time_display();  //显示时间  
        if(countTime <= 10)  
        {  
            dpFlag = 0;           
        }  
        else  
        if(countTime <= 20)  
        {  
            dpFlag = 1;   
        }  
        else  
        {  
            countTime = 0;  
            time_judge();   
        }  
    }  
}  
Example #3
0
static void time_finish( struct pipe_winsys *winsys,
                         long long startval, 
                         unsigned idx,
                         const char *name ) 
{
   struct timed_winsys *tws = timed_winsys(winsys);
   uint64_t endval = util_time_micros();
   double elapsed = (endval - startval)/1000.0;

   if (endval - startval > 1000LL) 
      debug_printf("*** %s %.3f\n", name, elapsed );

   assert( tws->funcs[idx].name_key == name ||
           tws->funcs[idx].name_key == NULL);

   tws->funcs[idx].name_key = name;
   tws->funcs[idx].total += elapsed;
   tws->funcs[idx].calls++;

   if (endval - tws->last_dump > 10LL * 1000LL * 1000LL) {
      time_display( winsys );
      tws->last_dump = endval;
   }
}
/*
 *  ======== main ========
 */
int main(int argc, char *argv[])
{
	CSL_init();                 // Activate Grace-generated configuration
	delay();					//
    System_Initial();			// initialize system.
   	delay();					// delay and wait the first conversion.
   	_enable_interrupt();		// enable interrupt

   	while(1)
   	{
   		// half a second interrupt.
   		if(flag & BIT7)
   		{
   			half_second();
   		}

   		// read ADC result
   		if(flag & BIT4)			//Read ADC result
   		{
   			ADC_display();
   		}

   		// one second interrupt to display time
   		if (flag & BIT3)
   		{
   			time_display();
   		}

   		if(flag & BIT1)				// if SW1 is pushed, threshold temperature
   		{							//   state machine will be changed
   			flag &= ~ BIT1;			// flag is reset
   			time_state = 0;			//when threshold temperature is setting,
   									//setting time is disable.
   			if(!customThreshold) {
   				meatSelect();		//Enter meat select menu if not setting custom
   			}
   			if(Thr_state >= 3)		// if in state 3, change to state 0;
   			{
   				Thr_state = 0;
   				Thr_temp = set_temp;				// assign threshold temperature
   				LCD_display_number(0,4,Thr_temp);	// display threshold temperature

   				customThreshold = 0;		//Reset custom threshold flag
   			}
   			else							//else, Thr_state is changed to next state
   			{
   				Thr_state ++;
   			}
   		}

   		if((flag & BIT2) && (!Thr_state))	// if SW2 is pushed, and Thr_state = 0,
   		{									// time setting state machine will be changed
   			flag &= ~ BIT2;					// flag is reset

   			if(!(P1IN & BIT3))
   			{
   				flag ^= BIT9;		// S2 and SW2 are pushed together to change input
   				flag ^= BIT8;
   				if(flag & BIT9)		// Display external temp
   					LCD_display_string(1,"   Ext :");
   				else				//Display probe temp
   					LCD_display_string(1," Probe :");
   			}
   			else
   			{
   				if(time_state >= 4)					// if in state 4, change to state 0;
   				{
   					time_state = 0;
   				 	time = set_time;				// assign actual time
   					set_time = 0;
   					LCD_display_time(0,8,time);		// display setting time
   				}
   				else
   				{
   					time_state ++;
   				}
   			}
   		}

   		if(flag & BIT0)				// P1.3 service, set the Threshold temp or Time.
   		{
   			flag &= ~ BIT0;			// flag is reset
   			if(Thr_state != 0)
   			{
   				set_Thrtemp();		// set threshold temperature.
   			}
   			else if(time_state != 0)
   			{
   				set_Time();			// set timer.
   			}
   			else
   				flag ^= BIT8;		// display temperature in Fahrenheit
   		}

   		else
   		__no_operation();
   	}
}