/** ****************************************************************************** * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_it.c * @author MCD Application Team * @version V3.4.0 * @date 10/15/2010 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and * peripherals interrupt service routine. ****************************************************************************** * @copy * * 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 2010 STMicroelectronics

*/ /* Includes ------------------------------------------------------------------*/ #include #include /* 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 */ #ifdef USE_RUNNING_MAKE if(startFlashPro) printf("FlashCheck Failed\r\n"); printf("\r\n[HFH]F=%d,L=%d\r\n",g_usFileID,g_ulFileLine); #endif 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 */ #ifdef USE_RUNNING_MAKE printf("\r\n[MMH]F=%d,L=%d",g_usFileID,g_ulFileLine); #endif 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 */ #ifdef USE_RUNNING_MAKE printf("\r\n[BFH]F=%d,L=%d",g_usFileID,g_ulFileLine); #endif 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 */ #ifdef USE_RUNNING_MAKE printf("\r\n[UFH]F=%d,L=%d",g_usFileID,g_ulFileLine); #endif 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 SysTick Handler. * @param None * @retval None */ //static int siSecCt=0; //void SysTick_Handler(void) //{ // //sutSysMsg.Tick10ms=1; // if(++siSecCt>=50){ // siSecCt=0; // //sutSysMsg.Tick500ms=1; // } // //} /******************************************************************************* * Function Name : USART1_IRQHandler * Description : This function handles USART1 global interrupt request. * Input : None * Output : None * Return : None *******************************************************************************/ void USART1_IRQHandler(void) { UART1RxTxISRHandler(); } /******************************************************************************* * Function Name : USART3_IRQHandler * Description : This function handles USART1 global interrupt request. * Input : None * Output : None * Return : None *******************************************************************************/ void USART2_IRQHandler(void) { UART2RxTxISRHandler(); } void USART3_IRQHandler(void) { UART3RxTxISRHandler(); } ///////////////////////////////// void EXIT1_2UserHandle(void) { char update; static char status=3,lastStatus;//初始值为3使得第一次无论怎么旋都正确,如果是0的话就反了 update=0; if(EXTI_GetITStatus(EXTI_Line1)) { update=1; EXTI_ClearITPendingBit(EXTI_Line1); } if(EXTI_GetITStatus(EXTI_Line2)) { update=2; EXTI_ClearITPendingBit(EXTI_Line2); } if(0!=update) { if(KEY_ENCODE1_PORT->IDR & KEY_ENCODE1_PIN) status |=1; else status &= ~(1); if(KEY_ENCODE2_PORT->IDR & KEY_ENCODE2_PIN) status |=2; else status &= ~(2); } switch(status&0x03) { case 1: if(lastStatus == 3) g_iEncode=1; else if(lastStatus ==0) g_iEncode=-1; break; case 2: if(lastStatus == 0) g_iEncode=1; else if(lastStatus == 3) g_iEncode=-1; break; } lastStatus=status; } void EXTI1_IRQHandler(void) { EXIT1_2UserHandle(); } void EXTI2_IRQHandler(void) { EXIT1_2UserHandle(); } /******************************************************************************/ /* 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 2010 STMicroelectronics *****END OF FILE****/