stm32l1xx_it.c 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file stm32l1xx_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 "stm32l1xx_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_FS;
  46. extern DMA_HandleTypeDef hdma_adc;
  47. extern COMP_HandleTypeDef hcomp2;
  48. extern DMA_HandleTypeDef hdma_tim3_ch4_up;
  49. extern TIM_HandleTypeDef htim4;
  50. extern TIM_HandleTypeDef htim6;
  51. extern DMA_HandleTypeDef hdma_usart1_rx;
  52. extern DMA_HandleTypeDef hdma_usart1_tx;
  53. extern UART_HandleTypeDef huart1;
  54. /* USER CODE BEGIN EV */
  55. /* USER CODE END EV */
  56. /******************************************************************************/
  57. /* Cortex-M3 Processor Interruption and Exception Handlers */
  58. /******************************************************************************/
  59. /**
  60. * @brief This function handles Non maskable interrupt.
  61. */
  62. void NMI_Handler(void)
  63. {
  64. /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
  65. /* USER CODE END NonMaskableInt_IRQn 0 */
  66. /* USER CODE BEGIN NonMaskableInt_IRQn 1 */
  67. while (1)
  68. {
  69. }
  70. /* USER CODE END NonMaskableInt_IRQn 1 */
  71. }
  72. /**
  73. * @brief This function handles Hard fault interrupt.
  74. */
  75. void HardFault_Handler(void)
  76. {
  77. /* USER CODE BEGIN HardFault_IRQn 0 */
  78. /* USER CODE END HardFault_IRQn 0 */
  79. while (1)
  80. {
  81. /* USER CODE BEGIN W1_HardFault_IRQn 0 */
  82. /* USER CODE END W1_HardFault_IRQn 0 */
  83. }
  84. }
  85. /**
  86. * @brief This function handles Memory management fault.
  87. */
  88. void MemManage_Handler(void)
  89. {
  90. /* USER CODE BEGIN MemoryManagement_IRQn 0 */
  91. /* USER CODE END MemoryManagement_IRQn 0 */
  92. while (1)
  93. {
  94. /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
  95. /* USER CODE END W1_MemoryManagement_IRQn 0 */
  96. }
  97. }
  98. /**
  99. * @brief This function handles Pre-fetch fault, memory access fault.
  100. */
  101. void BusFault_Handler(void)
  102. {
  103. /* USER CODE BEGIN BusFault_IRQn 0 */
  104. /* USER CODE END BusFault_IRQn 0 */
  105. while (1)
  106. {
  107. /* USER CODE BEGIN W1_BusFault_IRQn 0 */
  108. /* USER CODE END W1_BusFault_IRQn 0 */
  109. }
  110. }
  111. /**
  112. * @brief This function handles Undefined instruction or illegal state.
  113. */
  114. void UsageFault_Handler(void)
  115. {
  116. /* USER CODE BEGIN UsageFault_IRQn 0 */
  117. /* USER CODE END UsageFault_IRQn 0 */
  118. while (1)
  119. {
  120. /* USER CODE BEGIN W1_UsageFault_IRQn 0 */
  121. /* USER CODE END W1_UsageFault_IRQn 0 */
  122. }
  123. }
  124. /**
  125. * @brief This function handles System service call via SWI instruction.
  126. */
  127. void SVC_Handler(void)
  128. {
  129. /* USER CODE BEGIN SVC_IRQn 0 */
  130. /* USER CODE END SVC_IRQn 0 */
  131. /* USER CODE BEGIN SVC_IRQn 1 */
  132. /* USER CODE END SVC_IRQn 1 */
  133. }
  134. /**
  135. * @brief This function handles Debug monitor.
  136. */
  137. void DebugMon_Handler(void)
  138. {
  139. /* USER CODE BEGIN DebugMonitor_IRQn 0 */
  140. /* USER CODE END DebugMonitor_IRQn 0 */
  141. /* USER CODE BEGIN DebugMonitor_IRQn 1 */
  142. /* USER CODE END DebugMonitor_IRQn 1 */
  143. }
  144. /**
  145. * @brief This function handles Pendable request for system service.
  146. */
  147. void PendSV_Handler(void)
  148. {
  149. /* USER CODE BEGIN PendSV_IRQn 0 */
  150. /* USER CODE END PendSV_IRQn 0 */
  151. /* USER CODE BEGIN PendSV_IRQn 1 */
  152. /* USER CODE END PendSV_IRQn 1 */
  153. }
  154. /**
  155. * @brief This function handles System tick timer.
  156. */
  157. void SysTick_Handler(void)
  158. {
  159. /* USER CODE BEGIN SysTick_IRQn 0 */
  160. /* USER CODE END SysTick_IRQn 0 */
  161. HAL_IncTick();
  162. /* USER CODE BEGIN SysTick_IRQn 1 */
  163. /* USER CODE END SysTick_IRQn 1 */
  164. }
  165. /******************************************************************************/
  166. /* STM32L1xx Peripheral Interrupt Handlers */
  167. /* Add here the Interrupt Handlers for the used peripherals. */
  168. /* For the available peripheral interrupt handler names, */
  169. /* please refer to the startup file (startup_stm32l1xx.s). */
  170. /******************************************************************************/
  171. /**
  172. * @brief This function handles DMA1 channel1 global interrupt.
  173. */
  174. void DMA1_Channel1_IRQHandler(void)
  175. {
  176. /* USER CODE BEGIN DMA1_Channel1_IRQn 0 */
  177. /* USER CODE END DMA1_Channel1_IRQn 0 */
  178. HAL_DMA_IRQHandler(&hdma_adc);
  179. /* USER CODE BEGIN DMA1_Channel1_IRQn 1 */
  180. /* USER CODE END DMA1_Channel1_IRQn 1 */
  181. }
  182. /**
  183. * @brief This function handles DMA1 channel3 global interrupt.
  184. */
  185. void DMA1_Channel3_IRQHandler(void)
  186. {
  187. /* USER CODE BEGIN DMA1_Channel3_IRQn 0 */
  188. /* USER CODE END DMA1_Channel3_IRQn 0 */
  189. HAL_DMA_IRQHandler(&hdma_tim3_ch4_up);
  190. /* USER CODE BEGIN DMA1_Channel3_IRQn 1 */
  191. /* USER CODE END DMA1_Channel3_IRQn 1 */
  192. }
  193. /**
  194. * @brief This function handles DMA1 channel4 global interrupt.
  195. */
  196. void DMA1_Channel4_IRQHandler(void)
  197. {
  198. /* USER CODE BEGIN DMA1_Channel4_IRQn 0 */
  199. /* USER CODE END DMA1_Channel4_IRQn 0 */
  200. HAL_DMA_IRQHandler(&hdma_usart1_tx);
  201. /* USER CODE BEGIN DMA1_Channel4_IRQn 1 */
  202. /* USER CODE END DMA1_Channel4_IRQn 1 */
  203. }
  204. /**
  205. * @brief This function handles DMA1 channel5 global interrupt.
  206. */
  207. void DMA1_Channel5_IRQHandler(void)
  208. {
  209. /* USER CODE BEGIN DMA1_Channel5_IRQn 0 */
  210. /* USER CODE END DMA1_Channel5_IRQn 0 */
  211. HAL_DMA_IRQHandler(&hdma_usart1_rx);
  212. /* USER CODE BEGIN DMA1_Channel5_IRQn 1 */
  213. /* USER CODE END DMA1_Channel5_IRQn 1 */
  214. }
  215. /**
  216. * @brief This function handles USB low priority interrupt.
  217. */
  218. void USB_LP_IRQHandler(void)
  219. {
  220. /* USER CODE BEGIN USB_LP_IRQn 0 */
  221. /* USER CODE END USB_LP_IRQn 0 */
  222. HAL_PCD_IRQHandler(&hpcd_USB_FS);
  223. /* USER CODE BEGIN USB_LP_IRQn 1 */
  224. /* USER CODE END USB_LP_IRQn 1 */
  225. }
  226. /**
  227. * @brief This function handles COMP1 and COMP2 wake-up interrupts through EXTI lines 21 and 22.
  228. */
  229. void COMP_IRQHandler(void)
  230. {
  231. /* USER CODE BEGIN COMP_IRQn 0 */
  232. /* USER CODE END COMP_IRQn 0 */
  233. HAL_COMP_IRQHandler(&hcomp2);
  234. /* USER CODE BEGIN COMP_IRQn 1 */
  235. /* USER CODE END COMP_IRQn 1 */
  236. }
  237. /**
  238. * @brief This function handles TIM4 global interrupt.
  239. */
  240. void TIM4_IRQHandler(void)
  241. {
  242. /* USER CODE BEGIN TIM4_IRQn 0 */
  243. /* USER CODE END TIM4_IRQn 0 */
  244. HAL_TIM_IRQHandler(&htim4);
  245. /* USER CODE BEGIN TIM4_IRQn 1 */
  246. /* USER CODE END TIM4_IRQn 1 */
  247. }
  248. /**
  249. * @brief This function handles USART1 global interrupt.
  250. */
  251. void USART1_IRQHandler(void)
  252. {
  253. /* USER CODE BEGIN USART1_IRQn 0 */
  254. /* USER CODE END USART1_IRQn 0 */
  255. HAL_UART_IRQHandler(&huart1);
  256. /* USER CODE BEGIN USART1_IRQn 1 */
  257. /* USER CODE END USART1_IRQn 1 */
  258. }
  259. /**
  260. * @brief This function handles EXTI line[15:10] interrupts.
  261. */
  262. void EXTI15_10_IRQHandler(void)
  263. {
  264. /* USER CODE BEGIN EXTI15_10_IRQn 0 */
  265. /* USER CODE END EXTI15_10_IRQn 0 */
  266. HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_14);
  267. HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_15);
  268. /* USER CODE BEGIN EXTI15_10_IRQn 1 */
  269. /* USER CODE END EXTI15_10_IRQn 1 */
  270. }
  271. /**
  272. * @brief This function handles TIM6 global interrupt.
  273. */
  274. void TIM6_IRQHandler(void)
  275. {
  276. /* USER CODE BEGIN TIM6_IRQn 0 */
  277. /* USER CODE END TIM6_IRQn 0 */
  278. HAL_TIM_IRQHandler(&htim6);
  279. /* USER CODE BEGIN TIM6_IRQn 1 */
  280. /* USER CODE END TIM6_IRQn 1 */
  281. }
  282. /* USER CODE BEGIN 1 */
  283. /* USER CODE END 1 */