stm32f4xx_it.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /**
  2. ******************************************************************************
  3. * @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_it.c
  4. * @author MCD Application Team
  5. * @version V1.8.0
  6. * @date 04-November-2016
  7. * @brief Main Interrupt Service Routines.
  8. * This file provides template for all exceptions handler and
  9. * peripherals interrupt service routine.
  10. ******************************************************************************
  11. * @attention
  12. *
  13. * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
  14. *
  15. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  16. * You may not use this file except in compliance with the License.
  17. * You may obtain a copy of the License at:
  18. *
  19. * http://www.st.com/software_license_agreement_liberty_v2
  20. *
  21. * Unless required by applicable law or agreed to in writing, software
  22. * distributed under the License is distributed on an "AS IS" BASIS,
  23. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  24. * See the License for the specific language governing permissions and
  25. * limitations under the License.
  26. *
  27. ******************************************************************************
  28. */
  29. /* Includes ------------------------------------------------------------------*/
  30. #include "stm32f4xx_it.h"
  31. #include "main.h"
  32. /** @addtogroup Template_Project
  33. * @{
  34. */
  35. /* Private typedef -----------------------------------------------------------*/
  36. /* Private define ------------------------------------------------------------*/
  37. /* Private macro -------------------------------------------------------------*/
  38. /* Private variables ---------------------------------------------------------*/
  39. /* Private function prototypes -----------------------------------------------*/
  40. /* Private functions ---------------------------------------------------------*/
  41. /******************************************************************************/
  42. /* Cortex-M4 Processor Exceptions Handlers */
  43. /******************************************************************************/
  44. /**
  45. * @brief This function handles NMI exception.
  46. * @param None
  47. * @retval None
  48. */
  49. void NMI_Handler(void)
  50. {
  51. }
  52. /**
  53. * @brief This function handles Hard Fault exception.
  54. * @param None
  55. * @retval None
  56. */
  57. void HardFault_Handler(void)
  58. {
  59. /* Go to infinite loop when Hard Fault exception occurs */
  60. while (1)
  61. {
  62. }
  63. }
  64. /**
  65. * @brief This function handles Memory Manage exception.
  66. * @param None
  67. * @retval None
  68. */
  69. void MemManage_Handler(void)
  70. {
  71. /* Go to infinite loop when Memory Manage exception occurs */
  72. while (1)
  73. {
  74. }
  75. }
  76. /**
  77. * @brief This function handles Bus Fault exception.
  78. * @param None
  79. * @retval None
  80. */
  81. void BusFault_Handler(void)
  82. {
  83. /* Go to infinite loop when Bus Fault exception occurs */
  84. while (1)
  85. {
  86. }
  87. }
  88. /**
  89. * @brief This function handles Usage Fault exception.
  90. * @param None
  91. * @retval None
  92. */
  93. void UsageFault_Handler(void)
  94. {
  95. /* Go to infinite loop when Usage Fault exception occurs */
  96. while (1)
  97. {
  98. }
  99. }
  100. /**
  101. * @brief This function handles SVCall exception.
  102. * @param None
  103. * @retval None
  104. */
  105. void SVC_Handler(void)
  106. {
  107. }
  108. /**
  109. * @brief This function handles Debug Monitor exception.
  110. * @param None
  111. * @retval None
  112. */
  113. void DebugMon_Handler(void)
  114. {
  115. }
  116. /**
  117. * @brief This function handles PendSVC exception.
  118. * @param None
  119. * @retval None
  120. */
  121. void PendSV_Handler(void)
  122. {
  123. }
  124. /**
  125. * @brief This function handles SysTick Handler.
  126. * @param None
  127. * @retval None
  128. */
  129. // 调试变量,用于观察DMA传输次数
  130. volatile uint32_t adc3_dma_transfer_count = 0;
  131. void TIM1_UP_TIM10_IRQHandler(void)
  132. {
  133. TIM_ClearFlag(PWM_TIM, TIM_FLAG_Update);
  134. }
  135. /**
  136. * @brief DMA2 Stream1 中断处理函数(ADC3 DMA 传输完成)
  137. * @note 用于调试 ADC3 DMA 是否正常工作
  138. */
  139. void DMA2_Stream1_IRQHandler(void)
  140. {
  141. if(DMA_GetITStatus(DMA2_Stream1, DMA_IT_TCIF1))
  142. {
  143. adc3_dma_transfer_count++; // 传输完成计数
  144. DMA_ClearITPendingBit(DMA2_Stream1, DMA_IT_TCIF1);
  145. }
  146. }
  147. void OTG_FS_IRQHandler(void)
  148. {
  149. }
  150. /******************************************************************************/
  151. /* STM32F4xx Peripherals Interrupt Handlers */
  152. /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
  153. /* available peripheral interrupt handler's name please refer to the startup */
  154. /* file (startup_stm32f4xx.s). */
  155. /******************************************************************************/
  156. /**
  157. * @brief This function handles PPP interrupt request.
  158. * @param None
  159. * @retval None
  160. */
  161. /*void PPP_IRQHandler(void)
  162. {
  163. }*/
  164. /**
  165. * @}
  166. */
  167. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/