| 1 | /* USER CODE BEGIN Header */
|
|---|
| 2 | /**
|
|---|
| 3 | ******************************************************************************
|
|---|
| 4 | * @file stm32g0xx_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 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 |
|
|---|
| 21 | /* Includes ------------------------------------------------------------------*/
|
|---|
| 22 | #include "main.h"
|
|---|
| 23 | #include "stm32g0xx_it.h"
|
|---|
| 24 | /* Private includes ----------------------------------------------------------*/
|
|---|
| 25 | /* USER CODE BEGIN Includes */
|
|---|
| 26 | #include "modbus.h"
|
|---|
| 27 | /* USER CODE END Includes */
|
|---|
| 28 |
|
|---|
| 29 | /* Private typedef -----------------------------------------------------------*/
|
|---|
| 30 | /* USER CODE BEGIN TD */
|
|---|
| 31 |
|
|---|
| 32 | /* USER CODE END TD */
|
|---|
| 33 |
|
|---|
| 34 | /* Private define ------------------------------------------------------------*/
|
|---|
| 35 | /* USER CODE BEGIN PD */
|
|---|
| 36 |
|
|---|
| 37 | /* USER CODE END PD */
|
|---|
| 38 |
|
|---|
| 39 | /* Private macro -------------------------------------------------------------*/
|
|---|
| 40 | /* USER CODE BEGIN PM */
|
|---|
| 41 |
|
|---|
| 42 | /* USER CODE END PM */
|
|---|
| 43 |
|
|---|
| 44 | /* Private variables ---------------------------------------------------------*/
|
|---|
| 45 | /* USER CODE BEGIN PV */
|
|---|
| 46 |
|
|---|
| 47 | /* USER CODE END PV */
|
|---|
| 48 |
|
|---|
| 49 | /* Private function prototypes -----------------------------------------------*/
|
|---|
| 50 | /* USER CODE BEGIN PFP */
|
|---|
| 51 |
|
|---|
| 52 | /* USER CODE END PFP */
|
|---|
| 53 |
|
|---|
| 54 | /* Private user code ---------------------------------------------------------*/
|
|---|
| 55 | /* USER CODE BEGIN 0 */
|
|---|
| 56 |
|
|---|
| 57 | /* USER CODE END 0 */
|
|---|
| 58 |
|
|---|
| 59 | /* External variables --------------------------------------------------------*/
|
|---|
| 60 | extern DMA_HandleTypeDef hdma_adc1;
|
|---|
| 61 | extern ADC_HandleTypeDef hadc1;
|
|---|
| 62 | extern UART_HandleTypeDef huart1;
|
|---|
| 63 | /* USER CODE BEGIN EV */
|
|---|
| 64 |
|
|---|
| 65 | /* USER CODE END EV */
|
|---|
| 66 |
|
|---|
| 67 | /******************************************************************************/
|
|---|
| 68 | /* Cortex-M0+ Processor Interruption and Exception Handlers */
|
|---|
| 69 | /******************************************************************************/
|
|---|
| 70 | /**
|
|---|
| 71 | * @brief This function handles Non maskable interrupt.
|
|---|
| 72 | */
|
|---|
| 73 | void NMI_Handler(void)
|
|---|
| 74 | {
|
|---|
| 75 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
|
|---|
| 76 |
|
|---|
| 77 | /* USER CODE END NonMaskableInt_IRQn 0 */
|
|---|
| 78 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */
|
|---|
| 79 | while (1)
|
|---|
| 80 | {
|
|---|
| 81 | }
|
|---|
| 82 | /* USER CODE END NonMaskableInt_IRQn 1 */
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | /**
|
|---|
| 86 | * @brief This function handles Hard fault interrupt.
|
|---|
| 87 | */
|
|---|
| 88 | void HardFault_Handler(void)
|
|---|
| 89 | {
|
|---|
| 90 | /* USER CODE BEGIN HardFault_IRQn 0 */
|
|---|
| 91 |
|
|---|
| 92 | /* USER CODE END HardFault_IRQn 0 */
|
|---|
| 93 | while (1)
|
|---|
| 94 | {
|
|---|
| 95 | /* USER CODE BEGIN W1_HardFault_IRQn 0 */
|
|---|
| 96 | /* USER CODE END W1_HardFault_IRQn 0 */
|
|---|
| 97 | }
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | /**
|
|---|
| 101 | * @brief This function handles System service call via SWI instruction.
|
|---|
| 102 | */
|
|---|
| 103 | void SVC_Handler(void)
|
|---|
| 104 | {
|
|---|
| 105 | /* USER CODE BEGIN SVC_IRQn 0 */
|
|---|
| 106 |
|
|---|
| 107 | /* USER CODE END SVC_IRQn 0 */
|
|---|
| 108 | /* USER CODE BEGIN SVC_IRQn 1 */
|
|---|
| 109 |
|
|---|
| 110 | /* USER CODE END SVC_IRQn 1 */
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | /**
|
|---|
| 114 | * @brief This function handles Pendable request for system service.
|
|---|
| 115 | */
|
|---|
| 116 | void PendSV_Handler(void)
|
|---|
| 117 | {
|
|---|
| 118 | /* USER CODE BEGIN PendSV_IRQn 0 */
|
|---|
| 119 |
|
|---|
| 120 | /* USER CODE END PendSV_IRQn 0 */
|
|---|
| 121 | /* USER CODE BEGIN PendSV_IRQn 1 */
|
|---|
| 122 |
|
|---|
| 123 | /* USER CODE END PendSV_IRQn 1 */
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | /**
|
|---|
| 127 | * @brief This function handles System tick timer.
|
|---|
| 128 | */
|
|---|
| 129 | void SysTick_Handler(void)
|
|---|
| 130 | {
|
|---|
| 131 | /* USER CODE BEGIN SysTick_IRQn 0 */
|
|---|
| 132 |
|
|---|
| 133 | /* USER CODE END SysTick_IRQn 0 */
|
|---|
| 134 | HAL_IncTick();
|
|---|
| 135 | /* USER CODE BEGIN SysTick_IRQn 1 */
|
|---|
| 136 |
|
|---|
| 137 | /* USER CODE END SysTick_IRQn 1 */
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | /******************************************************************************/
|
|---|
| 141 | /* STM32G0xx Peripheral Interrupt Handlers */
|
|---|
| 142 | /* Add here the Interrupt Handlers for the used peripherals. */
|
|---|
| 143 | /* For the available peripheral interrupt handler names, */
|
|---|
| 144 | /* please refer to the startup file (startup_stm32g0xx.s). */
|
|---|
| 145 | /******************************************************************************/
|
|---|
| 146 |
|
|---|
| 147 | /**
|
|---|
| 148 | * @brief This function handles DMA1 channel 1 interrupt.
|
|---|
| 149 | */
|
|---|
| 150 | void DMA1_Channel1_IRQHandler(void)
|
|---|
| 151 | {
|
|---|
| 152 | /* USER CODE BEGIN DMA1_Channel1_IRQn 0 */
|
|---|
| 153 |
|
|---|
| 154 | /* USER CODE END DMA1_Channel1_IRQn 0 */
|
|---|
| 155 | HAL_DMA_IRQHandler(&hdma_adc1);
|
|---|
| 156 | /* USER CODE BEGIN DMA1_Channel1_IRQn 1 */
|
|---|
| 157 |
|
|---|
| 158 | /* USER CODE END DMA1_Channel1_IRQn 1 */
|
|---|
| 159 | }
|
|---|
| 160 |
|
|---|
| 161 | /**
|
|---|
| 162 | * @brief This function handles ADC1, COMP1 and COMP2 interrupts (COMP interrupts through EXTI lines 17 and 18).
|
|---|
| 163 | */
|
|---|
| 164 | void ADC1_COMP_IRQHandler(void)
|
|---|
| 165 | {
|
|---|
| 166 | /* USER CODE BEGIN ADC1_COMP_IRQn 0 */
|
|---|
| 167 |
|
|---|
| 168 | /* USER CODE END ADC1_COMP_IRQn 0 */
|
|---|
| 169 | HAL_ADC_IRQHandler(&hadc1);
|
|---|
| 170 | /* USER CODE BEGIN ADC1_COMP_IRQn 1 */
|
|---|
| 171 |
|
|---|
| 172 | /* USER CODE END ADC1_COMP_IRQn 1 */
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | /**
|
|---|
| 176 | * @brief This function handles USART1 global interrupt / USART1 wake-up interrupt through EXTI line 25.
|
|---|
| 177 | */
|
|---|
| 178 | void USART1_IRQHandler(void)
|
|---|
| 179 | {
|
|---|
| 180 | /* USER CODE BEGIN USART1_IRQn 0 */
|
|---|
| 181 | //Umleitung auf unseren eigenen IRQ Handler
|
|---|
| 182 | MODBUS_UART_IRQHandler(&huart1);
|
|---|
| 183 | return;
|
|---|
| 184 | /* USER CODE END USART1_IRQn 0 */
|
|---|
| 185 | HAL_UART_IRQHandler(&huart1);
|
|---|
| 186 | /* USER CODE BEGIN USART1_IRQn 1 */
|
|---|
| 187 |
|
|---|
| 188 | /* USER CODE END USART1_IRQn 1 */
|
|---|
| 189 | }
|
|---|
| 190 |
|
|---|
| 191 | /* USER CODE BEGIN 1 */
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 | //Cube IRQ Handler namen stimmen nicht mit Segger IRQ Namen überein---> Redirecting
|
|---|
| 195 | void DMA_Channel1_IRQHandler(void)
|
|---|
| 196 | {
|
|---|
| 197 | DMA1_Channel1_IRQHandler();
|
|---|
| 198 | }
|
|---|
| 199 |
|
|---|
| 200 | void ADC_COMP_IRQHandler(void)
|
|---|
| 201 | {
|
|---|
| 202 | ADC1_COMP_IRQHandler();
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 | void USART3_USART4_LPUART1_IRQHandler(void)
|
|---|
| 208 | {
|
|---|
| 209 | MODBUS_UART_IRQHandler(&huart1);
|
|---|
| 210 |
|
|---|
| 211 | }
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 | /* USER CODE END 1 */
|
|---|
| 215 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|---|