stm32f10x_it.c 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. /**
  2. ******************************************************************************
  3. * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_it.c
  4. * @author MCD Application Team
  5. * @version V3.4.0
  6. * @date 10/15/2010
  7. * @brief Main Interrupt Service Routines.
  8. * This file provides template for all exceptions handler and
  9. * peripherals interrupt service routine.
  10. ******************************************************************************
  11. * @copy
  12. *
  13. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  14. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  15. * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  16. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  17. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  18. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  19. *
  20. * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
  21. */
  22. /* Includes ------------------------------------------------------------------*/
  23. #include <includes.h>
  24. /* Private typedef -----------------------------------------------------------*/
  25. /* Private define ------------------------------------------------------------*/
  26. /* Private macro -------------------------------------------------------------*/
  27. /* Private variables ---------------------------------------------------------*/
  28. /* Private function prototypes -----------------------------------------------*/
  29. /* Private functions ---------------------------------------------------------*/
  30. /******************************************************************************/
  31. /* Cortex-M3 Processor Exceptions Handlers */
  32. /******************************************************************************/
  33. /**
  34. * @brief This function handles NMI exception.
  35. * @param None
  36. * @retval None
  37. */
  38. void NMI_Handler(void)
  39. {
  40. }
  41. /**
  42. * @brief This function handles Hard Fault exception.
  43. * @param None
  44. * @retval None
  45. */
  46. void HardFault_Handler(void)
  47. {
  48. /* Go to infinite loop when Hard Fault exception occurs */
  49. #ifdef USE_RUNNING_MAKE
  50. printf("\r\n[HFH]F=%d,L=%d",g_usFileID,g_ulFileLine);
  51. #endif
  52. while (1)
  53. {
  54. }
  55. }
  56. /**
  57. * @brief This function handles Memory Manage exception.
  58. * @param None
  59. * @retval None
  60. */
  61. void MemManage_Handler(void)
  62. {
  63. /* Go to infinite loop when Memory Manage exception occurs */
  64. #ifdef USE_RUNNING_MAKE
  65. printf("\r\n[MMH]F=%d,L=%d",g_usFileID,g_ulFileLine);
  66. #endif
  67. while (1)
  68. {
  69. }
  70. }
  71. /**
  72. * @brief This function handles Bus Fault exception.
  73. * @param None
  74. * @retval None
  75. */
  76. void BusFault_Handler(void)
  77. {
  78. /* Go to infinite loop when Bus Fault exception occurs */
  79. #ifdef USE_RUNNING_MAKE
  80. printf("\r\n[BFH]F=%d,L=%d",g_usFileID,g_ulFileLine);
  81. #endif
  82. while (1)
  83. {
  84. }
  85. }
  86. /**
  87. * @brief This function handles Usage Fault exception.
  88. * @param None
  89. * @retval None
  90. */
  91. void UsageFault_Handler(void)
  92. {
  93. /* Go to infinite loop when Usage Fault exception occurs */
  94. #ifdef USE_RUNNING_MAKE
  95. printf("\r\n[UFH]F=%d,L=%d",g_usFileID,g_ulFileLine);
  96. #endif
  97. while (1)
  98. {
  99. }
  100. }
  101. /**
  102. * @brief This function handles SVCall exception.
  103. * @param None
  104. * @retval None
  105. */
  106. //void SVC_Handler(void)
  107. //{
  108. //}
  109. /**
  110. * @brief This function handles Debug Monitor exception.
  111. * @param None
  112. * @retval None
  113. */
  114. void DebugMon_Handler(void)
  115. {
  116. }
  117. /**
  118. * @brief This function handles SysTick Handler.
  119. * @param None
  120. * @retval None
  121. */
  122. //static int siSecCt=0;
  123. //void SysTick_Handler(void)
  124. //{
  125. // //sutSysMsg.Tick10ms=1;
  126. // if(++siSecCt>=50){
  127. // siSecCt=0;
  128. // //sutSysMsg.Tick500ms=1;
  129. // }
  130. //
  131. //}
  132. /*******************************************************************************
  133. * Function Name : USART1_IRQHandler
  134. * Description : This function handles USART1 global interrupt request.
  135. * Input : None
  136. * Output : None
  137. * Return : None
  138. *******************************************************************************/
  139. void USART1_IRQHandler(void)
  140. {
  141. UART1RxTxISRHandler();
  142. }
  143. /*******************************************************************************
  144. * Function Name : USART2_IRQHandler
  145. * Description : This function handles USART1 global interrupt request.
  146. * Input : None
  147. * Output : None
  148. * Return : None
  149. *******************************************************************************/
  150. void USART2_IRQHandler(void)
  151. {
  152. UART2RxTxISRHandler(); /* Call uC/OS-II's OSTimeTick() */
  153. }
  154. /*******************************************************************************
  155. * Function Name : USART3_IRQHandler
  156. * Description : This function handles USART1 global interrupt request.
  157. * Input : None
  158. * Output : None
  159. * Return : None
  160. *******************************************************************************/
  161. void USART3_IRQHandler(void)
  162. {
  163. UART3RxTxISRHandler();
  164. }
  165. void DMA1_Channel7_IRQHandler(void)
  166. {
  167. USART2_SendOK_IQ();
  168. }
  169. void DMA1_Channel4_IRQHandler(void)
  170. {
  171. USART1_SendOK_IQ();
  172. }
  173. /******************************************************************************/
  174. /* STM32F10x Peripherals Interrupt Handlers */
  175. /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
  176. /* available peripheral interrupt handler's name please refer to the startup */
  177. /* file (startup_stm32f10x_xx.s). */
  178. /******************************************************************************/
  179. /**
  180. * @brief This function handles PPP interrupt request.
  181. * @param None
  182. * @retval None
  183. */
  184. /*void PPP_IRQHandler(void)
  185. {
  186. }*/
  187. /**
  188. * @}
  189. */
  190. /*******************************************************************************
  191. * Function Name : RTC_IRQHandler
  192. * Description : This function handles RTC global interrupt request.
  193. * Input : None
  194. * Output : None
  195. * Return : None
  196. *******************************************************************************/
  197. //void RTC_IRQHandler(void)
  198. //{
  199. // if (RTC_GetITStatus(RTC_IT_SEC) != RESET)
  200. // {
  201. // RTC_ClearITPendingBit(RTC_IT_SEC); //判断中断标志位是否被置位
  202. // RTC_WaitForLastTask(); //等待上一次配置完成
  203. // //如果加了下面,当关掉主机电源后,计数跑到24:00:00时会被清0,且会停止计数(没掉电是没问题的)
  204. //// if (RTC_GetCounter() > 86398) //走到23:59:59秒时清零, 86400=24*60*60
  205. //// {
  206. //// RTC_SetCounter(0x0);
  207. //// RTC_WaitForLastTask(); //等待上一次配置完成
  208. //// }
  209. // }
  210. //}
  211. void RTCAlarm_IRQHandler(void)
  212. {
  213. if (RTC_GetITStatus(RTC_IT_SEC) != RESET){
  214. RTC_ClearITPendingBit(RTC_IT_SEC);
  215. }
  216. if(RTC_GetITStatus(RTC_IT_ALR) != RESET)
  217. {
  218. SlwTrace(INF,"time coming\r\n",1);
  219. /* Set the RTC alarm flag */
  220. g_bRTCAlarm = 1;
  221. /* Clear EXTI line17 pending bit */
  222. EXTI_ClearITPendingBit(EXTI_Line17);
  223. /* Check if the Wake-Up flag is set */
  224. if(PWR_GetFlagStatus(PWR_FLAG_WU) != RESET)
  225. {
  226. /* Clear Wake Up flag */
  227. PWR_ClearFlag(PWR_FLAG_WU);
  228. }
  229. /* Wait until last write operation on RTC registers has finished */
  230. RTC_WaitForLastTask();
  231. /* Clear RTC Alarm interrupt pending bit */
  232. RTC_ClearITPendingBit(RTC_IT_ALR);
  233. /* Wait until last write operation on RTC registers has finished */
  234. RTC_WaitForLastTask();
  235. }
  236. }
  237. void PVD_IRQHandler(void)
  238. {
  239. if(EXTI_GetITStatus(EXTI_Line16)!=RESET)
  240. {
  241. printf("电量低..........\r\n");
  242. //LED1(ON);
  243. Sleeping();
  244. }
  245. EXTI_ClearITPendingBit(EXTI_Line16); //?????????
  246. }
  247. /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/