⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm32f10x_it.c

📁 用 Hitex 工具软件开发 stm32 的例子
💻 C
📖 第 1 页 / 共 3 页
字号:
               uart_com_buff.data[uart_com_buff.pos++] = 0x00;
               CountMode = 0x02;
               uart_com_buff.bit++;
            }
            else
            {  /*no valid bit*/
              break;
            }
            Counter.ValueA = 0x00;
            Counter.ValueB = 0x00;         
            break;
         default:
            break;
         }
         if(uart_com_buff.bit >=14)
         {
            EXTI_DeInit();
            TIM_Cmd(TIM2, DISABLE);
            
            wait_temp = SysTick_GetCounter();
            wait_rc = 0;
            while(wait_rc != 500) /*wait 500ms because of resend from RC*/
            {
               if((SysTick_GetCounter() - wait_temp) == 0)
                  wait_rc++;
            }
        
            /*Send Data To GUI*/
            SendTask->Data[0] = 0x49;                    /*I */
            for(i=(uart_com_buff.pos-14), j = 1;i < uart_com_buff.pos;i++, j++)
               SendTask->Data[j] = uart_com_buff.data[i];
            SendTask->Data[15] = 0x0D;                   /* <CR> */    
            
            protocol_SendFrame (Cmd_Info_UIR_Data, (u8 *)SendTask->Data, 16);
            rc_gui_send = TRUE;        
        
            CountMode = 0x00;   
            uart_com_buff.bit = 0;      
            EXTI_Init(&EXTI_InitStructure);
         }
      
         if(uart_com_buff.pos >=56)
         {
            uart_com_buff.ready = TRUE;
            TIM_Cmd(TIM2, DISABLE);
            EXTI_DeInit();
         }
        
      }
      TIM_ClearITPendingBit(TIM2, TIM_IT_CC3);
   }
   /*RC Replay Enabled*/
   else if(UIR_State == RC_play_enable)
   {
      if (TIM_GetITStatus(TIM2, TIM_IT_CC3) != RESET)
      {   
         TIM_SetCompare3(TIM2, 97);
      
      
         if((rc_output_pos == 28) | (rc_output_pos == 56) | (rc_output_pos == 84))  
         {
            GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
            GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
            GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
            GPIO_Init(GPIOA, &GPIO_InitStructure);  
                        
            wait_temp = SysTick_GetCounter();
            wait_rc = 0;
            while(wait_rc != 2000) /*wait 1000ms because of send new RC Message*/
            {
               if((SysTick_GetCounter() - wait_temp) == 0)
                  wait_rc++;
            }
         }
         if((rc_output_pos) >= (2 * uart_com_buff.pos))
         {
    
            rc_output_pos = 0;     
            TIM_Cmd(TIM2, DISABLE);
            TIM1_Cmd( DISABLE);
            TIM1_CtrlPWMOutputs(DISABLE);  
       }
               
       if(rc_output[rc_output_pos++] == 1)
       {
          GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
          GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
          GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
          GPIO_Init(GPIOA, &GPIO_InitStructure);
       }
       else
       {
          GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
          GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
          GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
          GPIO_Init(GPIOA, &GPIO_InitStructure);
       }



         TIM_ClearITPendingBit(TIM2, TIM_IT_CC3);
      }
   
   }
   else
   {
      if (TIM_GetITStatus(TIM2, TIM_IT_CC1) != RESET)
      {
         TIM_SetCompare1(TIM2, 0x80);
         TIM_ClearITPendingBit(TIM2, TIM_IT_CC1);
      }
      if (TIM_GetITStatus(TIM2, TIM_IT_CC2) != RESET)
      {
         if (FFTState.enabled == TRUE)
         {
            TIM_SetCompare2(TIM2, 400);
            fr[FFT_Index++] = ADC_GetConversionValue(ADC1);
            ADC_Cmd(ADC1, ENABLE);
         }
         TIM_ClearITPendingBit(TIM2, TIM_IT_CC2);
      }
   }
}

/*******************************************************************************
* Function Name  : TIM3_IRQHandler
* Description    : This function handles TIM3 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(45) TIM3_IRQHandler(void)
#else
void TIM3_IRQHandler(void)
#endif
{
}

/*******************************************************************************
* Function Name  : TIM4_IRQHandler
* Description    : This function handles TIM4 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(46) TIM4_IRQHandler(void)
#else
void TIM4_IRQHandler(void)
#endif
{
}

/*******************************************************************************
* Function Name  : I2C1_EV_IRQHandler
* Description    : This function handles I2C1 Event interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(47) I2C1_EV_IRQHandler(void)
#else
void I2C1_EV_IRQHandler(void)
#endif
{
}

/*******************************************************************************
* Function Name  : I2C1_ER_IRQHandler
* Description    : This function handles I2C1 Error interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(48) I2C1_ER_IRQHandler(void)
#else
void I2C1_ER_IRQHandler(void)
#endif
{
}

/*******************************************************************************
* Function Name  : I2C2_EV_IRQHandler
* Description    : This function handles I2C2 Event interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(49) I2C2_EV_IRQHandler(void)
#else
void I2C2_EV_IRQHandler(void)
#endif
{
}

/*******************************************************************************
* Function Name  : I2C2_ER_IRQHandler
* Description    : This function handles I2C2 Error interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(50) I2C2_ER_IRQHandler(void)
#else
void I2C2_ER_IRQHandler(void)
#endif
{
}

/*******************************************************************************
* Function Name  : SPI1_IRQHandler
* Description    : This function handles SPI1 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(51) SPI1_IRQHandler(void)
#else
void SPI1_IRQHandler(void)
#endif
{
}

/*******************************************************************************
* Function Name  : SPI2_IRQHandler
* Description    : This function handles SPI2 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(52) SPI2_IRQHandler(void)
#else
void SPI2_IRQHandler(void)
#endif
{
}

/*******************************************************************************
* Function Name  : USART1_IRQHandler
* Description    : This function handles USART1 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(53) USART1_IRQHandler(void)
#else
void USART1_IRQHandler(void)
#endif
{

   UART1_isr();
}

/*******************************************************************************
* Function Name  : USART2_IRQHandler
* Description    : This function handles USART2 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(54) USART2_IRQHandler(void)
#else
void USART2_IRQHandler(void)
#endif
{
   UART2_isr();
}

/*******************************************************************************
* Function Name  : USART3_IRQHandler replaced by the UART.c implemented handler
* Description    : This function handles USART3 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(55) USART3_IRQHandler(void)
#else
void USART3_IRQHandler(void)
#endif
{
  UART3_isr();
}

/*******************************************************************************
* Function Name  : EXTI15_10_IRQHandler
* Description    : This function handles External lines 15 to 10 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(56) EXTI15_10_IRQHandler(void)
#else
void EXTI15_10_IRQHandler(void)
#endif
{
   switch(CountMode)
   {
      case 0:
         Counter.ValueA = 0x00;
         Counter.ValueB = 0x00;   
         Counter.ValueA++;
         TIM_SetCounter(TIM2,0);
         TIM_Cmd(TIM2, ENABLE);    
         CountMode = 0x01;
         break;
      case 1: /*First Start Byte*/     
         Counter.ValueA++;
         break;
      case 2:
         /*first part of Bit*/
         Counter.ValueA++;
         break;
      case 3:
         /*second part of Bit*/
         Counter.ValueB++;
         break;
      default:
         EXTI_DeInit();
         break;
   }
   
   EXTI_ClearITPendingBit(EXTI_Line10);
   EXTI_ClearFlag(EXTI_Line10);

}

/*******************************************************************************
* Function Name  : RTCAlarm_IRQHandler
* Description    : This function handles RTC Alarm interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(57) RTCAlarm_IRQHandler(void)
#else
void RTCAlarm_IRQHandler(void)
#endif
{
}

/*******************************************************************************
* Function Name  : USBWakeUp_IRQHandler
* Description    : This function handles USB WakeUp interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#ifdef TaskingVXtoolset
void __interrupt(58) USBWakeUp_IRQHandler(void)
#else
void USBWakeUp_IRQHandler(void)
#endif
{
}

/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -