A low cost DIY sound pressure level sensor for enabling environmental noise awareness. https://lukasschwarz.org/noise-sensor
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

209 lines
5.8 KiB

  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file stm32g0xx_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 "stm32g0xx_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 DMA_HandleTypeDef hdma_adc1;
  46. extern ADC_HandleTypeDef hadc1;
  47. extern I2C_HandleTypeDef hi2c2;
  48. extern DMA_HandleTypeDef hdma_spi1_rx;
  49. /* USER CODE BEGIN EV */
  50. /* USER CODE END EV */
  51. /******************************************************************************/
  52. /* Cortex-M0+ Processor Interruption and Exception Handlers */
  53. /******************************************************************************/
  54. /**
  55. * @brief This function handles Non maskable interrupt.
  56. */
  57. void NMI_Handler(void)
  58. {
  59. /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
  60. /* USER CODE END NonMaskableInt_IRQn 0 */
  61. /* USER CODE BEGIN NonMaskableInt_IRQn 1 */
  62. /* USER CODE END NonMaskableInt_IRQn 1 */
  63. }
  64. /**
  65. * @brief This function handles Hard fault interrupt.
  66. */
  67. void HardFault_Handler(void)
  68. {
  69. /* USER CODE BEGIN HardFault_IRQn 0 */
  70. /* USER CODE END HardFault_IRQn 0 */
  71. while (1)
  72. {
  73. /* USER CODE BEGIN W1_HardFault_IRQn 0 */
  74. /* USER CODE END W1_HardFault_IRQn 0 */
  75. }
  76. }
  77. /**
  78. * @brief This function handles System service call via SWI instruction.
  79. */
  80. void SVC_Handler(void)
  81. {
  82. /* USER CODE BEGIN SVC_IRQn 0 */
  83. /* USER CODE END SVC_IRQn 0 */
  84. /* USER CODE BEGIN SVC_IRQn 1 */
  85. /* USER CODE END SVC_IRQn 1 */
  86. }
  87. /**
  88. * @brief This function handles Pendable request for system service.
  89. */
  90. void PendSV_Handler(void)
  91. {
  92. /* USER CODE BEGIN PendSV_IRQn 0 */
  93. /* USER CODE END PendSV_IRQn 0 */
  94. /* USER CODE BEGIN PendSV_IRQn 1 */
  95. /* USER CODE END PendSV_IRQn 1 */
  96. }
  97. /**
  98. * @brief This function handles System tick timer.
  99. */
  100. void SysTick_Handler(void)
  101. {
  102. /* USER CODE BEGIN SysTick_IRQn 0 */
  103. /* USER CODE END SysTick_IRQn 0 */
  104. HAL_IncTick();
  105. /* USER CODE BEGIN SysTick_IRQn 1 */
  106. /* USER CODE END SysTick_IRQn 1 */
  107. }
  108. /******************************************************************************/
  109. /* STM32G0xx Peripheral Interrupt Handlers */
  110. /* Add here the Interrupt Handlers for the used peripherals. */
  111. /* For the available peripheral interrupt handler names, */
  112. /* please refer to the startup file (startup_stm32g0xx.s). */
  113. /******************************************************************************/
  114. /**
  115. * @brief This function handles DMA1 channel 1 interrupt.
  116. */
  117. void DMA1_Channel1_IRQHandler(void)
  118. {
  119. /* USER CODE BEGIN DMA1_Channel1_IRQn 0 */
  120. /* USER CODE END DMA1_Channel1_IRQn 0 */
  121. HAL_DMA_IRQHandler(&hdma_spi1_rx);
  122. /* USER CODE BEGIN DMA1_Channel1_IRQn 1 */
  123. /* USER CODE END DMA1_Channel1_IRQn 1 */
  124. }
  125. /**
  126. * @brief This function handles DMA1 channel 2 and channel 3 interrupts.
  127. */
  128. void DMA1_Channel2_3_IRQHandler(void)
  129. {
  130. /* USER CODE BEGIN DMA1_Channel2_3_IRQn 0 */
  131. /* USER CODE END DMA1_Channel2_3_IRQn 0 */
  132. HAL_DMA_IRQHandler(&hdma_adc1);
  133. /* USER CODE BEGIN DMA1_Channel2_3_IRQn 1 */
  134. /* USER CODE END DMA1_Channel2_3_IRQn 1 */
  135. }
  136. /**
  137. * @brief This function handles ADC1, COMP1 and COMP2 interrupts (COMP interrupts through EXTI lines 17 and 18).
  138. */
  139. void ADC1_COMP_IRQHandler(void)
  140. {
  141. /* USER CODE BEGIN ADC1_COMP_IRQn 0 */
  142. /* USER CODE END ADC1_COMP_IRQn 0 */
  143. HAL_ADC_IRQHandler(&hadc1);
  144. /* USER CODE BEGIN ADC1_COMP_IRQn 1 */
  145. /* USER CODE END ADC1_COMP_IRQn 1 */
  146. }
  147. /**
  148. * @brief This function handles I2C2 global interrupt.
  149. */
  150. void I2C2_IRQHandler(void)
  151. {
  152. /* USER CODE BEGIN I2C2_IRQn 0 */
  153. /* USER CODE END I2C2_IRQn 0 */
  154. if (hi2c2.Instance->ISR & (I2C_FLAG_BERR | I2C_FLAG_ARLO | I2C_FLAG_OVR)) {
  155. HAL_I2C_ER_IRQHandler(&hi2c2);
  156. } else {
  157. HAL_I2C_EV_IRQHandler(&hi2c2);
  158. }
  159. /* USER CODE BEGIN I2C2_IRQn 1 */
  160. /* USER CODE END I2C2_IRQn 1 */
  161. }
  162. /* USER CODE BEGIN 1 */
  163. /* USER CODE END 1 */
  164. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/