stm32f4xx_it.c 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file stm32f4xx_it.c
  5. * @brief Interrupt Service Routines.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* USER CODE END Header */
  20. /* Includes ------------------------------------------------------------------*/
  21. #include "main.h"
  22. #include "stm32f4xx_it.h"
  23. /* Private includes ----------------------------------------------------------*/
  24. /* USER CODE BEGIN Includes */
  25. /* USER CODE END Includes */
  26. /* Private typedef -----------------------------------------------------------*/
  27. /* USER CODE BEGIN TD */
  28. /* USER CODE END TD */
  29. /* Private define ------------------------------------------------------------*/
  30. /* USER CODE BEGIN PD */
  31. /* USER CODE END PD */
  32. /* Private macro -------------------------------------------------------------*/
  33. /* USER CODE BEGIN PM */
  34. /* USER CODE END PM */
  35. /* Private variables ---------------------------------------------------------*/
  36. /* USER CODE BEGIN PV */
  37. /* USER CODE END PV */
  38. /* Private function prototypes -----------------------------------------------*/
  39. /* USER CODE BEGIN PFP */
  40. /* USER CODE END PFP */
  41. /* Private user code ---------------------------------------------------------*/
  42. /* USER CODE BEGIN 0 */
  43. /* USER CODE END 0 */
  44. /* External variables --------------------------------------------------------*/
  45. extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
  46. extern DMA_HandleTypeDef hdma_adc1;
  47. extern ADC_HandleTypeDef hadc1;
  48. extern ADC_HandleTypeDef hadc2;
  49. extern DAC_HandleTypeDef hdac;
  50. extern TIM_HandleTypeDef htim3;
  51. extern TIM_HandleTypeDef htim4;
  52. /* USER CODE BEGIN EV */
  53. /* USER CODE END EV */
  54. /******************************************************************************/
  55. /* Cortex-M4 Processor Interruption and Exception Handlers */
  56. /******************************************************************************/
  57. /**
  58. * @brief This function handles Hard fault interrupt.
  59. */
  60. void HardFault_Handler(void)
  61. {
  62. /* USER CODE BEGIN HardFault_IRQn 0 */
  63. /* USER CODE END HardFault_IRQn 0 */
  64. while (1)
  65. {
  66. /* USER CODE BEGIN W1_HardFault_IRQn 0 */
  67. /* USER CODE END W1_HardFault_IRQn 0 */
  68. }
  69. }
  70. /**
  71. * @brief This function handles Memory management fault.
  72. */
  73. void MemManage_Handler(void)
  74. {
  75. /* USER CODE BEGIN MemoryManagement_IRQn 0 */
  76. /* USER CODE END MemoryManagement_IRQn 0 */
  77. while (1)
  78. {
  79. /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
  80. /* USER CODE END W1_MemoryManagement_IRQn 0 */
  81. }
  82. }
  83. /**
  84. * @brief This function handles Pre-fetch fault, memory access fault.
  85. */
  86. void BusFault_Handler(void)
  87. {
  88. /* USER CODE BEGIN BusFault_IRQn 0 */
  89. /* USER CODE END BusFault_IRQn 0 */
  90. while (1)
  91. {
  92. /* USER CODE BEGIN W1_BusFault_IRQn 0 */
  93. /* USER CODE END W1_BusFault_IRQn 0 */
  94. }
  95. }
  96. /**
  97. * @brief This function handles Undefined instruction or illegal state.
  98. */
  99. void UsageFault_Handler(void)
  100. {
  101. /* USER CODE BEGIN UsageFault_IRQn 0 */
  102. /* USER CODE END UsageFault_IRQn 0 */
  103. while (1)
  104. {
  105. /* USER CODE BEGIN W1_UsageFault_IRQn 0 */
  106. /* USER CODE END W1_UsageFault_IRQn 0 */
  107. }
  108. }
  109. /**
  110. * @brief This function handles System service call via SWI instruction.
  111. */
  112. void SVC_Handler(void)
  113. {
  114. /* USER CODE BEGIN SVCall_IRQn 0 */
  115. /* USER CODE END SVCall_IRQn 0 */
  116. /* USER CODE BEGIN SVCall_IRQn 1 */
  117. /* USER CODE END SVCall_IRQn 1 */
  118. }
  119. /**
  120. * @brief This function handles Debug monitor.
  121. */
  122. void DebugMon_Handler(void)
  123. {
  124. /* USER CODE BEGIN DebugMonitor_IRQn 0 */
  125. /* USER CODE END DebugMonitor_IRQn 0 */
  126. /* USER CODE BEGIN DebugMonitor_IRQn 1 */
  127. /* USER CODE END DebugMonitor_IRQn 1 */
  128. }
  129. /**
  130. * @brief This function handles Pendable request for system service.
  131. */
  132. void PendSV_Handler(void)
  133. {
  134. /* USER CODE BEGIN PendSV_IRQn 0 */
  135. /* USER CODE END PendSV_IRQn 0 */
  136. /* USER CODE BEGIN PendSV_IRQn 1 */
  137. /* USER CODE END PendSV_IRQn 1 */
  138. }
  139. /**
  140. * @brief This function handles System tick timer.
  141. */
  142. void SysTick_Handler(void)
  143. {
  144. /* USER CODE BEGIN SysTick_IRQn 0 */
  145. /* USER CODE END SysTick_IRQn 0 */
  146. HAL_IncTick();
  147. /* USER CODE BEGIN SysTick_IRQn 1 */
  148. /* USER CODE END SysTick_IRQn 1 */
  149. }
  150. /******************************************************************************/
  151. /* STM32F4xx Peripheral Interrupt Handlers */
  152. /* Add here the Interrupt Handlers for the used peripherals. */
  153. /* For the available peripheral interrupt handler names, */
  154. /* please refer to the startup file (startup_stm32f4xx.s). */
  155. /******************************************************************************/
  156. /**
  157. * @brief This function handles EXTI line 1 interrupt.
  158. */
  159. void EXTI1_IRQHandler(void)
  160. {
  161. /* USER CODE BEGIN EXTI1_IRQn 0 */
  162. /* USER CODE END EXTI1_IRQn 0 */
  163. HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1);
  164. /* USER CODE BEGIN EXTI1_IRQn 1 */
  165. /* USER CODE END EXTI1_IRQn 1 */
  166. }
  167. /**
  168. * @brief This function handles ADC1, ADC2 and ADC3 interrupts.
  169. */
  170. void ADC_IRQHandler(void)
  171. {
  172. /* USER CODE BEGIN ADC_IRQn 0 */
  173. /* USER CODE END ADC_IRQn 0 */
  174. HAL_ADC_IRQHandler(&hadc1);
  175. HAL_ADC_IRQHandler(&hadc2);
  176. /* USER CODE BEGIN ADC_IRQn 1 */
  177. /* USER CODE END ADC_IRQn 1 */
  178. }
  179. /**
  180. * @brief This function handles TIM3 global interrupt.
  181. */
  182. void TIM3_IRQHandler(void)
  183. {
  184. /* USER CODE BEGIN TIM3_IRQn 0 */
  185. /* USER CODE END TIM3_IRQn 0 */
  186. HAL_TIM_IRQHandler(&htim3);
  187. /* USER CODE BEGIN TIM3_IRQn 1 */
  188. /* USER CODE END TIM3_IRQn 1 */
  189. }
  190. /**
  191. * @brief This function handles TIM4 global interrupt.
  192. */
  193. void TIM4_IRQHandler(void)
  194. {
  195. /* USER CODE BEGIN TIM4_IRQn 0 */
  196. /* USER CODE END TIM4_IRQn 0 */
  197. HAL_TIM_IRQHandler(&htim4);
  198. /* USER CODE BEGIN TIM4_IRQn 1 */
  199. /* USER CODE END TIM4_IRQn 1 */
  200. }
  201. /**
  202. * @brief This function handles TIM6 global interrupt and DAC1, DAC2 underrun error interrupts.
  203. */
  204. void TIM6_DAC_IRQHandler(void)
  205. {
  206. /* USER CODE BEGIN TIM6_DAC_IRQn 0 */
  207. /* USER CODE END TIM6_DAC_IRQn 0 */
  208. HAL_DAC_IRQHandler(&hdac);
  209. /* USER CODE BEGIN TIM6_DAC_IRQn 1 */
  210. /* USER CODE END TIM6_DAC_IRQn 1 */
  211. }
  212. /**
  213. * @brief This function handles DMA2 stream0 global interrupt.
  214. */
  215. void DMA2_Stream0_IRQHandler(void)
  216. {
  217. /* USER CODE BEGIN DMA2_Stream0_IRQn 0 */
  218. /* USER CODE END DMA2_Stream0_IRQn 0 */
  219. HAL_DMA_IRQHandler(&hdma_adc1);
  220. /* USER CODE BEGIN DMA2_Stream0_IRQn 1 */
  221. /* USER CODE END DMA2_Stream0_IRQn 1 */
  222. }
  223. /**
  224. * @brief This function handles USB On The Go FS global interrupt.
  225. */
  226. void OTG_FS_IRQHandler(void)
  227. {
  228. /* USER CODE BEGIN OTG_FS_IRQn 0 */
  229. /* USER CODE END OTG_FS_IRQn 0 */
  230. HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
  231. /* USER CODE BEGIN OTG_FS_IRQn 1 */
  232. /* USER CODE END OTG_FS_IRQn 1 */
  233. }
  234. /* USER CODE BEGIN 1 */
  235. /* USER CODE END 1 */
  236. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/