stm32l1xx_it.c 8.5 KB

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