1 | /* USER CODE BEGIN Header */
|
---|
2 | /**
|
---|
3 | ******************************************************************************
|
---|
4 | * @file stm32f4xx_it.c
|
---|
5 | * @brief Interrupt Service Routines.
|
---|
6 | ******************************************************************************
|
---|
7 | * @attention
|
---|
8 | *
|
---|
9 | * <h2><center>© Copyright (c) 2021 STMicroelectronics.
|
---|
10 | * All rights reserved.</center></h2>
|
---|
11 | *
|
---|
12 | * This software component is licensed by ST under Ultimate Liberty license
|
---|
13 | * SLA0044, the "License"; You may not use this file except in compliance with
|
---|
14 | * the License. You may obtain a copy of the License at:
|
---|
15 | * www.st.com/SLA0044
|
---|
16 | *
|
---|
17 | ******************************************************************************
|
---|
18 | */
|
---|
19 | /* USER CODE END Header */
|
---|
20 |
|
---|
21 | /* Includes ------------------------------------------------------------------*/
|
---|
22 | #include "main.h"
|
---|
23 | #include "stm32f4xx_it.h"
|
---|
24 | /* Private includes ----------------------------------------------------------*/
|
---|
25 | /* USER CODE BEGIN Includes */
|
---|
26 | #include "cmsis_os.h"
|
---|
27 | #include "plc.h"
|
---|
28 | #include "temp.h"
|
---|
29 | /* USER CODE END Includes */
|
---|
30 |
|
---|
31 | /* Private typedef -----------------------------------------------------------*/
|
---|
32 | /* USER CODE BEGIN TD */
|
---|
33 |
|
---|
34 | /* USER CODE END TD */
|
---|
35 |
|
---|
36 | /* Private define ------------------------------------------------------------*/
|
---|
37 | /* USER CODE BEGIN PD */
|
---|
38 |
|
---|
39 | /* USER CODE END PD */
|
---|
40 |
|
---|
41 | /* Private macro -------------------------------------------------------------*/
|
---|
42 | /* USER CODE BEGIN PM */
|
---|
43 |
|
---|
44 | /* USER CODE END PM */
|
---|
45 |
|
---|
46 | /* Private variables ---------------------------------------------------------*/
|
---|
47 | /* USER CODE BEGIN PV */
|
---|
48 |
|
---|
49 | /* USER CODE END PV */
|
---|
50 |
|
---|
51 | /* Private function prototypes -----------------------------------------------*/
|
---|
52 | /* USER CODE BEGIN PFP */
|
---|
53 |
|
---|
54 | /* USER CODE END PFP */
|
---|
55 |
|
---|
56 | /* Private user code ---------------------------------------------------------*/
|
---|
57 | /* USER CODE BEGIN 0 */
|
---|
58 |
|
---|
59 | /* USER CODE END 0 */
|
---|
60 |
|
---|
61 | /* External variables --------------------------------------------------------*/
|
---|
62 | extern ETH_HandleTypeDef heth;
|
---|
63 | extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
|
---|
64 | extern TIM_HandleTypeDef htim6;
|
---|
65 |
|
---|
66 | /* USER CODE BEGIN EV */
|
---|
67 | extern UART_HandleTypeDef huart2;
|
---|
68 | extern xQueueHandle QueueReceiveUSART;
|
---|
69 | extern struct board *curr_device;
|
---|
70 | /* USER CODE END EV */
|
---|
71 |
|
---|
72 | /******************************************************************************/
|
---|
73 | /* Cortex-M4 Processor Interruption and Exception Handlers */
|
---|
74 | /******************************************************************************/
|
---|
75 | /**
|
---|
76 | * @brief This function handles Non maskable interrupt.
|
---|
77 | */
|
---|
78 | void NMI_Handler(void)
|
---|
79 | {
|
---|
80 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
|
---|
81 |
|
---|
82 | /* USER CODE END NonMaskableInt_IRQn 0 */
|
---|
83 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */
|
---|
84 | while (1)
|
---|
85 | {
|
---|
86 | }
|
---|
87 | /* USER CODE END NonMaskableInt_IRQn 1 */
|
---|
88 | }
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * @brief This function handles Hard fault interrupt.
|
---|
92 | */
|
---|
93 | void HardFault_Handler(void)
|
---|
94 | {
|
---|
95 | /* USER CODE BEGIN HardFault_IRQn 0 */
|
---|
96 |
|
---|
97 | /* USER CODE END HardFault_IRQn 0 */
|
---|
98 | while (1)
|
---|
99 | {
|
---|
100 | /* USER CODE BEGIN W1_HardFault_IRQn 0 */
|
---|
101 |
|
---|
102 | /* USER CODE END W1_HardFault_IRQn 0 */
|
---|
103 | }
|
---|
104 | }
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * @brief This function handles Memory management fault.
|
---|
108 | */
|
---|
109 | void MemManage_Handler(void)
|
---|
110 | {
|
---|
111 | /* USER CODE BEGIN MemoryManagement_IRQn 0 */
|
---|
112 |
|
---|
113 | /* USER CODE END MemoryManagement_IRQn 0 */
|
---|
114 | while (1)
|
---|
115 | {
|
---|
116 | /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
|
---|
117 | /* USER CODE END W1_MemoryManagement_IRQn 0 */
|
---|
118 | }
|
---|
119 | }
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * @brief This function handles Pre-fetch fault, memory access fault.
|
---|
123 | */
|
---|
124 | void BusFault_Handler(void)
|
---|
125 | {
|
---|
126 | /* USER CODE BEGIN BusFault_IRQn 0 */
|
---|
127 |
|
---|
128 | /* USER CODE END BusFault_IRQn 0 */
|
---|
129 | while (1)
|
---|
130 | {
|
---|
131 | /* USER CODE BEGIN W1_BusFault_IRQn 0 */
|
---|
132 | /* USER CODE END W1_BusFault_IRQn 0 */
|
---|
133 | }
|
---|
134 | }
|
---|
135 |
|
---|
136 | /**
|
---|
137 | * @brief This function handles Undefined instruction or illegal state.
|
---|
138 | */
|
---|
139 | void UsageFault_Handler(void)
|
---|
140 | {
|
---|
141 | /* USER CODE BEGIN UsageFault_IRQn 0 */
|
---|
142 |
|
---|
143 | /* USER CODE END UsageFault_IRQn 0 */
|
---|
144 | while (1)
|
---|
145 | {
|
---|
146 | /* USER CODE BEGIN W1_UsageFault_IRQn 0 */
|
---|
147 | /* USER CODE END W1_UsageFault_IRQn 0 */
|
---|
148 | }
|
---|
149 | }
|
---|
150 |
|
---|
151 | /**
|
---|
152 | * @brief This function handles Debug monitor.
|
---|
153 | */
|
---|
154 | void DebugMon_Handler(void)
|
---|
155 | {
|
---|
156 | /* USER CODE BEGIN DebugMonitor_IRQn 0 */
|
---|
157 |
|
---|
158 | /* USER CODE END DebugMonitor_IRQn 0 */
|
---|
159 | /* USER CODE BEGIN DebugMonitor_IRQn 1 */
|
---|
160 |
|
---|
161 | /* USER CODE END DebugMonitor_IRQn 1 */
|
---|
162 | }
|
---|
163 |
|
---|
164 | /******************************************************************************/
|
---|
165 | /* STM32F4xx 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_stm32f4xx.s). */
|
---|
169 | /******************************************************************************/
|
---|
170 |
|
---|
171 | /**
|
---|
172 | * @brief This function handles EXTI line[15:10] interrupts.
|
---|
173 | */
|
---|
174 | void EXTI15_10_IRQHandler(void)
|
---|
175 | {
|
---|
176 | /* USER CODE BEGIN EXTI15_10_IRQn 0 */
|
---|
177 |
|
---|
178 | /* USER CODE END EXTI15_10_IRQn 0 */
|
---|
179 | HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_12);
|
---|
180 | /* USER CODE BEGIN EXTI15_10_IRQn 1 */
|
---|
181 |
|
---|
182 | /* USER CODE END EXTI15_10_IRQn 1 */
|
---|
183 | }
|
---|
184 |
|
---|
185 | /**
|
---|
186 | * @brief This function handles TIM6 global interrupt, DAC1 and DAC2 underrun error interrupts.
|
---|
187 | */
|
---|
188 | void TIM6_DAC_IRQHandler(void)
|
---|
189 | {
|
---|
190 | /* USER CODE BEGIN TIM6_DAC_IRQn 0 */
|
---|
191 |
|
---|
192 | /* USER CODE END TIM6_DAC_IRQn 0 */
|
---|
193 | HAL_TIM_IRQHandler(&htim6);
|
---|
194 | /* USER CODE BEGIN TIM6_DAC_IRQn 1 */
|
---|
195 |
|
---|
196 | /* USER CODE END TIM6_DAC_IRQn 1 */
|
---|
197 | }
|
---|
198 |
|
---|
199 | /**
|
---|
200 | * @brief This function handles Ethernet global interrupt.
|
---|
201 | */
|
---|
202 | void ETH_IRQHandler(void)
|
---|
203 | {
|
---|
204 | /* USER CODE BEGIN ETH_IRQn 0 */
|
---|
205 |
|
---|
206 | /* USER CODE END ETH_IRQn 0 */
|
---|
207 | HAL_ETH_IRQHandler(&heth);
|
---|
208 | /* USER CODE BEGIN ETH_IRQn 1 */
|
---|
209 |
|
---|
210 | /* USER CODE END ETH_IRQn 1 */
|
---|
211 | }
|
---|
212 |
|
---|
213 | /**
|
---|
214 | * @brief This function handles USB On The Go FS global interrupt.
|
---|
215 | */
|
---|
216 | void OTG_FS_IRQHandler(void)
|
---|
217 | {
|
---|
218 | /* USER CODE BEGIN OTG_FS_IRQn 0 */
|
---|
219 |
|
---|
220 | /* USER CODE END OTG_FS_IRQn 0 */
|
---|
221 | HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
|
---|
222 | /* USER CODE BEGIN OTG_FS_IRQn 1 */
|
---|
223 |
|
---|
224 | /* USER CODE END OTG_FS_IRQn 1 */
|
---|
225 | }
|
---|
226 | /* USER CODE BEGIN 1 */
|
---|
227 |
|
---|
228 | void USART2_IRQHandler(void)
|
---|
229 | {
|
---|
230 | if(huart2.Instance->SR & USART_SR_RXNE){// CR1 ????
|
---|
231 | if(curr_device->type == 16) plc_receive((uint8_t)huart2.Instance->DR); // if usage PLC
|
---|
232 | }
|
---|
233 | }
|
---|
234 |
|
---|
235 | void TIM7_IRQHandler(void)
|
---|
236 | {
|
---|
237 | IRQ_Timer_1us();
|
---|
238 | TIM7->SR &= ~TIM_SR_UIF;
|
---|
239 | }
|
---|
240 | /* USER CODE END 1 */
|
---|
241 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
---|