/** ****************************************************************************** * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_it.c * @author MCD Application Team * @version V3.5.0 * @date 08-April-2011 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and * peripherals interrupt service routine. ****************************************************************************** * @attention * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * *

© COPYRIGHT 2011 STMicroelectronics

****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "YX5200/YX5200_main.h" #include "YX5200/YX5200_uart.h" #include "wifi9113.h" /** @addtogroup STM32F10x_StdPeriph_Template * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************/ /* Cortex-M3 Processor Exceptions Handlers */ /******************************************************************************/ /** * @brief This function handles NMI exception. * @param None * @retval None */ void NMI_Handler ( void ) { } /** * @brief This function handles Hard Fault exception. * @param None * @retval None */ void HardFault_Handler ( void ) { /* Go to infinite loop when Hard Fault exception occurs */ while ( 1 ) { } } /** * @brief This function handles Memory Manage exception. * @param None * @retval None */ void MemManage_Handler ( void ) { /* Go to infinite loop when Memory Manage exception occurs */ while ( 1 ) { } } /** * @brief This function handles Bus Fault exception. * @param None * @retval None */ void BusFault_Handler ( void ) { /* Go to infinite loop when Bus Fault exception occurs */ while ( 1 ) { } } /** * @brief This function handles Usage Fault exception. * @param None * @retval None */ void UsageFault_Handler ( void ) { /* Go to infinite loop when Usage Fault exception occurs */ while ( 1 ) { } } /** * @brief This function handles SVCall exception. * @param None * @retval None */ void SVC_Handler ( void ) { } /** * @brief This function handles Debug Monitor exception. * @param None * @retval None */ void DebugMon_Handler ( void ) { } /** * @brief This function handles PendSVC exception. * @param None * @retval None */ void PendSV_Handler ( void ) { } /** * @brief This function handles SysTick Handler. * @param None * @retval None */ bool if_wifi_msg_come = false; u32 sys_ms = 0; u32 sys_rtc_time = 0; int TaskTime = 0; void SysTick_Handler ( void ) { sys_ms++; if ( 0 == ( sys_ms % 1000 ) ) { sys_rtc_time++; } TaskTime++; if ( TaskTime % 2 == 0 ) System_Flag_2Ms = 1; if ( TaskTime % 10 == 0 ) System_Flag_10Ms = 1; if ( TaskTime % 100 == 0 ) System_Flag_100Ms = 1; if ( TaskTime % 200 == 0 ) System_Flag_200Ms = 1; if ( TaskTime % 500 == 0 ) System_Flag_500Ms = 1; if ( TaskTime % 1000 == 0 ) System_Flag_1s = 1; if ( TaskTime % 8000 == 0 ) System_Flag_8s = 1; if ( TaskTime % 20000 == 0 ) System_Flag_20s = 1; WifiTimeReset++; WifiTimeLed++; if ( UartRecvACKFlag ) { if ( UartRecvACK ) UartRecvACK--; } } /******************************************************************************/ /* STM32F10x Peripherals Interrupt Handlers */ /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ /* available peripheral interrupt handler's name please refer to the startup */ /* file (startup_stm32f10x_xx.s). */ /******************************************************************************/ /** * @brief This function handles PPP interrupt request. * @param None * @retval None */ /*void PPP_IRQHandler(void) { }*/ /** * @} */ /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ void USART1_IRQHandler ( void ) { if ( USART_GetITStatus ( Wifi_UART, USART_IT_RXNE ) != RESET ) { /* Read one byte from the receive data register */ bAtRecBuff[start] = USART_ReceiveData ( Wifi_UART ); if ( start >= 2 ) //当前是\n,上个如果是\r { if ( ( bAtRecBuff[start - 1] == 0x0D ) && ( bAtRecBuff[start] == 0x0A ) ) //start字符个数 { WifiHaveRecFlag = true; if_wifi_msg_come = true; } } start++; // while(USART_GetFlagStatus(USART1, USART_FLAG_RXNE) ==0); USART_ClearITPendingBit ( Wifi_UART, USART_IT_RXNE ); } if ( USART_GetITStatus ( Wifi_UART, USART_IT_TXE ) != RESET ) { /* Write one byte to the transmit data register */ USART_SendData ( Wifi_UART, bAtSentBuff[TxCounterWifi++] ); if ( TxCounterWifi >= WifiDataToXmt ) { /* Disable the USARTy Transmit interrupt */ USART_ITConfig ( Wifi_UART, USART_IT_TXE, DISABLE ); //USART_ITConfig(Wifi_UART, USART_IT_RXNE, ENABLE); //发送完,开接收中断 } } } void USART2_IRQHandler ( void ) { if ( USART_GetITStatus ( YX5200_UART, USART_IT_RXNE ) != RESET ) { RxBufferUart2[RxCounterUart2] = USART_ReceiveData ( YX5200_UART ); if ( RxCounterUart2 >= YX5200_MSGLEN ) //当前是\n,上个如果是\r { if ( ( RxBufferUart2[RxCounterUart2 - ( YX5200_MSGLEN - 1 )] == 0x7E ) && \ ( RxBufferUart2[RxCounterUart2] == 0xEF ) ) { YX5200HaveRecFlag = true; memcpy ( Recv_buf, & ( RxBufferUart2[RxCounterUart2 - ( YX5200_MSGLEN - 1 )] ), YX5200_MSGLEN ); } } RxCounterUart2++; USART_ClearITPendingBit ( YX5200_UART, USART_IT_RXNE ); } if ( USART_GetITStatus ( YX5200_UART, USART_IT_TXE ) != RESET ) { USART_SendData ( YX5200_UART, TxBufferUart2[TxCounterUart2++] ); if ( TxCounterUart2 >= Uart2SendCount ) { USART_ITConfig ( YX5200_UART, USART_IT_TXE, DISABLE ); } } } //SPI1使用DMA收数据中断服务程序 //SPI1使用DMA发数据中断服务程序 //SPI2使用DMA收数据中断服务程序 //SPI2使用DMA发数据中断服务程序 u32 T1_Val = 0; void TIM2_IRQHandler(void) { if(TIM_GetITStatus(TIM2,TIM_IT_Update)!=RESET)//检查溢出信号 { TIM_ClearITPendingBit(TIM2,TIM_IT_Update);//清除溢出标志 //Time2us++; T1_Val++; } } /** * @brief This function handles SPI3 global interrupt request. * @param None * @retval None */ /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/