Example #1
0
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32l1xx_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32l1xx.c file
     */

  /* LCD GLASS Configuration */
  LCD_Glass_Config();

  /* ADC1 configuration: channel (18 or 31)  and channel (5 or 1b)   */
  ADC_Config();

  /* Configure the STM32L1XX-EVAL KEY Push button */
  STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI); 
  
#ifdef USE_STM32L152D_EVAL 
  /* Set VALUEUNIT_MILLIAMPERE */
  LCD_GLASS_ValueUnitConfig(VALUEUNIT_MILLIAMPERE);
#endif
  
  /* TIM2 Configuration */
  TIM2_Config();
  /* Request LCD RAM update */
  LCD_UpdateDisplayRequest();

  while (1)
  {   
  }
}
Example #2
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
void main(void)
{
  /* GPIO configuration -----------------------------------------*/
  GPIO_Config();  

  /* TIM2 configuration -----------------------------------------*/
  TIM2_Config();  
  

  while (1)
  {} 
}
Example #3
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
void main(void)
{
  /* GPIO configuration -----------------------------------------*/
  GPIO_Config();  

  /* TIM2 configuration -----------------------------------------*/
  TIM2_Config();

	
  enableInterrupts();

  while (1)
  {}
}
Example #4
0
static int timer_init(void)
{
	int i ;
	for(i = 0; i < 1; i++){
	
		tim[i].tim_dev.enable = tim_enable_timer;

		timer_init_cfg(&(tim[i].tim_dev.cfg),TIM2_PERIOD_US);
		register_timer_device(&(tim[i].tim_dev));
	}
	
	TIM2_Config();
	return 1;
	
}
Example #5
0
/* 
 * 函数名:main
 * 描述  : "主机"的主函数
 * 输入  :无
 * 输出  : 无
 */
int main(void)
{	 
	LED_GPIO_Config();
	TIM2_Config();
	USART2_Config(115200);
	LED1(OFF);
  LED2(OFF);
	Get_ChipID();
	printf("USART2 Test OK!!\r\n");
	printf("Chip ID is 0x%08X 0x%08X 0x%08X.\r\n",
			ChipUniqueID[0],ChipUniqueID[1],ChipUniqueID[2]);
	printf("Chip Size is %d KBytes.\r\n",(*(__IO uint32_t *)(0X1FFF7A22))&0xFFFF);
	while(1)
	{ 
		
	}	
}
Example #6
0
void main(void)
{
    /* Clock configuration -----------------------------------------*/
    CLK_Config();  
    /* GPIO configuration ------------------------------------------*/
    GPIO_Config_Init();
    
    TIM3_Config();
    TIM4_Config();
    UART1_Config();
    UART3_Config();
    
    enableInterrupts();
    DeviceStatus.workState = 16;
    Delay(200);
    //beep
    Set_Beep_OptionByte();
    Beep_Init(BEEP_FREQUENCY_4KHZ);
    BEEP_LSICalibrationConfig(LSI_128kHz);
    
    showAll();
    PowerOnBeep();
    clear();
    TIM2_Config();
    
    showTemp(Temperature[DeviceStatus.workState], ON);
    showSymbol(SYMBOL_DEFAULT);
    FunctionReport(DeviceStatus.workState);
    while (1)
    {
        if(DeviceStatus.Time_100ms == 1)
        {
            if(UART1_GetFlagStatus(UART1_FLAG_IDLE) == SET)
            {
                if(DataSize != 0)
                {
                    DataResolve(RxRecvBuffer, DataSize); 
                    DataSize = 0;
                }
            }
            DeviceStatus.Time_100ms = 0;
        }
    }
  
}
Example #7
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
void main(void)
{
  /*--------------------- TIM2 Clock = 16Mhz ----------------*/
  CLK_MasterPrescalerConfig(CLK_MasterPrescaler_HSIDiv1);
    
  /*--------------------- TIM3 Config------------------------*/
  TIM3_Config();
  
  /*--------------------- TIM2 Config------------------------*/
  TIM2_Config();

  /* Compute TIM3 CC2 clock frequency */
  TIM3ClockFreq = (8 * TIM2ClockFreq) / (ICValue2 - ICValue1);
  
  /* Insert a break point here */
  nop();

  while (1)
  {}
}
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
void main(void)
{
	static u16 i=0;
	
	CLK_Config();

	UART_Config();

	TIM2_Config();
	enableInterrupts();

	printF("TIM2_Config finish !\n",FALSE,0);

    /* Infinite loop */
    while (1)
    {
    	_Delay(100);
		printF("LOG MSG (%4d) !\n",TRUE,i++);
    }
}
Example #9
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{  
  /*!< At this stage the microcontroller clock setting is already configured, 
  this is done through SystemInit() function which is called from startup
  file (startup_stm32f0xx.s) before to branch to application main.
  To reconfigure the default setting of SystemInit() function, refer to
  system_stm32f0xx.c file
  */ 
  
  /* Preconfiguration before using DAC----------------------------------------*/
  DAC_Config();
  
  /* TIM2 configuration to trigger DAC */
  TIM2_Config();
  
  /* Configures User Button */
  STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_EXTI);
  
  while (1)
  {
    /* If the User Button is pressed */
    if (KeyPressed == RESET)
    {            
      DAC_DeInit(); 
      
      /* select waves forms according to the Key Button status */
      if (SelectedWavesForm == 1)
      {
        /* The sine wave and the escalator wave has been selected */
        DAC_Sine_EscalatorConfig();        
      }
      else
      {
        /* The triangle wave and the noise wave has been selected */
        DAC_Noise_TriangleConfig();
      }
      
      KeyPressed = SET; 
    }
  }
}
Example #10
0
void System_Time_Init(void)
{
	MPU6050_READ();//读取
	Get_Accel_Angle(MPU6050_ACC_LAST.X,MPU6050_ACC_LAST.Y,MPU6050_ACC_LAST.Z,&Q_ANGLE.ROLL,&Q_ANGLE.PITCH);//加速度算出的角度为初始角度
	TIM2_Config();
}
Example #11
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f4xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */
	
//initiate user button
  //PB_Config();
	STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_EXTI);

	//initiate LEDs and turn them on
  LED_Config();	
	
 

  /* -----------------------------------------------------------------------
    TIM3 Configuration: Output Compare Timing Mode:
    
    In this example TIM3 input clock (TIM3CLK) is set to 2 * APB1 clock (PCLK1), 
    since APB1 prescaler is different from 1.   
      TIM3CLK = 2 * PCLK1  
      PCLK1 = HCLK / 4 
      => TIM3CLK = HCLK / 2 = SystemCoreClock /2
          
    To get TIM3 counter clock at 50 MHz, the prescaler is computed as follows:
       Prescaler = (TIM3CLK / TIM3 counter clock) - 1
       Prescaler = ((SystemCoreClock /2) /0.5 MHz) - 1
                                              
    CC1 update rate = TIM3 counter clock / CCR1_Val = 10.0 Hz
    ==> Toggling frequency = 5 Hz

    Note: 
     SystemCoreClock variable holds HCLK frequency and is defined in system_stm32f4xx.c file.
     Each time the core clock (HCLK) changes, user had to call SystemCoreClockUpdate()
     function to update SystemCoreClock variable value. Otherwise, any configuration
     based on this variable will be incorrect.    
		 ----------------------------------------------------------------------- */ 	
	
	//=======================Configure and init Timer======================
  /* Compute the prescaler value */
  PrescalerValue = (uint16_t) ((SystemCoreClock / 2) / 500000) - 1; //configures clock speed at 500 KHz. Both Tim2 and Tim3 use the same prescsaler and therefore run at the same speed.

 /* TIM Configuration */
  TIM3_Config();
	TIM2_Config();

	// configure the output compare
	TIM3_OCConfig();
	TIM2_OCConfig();

  /* TIM Interrupts enable */
  TIM_ITConfig(TIM3, TIM_IT_CC1, ENABLE);
	TIM_ITConfig(TIM2, TIM_IT_CC1, ENABLE);
	
  /* TIM3 enable counter */
  TIM_Cmd(TIM3, ENABLE);
	TIM_Cmd(TIM2, ENABLE); 
	
//======================================configure and init LCD  ======================	
	 /* LCD initiatization */
  LCD_Init();
  
  /* LCD Layer initiatization */
  LCD_LayerInit();
    
  /* Enable the LTDC */
  LTDC_Cmd(ENABLE);
  
  /* Set LCD foreground layer */
  LCD_SetLayer(LCD_FOREGROUND_LAYER);
	
//================EEPROM init====================================

/* Unlock the Flash Program Erase controller */
		FLASH_Unlock();
		/* EEPROM Init */
		EE_Init();

//============ Set up for random number generation==============
	RNG_Config();
	Ext_PushButton_Interrupt(); //configures external push button

	//with the default font, LCD can display  12 lines of chars, they are LINE(0), LINE(1)...LINE(11) 
	//with the default font, LCD can display  15 columns, they are COLUMN(0)....COLUMN(14)


		LCD_Clear(LCD_COLOR_WHITE); //change the background colour of LCD 
			
		//Display a string in one line, on the first line (line=0)
		LCD_DisplayString(0, 2, (uint8_t *) "Best: ");  //the line will not wrap
		
  while (1){ 
		
			if (UBPressed==1) { //press user button
					if (pause==1){	//pause mode
						randnum = ((RNG_GetRandomNumber()%2000)+1000); //generates a random number between 1000 and 3000
						Pause_Random(randnum); //see below function to see how the pause is implemented
					}
					else { //measure time mode
						TIM_ITConfig(TIM2, TIM_IT_CC1, DISABLE); //turns off timer 2
						TIM_Cmd(TIM2, DISABLE);
						time = timer; //gets user's time
						if (initial == 1) { //sets initial best_time to first time 
						best_time = time; 
						initial = 0;
						LCD_DisplayInt((uint16_t) 0, (uint16_t) 7, best_time);
						} 
						LCD_DisplayString(2, 1, (uint8_t *) "Time: "); //print time
						LCD_DisplayString(2, 7, (uint8_t *) "                 "); //clears line
						LCD_DisplayInt((uint16_t) 2, (uint16_t) 7, time); //displays user's time
						LCD_DisplayString(2, 11, (uint8_t *) "ms"); //print ms
						if (time > 10 && time < best_time) { //set new best time
							best_time = time;
							LCD_DisplayString(0, 7, (uint8_t *) "          "); //clears line
							LCD_DisplayInt((uint16_t) 0, (uint16_t) 7, best_time);
						}
						TIM_ITConfig(TIM2, TIM_IT_CC1, ENABLE); //turns on timer 2
						TIM_Cmd(TIM2, ENABLE);
						pause = 1; //this makes it so that you can use the user button to repeat the cycle in case you don't have an external push button
					}
				UBPressed=0;				
			}

	}
}
/********************************************************************//**
* @brief		Initializes the TIMx peripheral according to the specified
*               parameters.
* @param[in]	TIMx	Timer peripheral selected, should be:
*   			- LPC_TIM0: TIMER0 peripheral
* 				- LPC_TIM1: TIMER1 peripheral
* 				- LPC_TIM2: TIMER2 peripheral
* 				- LPC_TIM3: TIMER3 peripheral
* @param[in]	IntFlag: interrupt type, should be:
* 				- None   : No Pin Configuration
* 				- TIM_MR0: Configure for Ext Match channel 0
* 				- TIM_MR1: Configure for Ext Match channel 1
* 				- TIM_MR2: Configure for Ext Match channel 2 for only Timer2
* 				- TIM_MR3: Configure for Ext Match channel 3 for only Timer2
* 				- TIM_CR0: Configure for Capture channel 0
* 				- TIM_CR1: Configure for Capture channel 1
* @return 		None
*********************************************************************/
void TIM_Config(LPC_TIM_TypeDef *TIMx, TIM_PCFG_TYPE PCfg)
{
	// Pin configuration for TIM
	PINSEL_CFG_Type PinCfg;

	if (TIMx == LPC_TIM0)
	{
		switch (PCfg)
		{
		 case TIM_MR1:
			 // Configure P3.26 as MAT0.1
			 PinCfg.Funcnum = 2;
			 PinCfg.OpenDrain = 0;
			 PinCfg.Pinmode = 0;
			 PinCfg.Portnum = 3;
			 PinCfg.Pinnum = 26;
			 PINSEL_ConfigPin(&PinCfg);
			 break;

		 case None:
			 break;

		 default:
		 		//Error match value
		 		//Error loop
		 		while(1);
		}

		// Pin Configuration
		TIM0_Config();    // Timer0 Configuration
	}
	else if (TIMx == LPC_TIM1)
	{
		switch (PCfg)
		{
		 case TIM_MR0:
			 // Configure P1.22 as MAT1.0
			 PinCfg.Funcnum = 3;
			 PinCfg.OpenDrain = 0;
			 PinCfg.Pinmode = 0;
			 PinCfg.Portnum = 1;
			 PinCfg.Pinnum = 22;
			 PINSEL_ConfigPin(&PinCfg);
			 break;

		 case TIM_MR1:
			 // Configure P1.25 as MAT1.1
			 PinCfg.Funcnum = 3;
			 PinCfg.OpenDrain = 0;
			 PinCfg.Pinmode = 0;
			 PinCfg.Portnum = 1;
			 PinCfg.Pinnum = 25;
			 PINSEL_ConfigPin(&PinCfg);
			 break;

		 case TIM_CR0:
			 // Configure P1.18 as CAP1.0
			 PinCfg.Funcnum = 3;
			 PinCfg.OpenDrain = 0;
			 PinCfg.Pinmode = 0;
			 PinCfg.Portnum = 1;
			 PinCfg.Pinnum = 18;
			 PINSEL_ConfigPin(&PinCfg);
			 break;

		 case TIM_CR1:
			 // Configure P1.19 as CAP1.1
			 PinCfg.Funcnum = 3;
			 PinCfg.OpenDrain = 0;
			 PinCfg.Pinmode = 0;
			 PinCfg.Portnum = 1;
			 PinCfg.Pinnum = 19;
			 PINSEL_ConfigPin(&PinCfg);
			 break;

		 case None:
			 break;

		 default:
		 		//Error match value
		 		//Error loop
		 		while(1);
		}

		TIM1_Config();   // Timer1 Configuration
	}
	else if (TIMx == LPC_TIM2)
	{
		switch (PCfg)
		{
		 case TIM_MR0:
			 // Configure P4.28 as MAT2.0
			 PinCfg.Funcnum = 2;
			 PinCfg.OpenDrain = 0;
			 PinCfg.Pinmode = 0;
			 PinCfg.Portnum = 4;
			 PinCfg.Pinnum = 28;
			 PINSEL_ConfigPin(&PinCfg);
			 break;

		 case None:
			 break;

		 default:
		 		//Error match value
		 		//Error loop
		 		while(1);
		}

		// Pin Configuration
		TIM2_Config();    // Timer2 Configuration
	}
	else if (TIMx == LPC_TIM3)
	{
		switch (PCfg)
		{
		 case TIM_MR0:
			 // Configure P0.10 as MAT3.0
			 PinCfg.Funcnum = 3;
			 PinCfg.OpenDrain = 0;
			 PinCfg.Pinmode = 0;
			 PinCfg.Portnum = 0;
			 PinCfg.Pinnum = 10;
			 PINSEL_ConfigPin(&PinCfg);
			 break;

		 case TIM_MR1:
			 // Configure P0.11 as MAT3.1
			 PinCfg.Funcnum = 3;
			 PinCfg.OpenDrain = 0;
			 PinCfg.Pinmode = 0;
			 PinCfg.Portnum = 0;
			 PinCfg.Pinnum = 11;
			 PINSEL_ConfigPin(&PinCfg);
			 break;

		 case None:
			 break;

		 default:
		 		//Error match value
		 		//Error loop
		 		while(1);
		}

		// Pin Configuration
		TIM3_Config();    // Timer3 Configuration
	}
}
Example #13
0
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f4xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */
	
//initiate user button
  PB_Config();

	//initiate LEDs and turn them on
  LED_Config();	
	
 

  /* -----------------------------------------------------------------------
    TIM3 Configuration: Output Compare Timing Mode:
    
    In this example TIM3 input clock (TIM3CLK) is set to 2 * APB1 clock (PCLK1), 
    since APB1 prescaler is different from 1.   
      TIM3CLK = 2 * PCLK1  
      PCLK1 = HCLK / 4 
      => TIM3CLK = HCLK / 2 = SystemCoreClock /2
          
    To get TIM3 counter clock at 50 MHz, the prescaler is computed as follows:
       Prescaler = (TIM3CLK / TIM3 counter clock) - 1
       Prescaler = ((SystemCoreClock /2) /50 MHz) - 1
                                              
    CC1 update rate = TIM3 counter clock / CCR1_Val = 9.154 Hz
    ==> Toggling frequency = 4.57 Hz

    Note: 
     SystemCoreClock variable holds HCLK frequency and is defined in system_stm32f4xx.c file.
     Each time the core clock (HCLK) changes, user had to call SystemCoreClockUpdate()
     function to update SystemCoreClock variable value. Otherwise, any configuration
     based on this variable will be incorrect.    
		 ----------------------------------------------------------------------- */ 	
	
	//=======================Configure and init Timer======================
  /* Compute the prescaler value */
  PrescalerValue = (uint16_t) ((SystemCoreClock / 2) / 200000) - 1;

 /* TIM Configuration */
  TIM2_Config();

	// configure the output compare
	TIM2_OCConfig();

  /* TIM Interrupts enable */
  TIM_ITConfig(TIM2, TIM_IT_CC1, ENABLE);

  /* TIM3 enable counter */
  TIM_Cmd(TIM2, ENABLE);
  while (1){ 
		
			if (UBPressed==1) { 
				
				STM_EVAL_LEDOff(LED3);
				STM_EVAL_LEDOff(LED4);
				
				hardwareBlinking();
				
				UBPressed=0;				
			}

			
	}
	
}
Example #14
0
/*
 * fill INS_delay_buffer
 * wait GPS signal
 */
void vINSAligTask(void* pvParameters)
{
	char printf_buffer[100];
	
	/*odometry sensor data*/
	float direction;
	u8 temp;
	float *p_insBuffer;
	GPSDataType gdt;
	u16 GPS_validate_cnt=0;
	float uw_height;
	
	portBASE_TYPE xstatus;
	
	/*Enable ultrasonic sensor TIMER*/
	TIM2_Config();
	TIM2_IT_Config();
	
	/**/
	xQueueReceive(AHRSToINSQueue,&p_insBuffer,portMAX_DELAY);	//capture an INS frame	 
	p_insBuffer[INDEX_DT]=0.0;	//the last number in buffer represent time interval, not time
	Blinks(LED1,2);

#ifdef INS_DEBUG
	/*GPS data is not needed in debug mode*/
	while(1)
	{		
		/*receive ins data and fill the IMU_delay_buffer*/
		xQueueReceive(AHRSToINSQueue,&p_insBuffer,portMAX_DELAY);
		PutToBuffer(p_insBuffer);
		/*clear time interval*/
		p_insBuffer[INDEX_DT]=0.0;
		/*INS_delay_buffer is full filled*/
		if(buffer_header == 0) break;
	}
	
	navParamK[0] = 0.0;
	navParamK[1] = 0.0;
	navParamK[2] = 0.0;
	navParamK[3] = 0.0;
	navParamK[4] = 0.0;
	navParamK[5] = 0.0;
	navParamK[6] = 0.0;
	navParamK[7] = 0.0;
	navParamK[8] = 0.0;
	
	x[0]=0.0;
	x[1]=0.0;
	x[2]=0.0;
	x[3]=0.0;
	x[4]=0.0;
	x[5]=0.0;
	x[6]=0.0;
	x[7]=0.0;
	x[8]=0.0;
#else
	//normol mode
	
	/*wait while GPS signal not stable*/
	while(GPS_validate_cnt<=100)
	{
		xstatus = xQueueReceive(xUartGPSQueue,&gdt,0);
		if(xstatus == pdPASS)
		{
			GPS_validate_cnt ++;
		}
		if(GetUltraSonicMeasure(&uw_height))
		{
			sprintf(printf_buffer,"%1.3f\r\n",uw_height);
			UartSend(printf_buffer,7);
		}
		
		/*receive ins data and fill the IMU_delay_buffer*/
		xQueueReceive(AHRSToINSQueue,&p_insBuffer,portMAX_DELAY);
		PutToBuffer(p_insBuffer);
		/*clear time interval*/
		p_insBuffer[INDEX_DT]=0.0;
	}

	/************initialize navParamK*********************/
	temp=(u8)(gdt.Lati*0.01);
	initPos[0]=0.01745329*(temp+(gdt.Lati-temp*100.0)*0.0166667);

	temp=(u8)(gdt.Long*0.01);
	initPos[1]=0.01745329*(temp+(gdt.Long-temp*100.0)*0.0166667);
	initPos[2]=gdt.Alti;

	if(gdt.type != GPGMV)
	{
		direction = gdt.COG*0.0174533;
		gdt.speedN = gdt.SPD*0.51444*arm_cos_f32(direction);
		gdt.speedE = gdt.SPD*0.51444*arm_sin_f32(direction);
	}
	
	navParamK[0] = 0.0;
	navParamK[1] = 0.0;
	navParamK[2] = 0.0;
	navParamK[3] = gdt.speedN;
	navParamK[4] = gdt.speedE;
	navParamK[5] = 0.0;
	navParamK[6] = 0.0;
	navParamK[7] = 0.0;
	navParamK[8] = 0.0;
	
	/*initialize filter state param x*/
	x[0]=0.0;
	x[1]=0.0;
	x[2]=0.0;
	x[3]=0.0;
	x[4]=0.0;
	x[5]=0.0;
	x[6]=0.0;
	x[7]=0.0;
	x[8]=0.0;
#endif	
	xstatus=xTaskCreate(vIEKFProcessTask,(signed portCHAR *)"ins_ekf",configMINIMAL_STACK_SIZE+1024,(void *)NULL,tskIDLE_PRIORITY+1,NULL);
	if(xstatus!=pdTRUE)
	{
		sprintf(printf_buffer, "failed to initialize\r\n");
		UartSend(printf_buffer, strlen(printf_buffer));
	}
	vTaskDelete(NULL);
}
Example #15
0
void main(void)
{
    /* Clock configuration -----------------------------------------*/
    CLK_Config();  
    /* GPIO configuration ------------------------------------------*/
    GPIO_Config_Init();
    UART1_Config();
    UART3_Config();
    PWM_Config();
    TIM2_Config();
    TIM3_Config();
    TIM4_Config();
    
    I2C_RTC_Init();
    /* Enable general interrupts */  
    enableInterrupts();
                  //【秒, 分, 时, 日, 星期, 月, 年】
    uint8_t time[] = {00, 12, 10, 1, 1, 6, 15};
    //Set_RT8563(time, 2, 7);
    ResetNetMode();
#if 0
    uint8_t Alarm[5][3] = {1, 16, 31, 1, 16, 33, 1, 16, 35};
    uint8_t Time[7] = {0};
    uint8_t AlarmState = 0;
    uint8_t AlarmDelay = 1;
    unsigned int NET_AUTO_SEND = 0;
#endif
    
    while (1)
    {
#if 0
        Delay(1000);
        Send_BAT_Voltage(Get_BAT_Value());
        UART3_SendString("\n", 1);
        AQI2PM25(Get_DS_Value());
#endif      
        if(DeviceStatus.Time_30ms == 1)
        {
            TouchKey_Read();
            DeviceStatus.Time_30ms = 0;
        }
        if(DeviceStatus.Time_100ms == 1)
        {
            if(UART1_GetFlagStatus(UART1_FLAG_IDLE) == SET)
            {
                if(DataSize != 0)
                {
                    DataResolve(RxRecvBuffer, DataSize); 
                    NetProcess();
                    DataSize = 0;
                }
            }
            DeviceStatus.Time_100ms = 0;
        }
        if(DeviceStatus.Time_1_s == 1)
        {
            Get_RT8563(time, 2, 7);
#if 0
            ArrayCopy((uint8_t *)&NetMode.SendData, time, 7);
            UART3_SendString((uint8_t *)&NetMode.SendData, 7);
            if(NetMode.Status & NET_CONNECT)    
            {
                NET_LED_FLASH;
                NET_AUTO_SEND++;
                if(NET_AUTO_SEND == 10)//自动发送数据
                {
                    NetSendDataLength();
                    
                    NET_AUTO_SEND = 0;
                }
            }
            else NET_AUTO_SEND = 0;
#endif
            
            DeviceStatus.Time_1_s = 0;
        }

        if(DeviceStatus.Time_30_s == 1)
        {
            NetModeErrorFix();
            DeviceStatus.Time_30_s = 0;
        }
#if 0
        GetTime(Time);
        if(ArrayCMP(Alarm, Time, 3) == 0 && AlarmState == 0) 
        {
            GPIO_WriteHigh(GPIOF, GPIO_PIN_5);
            FAN_SPEED_HIGH; //高速
            Alarm[2] += AlarmDelay;
            AlarmState = 1;
        }
        else if(ArrayCMP(Alarm, Time, 3) == 0 && AlarmState == 1)
        {
            GPIO_WriteLow(GPIOF, GPIO_PIN_5);
            FAN_SPEED_OFF;
            AlarmState = 0;
            Alarm[2] -= AlarmDelay;
        }
#endif
    }
  
}