AudioRecord

Dependencies:   STM32L4xx_HAL_Driver CMSIS_DSP_401

Committer:
EricLew
Date:
Thu Nov 26 22:32:56 2015 +0000
Revision:
3:ec7e3c37fe80
Parent:
0:d4e5ad7ad71c
FFT is currently not working and commented out

Who changed what in which revision?

UserRevisionLine numberNew contents of line
EricLew 0:d4e5ad7ad71c 1 /**
EricLew 0:d4e5ad7ad71c 2 ******************************************************************************
EricLew 0:d4e5ad7ad71c 3 * @file BSP/Src/stm32l4xx_it.c
EricLew 0:d4e5ad7ad71c 4 * @author MCD Application Team
EricLew 0:d4e5ad7ad71c 5 * @version V1.1.0
EricLew 0:d4e5ad7ad71c 6 * @date 16-September-2015
EricLew 0:d4e5ad7ad71c 7 * @brief Main Interrupt Service Routines.
EricLew 0:d4e5ad7ad71c 8 * This file provides template for all exceptions handler and
EricLew 0:d4e5ad7ad71c 9 * peripherals interrupt service routine.
EricLew 0:d4e5ad7ad71c 10 ******************************************************************************
EricLew 0:d4e5ad7ad71c 11 * @attention
EricLew 0:d4e5ad7ad71c 12 *
EricLew 0:d4e5ad7ad71c 13 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
EricLew 0:d4e5ad7ad71c 14 *
EricLew 0:d4e5ad7ad71c 15 * Redistribution and use in source and binary forms, with or without modification,
EricLew 0:d4e5ad7ad71c 16 * are permitted provided that the following conditions are met:
EricLew 0:d4e5ad7ad71c 17 * 1. Redistributions of source code must retain the above copyright notice,
EricLew 0:d4e5ad7ad71c 18 * this list of conditions and the following disclaimer.
EricLew 0:d4e5ad7ad71c 19 * 2. Redistributions in binary form must reproduce the above copyright notice,
EricLew 0:d4e5ad7ad71c 20 * this list of conditions and the following disclaimer in the documentation
EricLew 0:d4e5ad7ad71c 21 * and/or other materials provided with the distribution.
EricLew 0:d4e5ad7ad71c 22 * 3. Neither the name of STMicroelectronics nor the names of its contributors
EricLew 0:d4e5ad7ad71c 23 * may be used to endorse or promote products derived from this software
EricLew 0:d4e5ad7ad71c 24 * without specific prior written permission.
EricLew 0:d4e5ad7ad71c 25 *
EricLew 0:d4e5ad7ad71c 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
EricLew 0:d4e5ad7ad71c 27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
EricLew 0:d4e5ad7ad71c 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
EricLew 0:d4e5ad7ad71c 29 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
EricLew 0:d4e5ad7ad71c 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
EricLew 0:d4e5ad7ad71c 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
EricLew 0:d4e5ad7ad71c 32 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
EricLew 0:d4e5ad7ad71c 33 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
EricLew 0:d4e5ad7ad71c 34 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
EricLew 0:d4e5ad7ad71c 35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
EricLew 0:d4e5ad7ad71c 36 *
EricLew 0:d4e5ad7ad71c 37 ******************************************************************************
EricLew 0:d4e5ad7ad71c 38 */
EricLew 0:d4e5ad7ad71c 39
EricLew 0:d4e5ad7ad71c 40 /* Includes ------------------------------------------------------------------*/
EricLew 0:d4e5ad7ad71c 41 #include "stm32l4xx_it.h"
EricLew 0:d4e5ad7ad71c 42 #include "main.h"
EricLew 0:d4e5ad7ad71c 43
EricLew 0:d4e5ad7ad71c 44 /** @addtogroup STM32L4xx_HAL_Examples
EricLew 0:d4e5ad7ad71c 45 * @{
EricLew 0:d4e5ad7ad71c 46 */
EricLew 0:d4e5ad7ad71c 47
EricLew 0:d4e5ad7ad71c 48 /** @addtogroup Templates
EricLew 0:d4e5ad7ad71c 49 * @{
EricLew 0:d4e5ad7ad71c 50 */
EricLew 0:d4e5ad7ad71c 51
EricLew 0:d4e5ad7ad71c 52 extern SAI_HandleTypeDef BSP_AUDIO_hSai;
EricLew 0:d4e5ad7ad71c 53 extern DFSDM_Filter_HandleTypeDef BSP_AUDIO_hDfsdmLeftFilter;
EricLew 0:d4e5ad7ad71c 54
EricLew 0:d4e5ad7ad71c 55 /* DBG */
EricLew 0:d4e5ad7ad71c 56 typedef struct {
EricLew 0:d4e5ad7ad71c 57 uint32_t IrqCpt_EXTI0;
EricLew 0:d4e5ad7ad71c 58 uint32_t IrqCpt_EXTI1;
EricLew 0:d4e5ad7ad71c 59 uint32_t IrqCpt_EXTI2;
EricLew 0:d4e5ad7ad71c 60 uint32_t IrqCpt_EXTI3;
EricLew 0:d4e5ad7ad71c 61 uint32_t IrqCpt_EXTI9_5;
EricLew 0:d4e5ad7ad71c 62 uint32_t IrqCpt_EXTI15_10;
EricLew 0:d4e5ad7ad71c 63 uint32_t IrqCpt_SAI;
EricLew 0:d4e5ad7ad71c 64 uint32_t IrqCpt_DFSDM;
EricLew 0:d4e5ad7ad71c 65 } IrqCpt_t;
EricLew 0:d4e5ad7ad71c 66 IrqCpt_t IrqCpt = {0};
EricLew 0:d4e5ad7ad71c 67 /* DBG */
EricLew 0:d4e5ad7ad71c 68
EricLew 0:d4e5ad7ad71c 69 /* Private typedef -----------------------------------------------------------*/
EricLew 0:d4e5ad7ad71c 70 /* Private define ------------------------------------------------------------*/
EricLew 0:d4e5ad7ad71c 71 /* Private macro -------------------------------------------------------------*/
EricLew 0:d4e5ad7ad71c 72 /* Private variables ---------------------------------------------------------*/
EricLew 0:d4e5ad7ad71c 73 /* Private function prototypes -----------------------------------------------*/
EricLew 0:d4e5ad7ad71c 74 /* Private functions ---------------------------------------------------------*/
EricLew 0:d4e5ad7ad71c 75
EricLew 0:d4e5ad7ad71c 76 /******************************************************************************/
EricLew 0:d4e5ad7ad71c 77 /* Cortex-M4 Processor Exceptions Handlers */
EricLew 0:d4e5ad7ad71c 78 /******************************************************************************/
EricLew 0:d4e5ad7ad71c 79
EricLew 0:d4e5ad7ad71c 80 /**
EricLew 0:d4e5ad7ad71c 81 * @brief This function handles NMI exception.
EricLew 0:d4e5ad7ad71c 82 * @param None
EricLew 0:d4e5ad7ad71c 83 * @retval None
EricLew 0:d4e5ad7ad71c 84 */
EricLew 0:d4e5ad7ad71c 85 void NMI_Handler(void)
EricLew 0:d4e5ad7ad71c 86 {
EricLew 0:d4e5ad7ad71c 87 }
EricLew 0:d4e5ad7ad71c 88
EricLew 0:d4e5ad7ad71c 89 /**
EricLew 0:d4e5ad7ad71c 90 * @brief This function handles Hard Fault exception.
EricLew 0:d4e5ad7ad71c 91 * @param None
EricLew 0:d4e5ad7ad71c 92 * @retval None
EricLew 0:d4e5ad7ad71c 93 */
EricLew 0:d4e5ad7ad71c 94 void HardFault_Handler(void)
EricLew 0:d4e5ad7ad71c 95 {
EricLew 0:d4e5ad7ad71c 96 /* Go to infinite loop when Hard Fault exception occurs */
EricLew 0:d4e5ad7ad71c 97 while (1)
EricLew 0:d4e5ad7ad71c 98 {
EricLew 0:d4e5ad7ad71c 99 }
EricLew 0:d4e5ad7ad71c 100 }
EricLew 0:d4e5ad7ad71c 101
EricLew 0:d4e5ad7ad71c 102 /**
EricLew 0:d4e5ad7ad71c 103 * @brief This function handles Memory Manage exception.
EricLew 0:d4e5ad7ad71c 104 * @param None
EricLew 0:d4e5ad7ad71c 105 * @retval None
EricLew 0:d4e5ad7ad71c 106 */
EricLew 0:d4e5ad7ad71c 107 void MemManage_Handler(void)
EricLew 0:d4e5ad7ad71c 108 {
EricLew 0:d4e5ad7ad71c 109 /* Go to infinite loop when Memory Manage exception occurs */
EricLew 0:d4e5ad7ad71c 110 while (1)
EricLew 0:d4e5ad7ad71c 111 {
EricLew 0:d4e5ad7ad71c 112 }
EricLew 0:d4e5ad7ad71c 113 }
EricLew 0:d4e5ad7ad71c 114
EricLew 0:d4e5ad7ad71c 115 /**
EricLew 0:d4e5ad7ad71c 116 * @brief This function handles Bus Fault exception.
EricLew 0:d4e5ad7ad71c 117 * @param None
EricLew 0:d4e5ad7ad71c 118 * @retval None
EricLew 0:d4e5ad7ad71c 119 */
EricLew 0:d4e5ad7ad71c 120 void BusFault_Handler(void)
EricLew 0:d4e5ad7ad71c 121 {
EricLew 0:d4e5ad7ad71c 122 /* Go to infinite loop when Bus Fault exception occurs */
EricLew 0:d4e5ad7ad71c 123 while (1)
EricLew 0:d4e5ad7ad71c 124 {
EricLew 0:d4e5ad7ad71c 125 }
EricLew 0:d4e5ad7ad71c 126 }
EricLew 0:d4e5ad7ad71c 127
EricLew 0:d4e5ad7ad71c 128 /**
EricLew 0:d4e5ad7ad71c 129 * @brief This function handles Usage Fault exception.
EricLew 0:d4e5ad7ad71c 130 * @param None
EricLew 0:d4e5ad7ad71c 131 * @retval None
EricLew 0:d4e5ad7ad71c 132 */
EricLew 0:d4e5ad7ad71c 133 void UsageFault_Handler(void)
EricLew 0:d4e5ad7ad71c 134 {
EricLew 0:d4e5ad7ad71c 135 /* Go to infinite loop when Usage Fault exception occurs */
EricLew 0:d4e5ad7ad71c 136 while (1)
EricLew 0:d4e5ad7ad71c 137 {
EricLew 0:d4e5ad7ad71c 138 }
EricLew 0:d4e5ad7ad71c 139 }
EricLew 0:d4e5ad7ad71c 140
EricLew 0:d4e5ad7ad71c 141 /**
EricLew 0:d4e5ad7ad71c 142 * @brief This function handles SVCall exception.
EricLew 0:d4e5ad7ad71c 143 * @param None
EricLew 0:d4e5ad7ad71c 144 * @retval None
EricLew 0:d4e5ad7ad71c 145 */
EricLew 0:d4e5ad7ad71c 146 void SVC_Handler(void)
EricLew 0:d4e5ad7ad71c 147 {
EricLew 0:d4e5ad7ad71c 148 }
EricLew 0:d4e5ad7ad71c 149
EricLew 0:d4e5ad7ad71c 150 /**
EricLew 0:d4e5ad7ad71c 151 * @brief This function handles Debug Monitor exception.
EricLew 0:d4e5ad7ad71c 152 * @param None
EricLew 0:d4e5ad7ad71c 153 * @retval None
EricLew 0:d4e5ad7ad71c 154 */
EricLew 0:d4e5ad7ad71c 155 void DebugMon_Handler(void)
EricLew 0:d4e5ad7ad71c 156 {
EricLew 0:d4e5ad7ad71c 157 }
EricLew 0:d4e5ad7ad71c 158
EricLew 0:d4e5ad7ad71c 159 /**
EricLew 0:d4e5ad7ad71c 160 * @brief This function handles PendSVC exception.
EricLew 0:d4e5ad7ad71c 161 * @param None
EricLew 0:d4e5ad7ad71c 162 * @retval None
EricLew 0:d4e5ad7ad71c 163 */
EricLew 0:d4e5ad7ad71c 164 void PendSV_Handler(void)
EricLew 0:d4e5ad7ad71c 165 {
EricLew 0:d4e5ad7ad71c 166 }
EricLew 0:d4e5ad7ad71c 167
EricLew 0:d4e5ad7ad71c 168 /**
EricLew 0:d4e5ad7ad71c 169 * @brief This function handles SysTick Handler.
EricLew 0:d4e5ad7ad71c 170 * @param None
EricLew 0:d4e5ad7ad71c 171 * @retval None
EricLew 0:d4e5ad7ad71c 172 */
EricLew 0:d4e5ad7ad71c 173 void SysTick_Handler(void)
EricLew 0:d4e5ad7ad71c 174 {
EricLew 0:d4e5ad7ad71c 175 HAL_IncTick();
EricLew 0:d4e5ad7ad71c 176 }
EricLew 0:d4e5ad7ad71c 177
EricLew 0:d4e5ad7ad71c 178
EricLew 0:d4e5ad7ad71c 179 /******************************************************************************/
EricLew 0:d4e5ad7ad71c 180 /* STM32L4xx Peripherals Interrupt Handlers */
EricLew 0:d4e5ad7ad71c 181 /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
EricLew 0:d4e5ad7ad71c 182 /* available peripheral interrupt handler's name please refer to the startup */
EricLew 0:d4e5ad7ad71c 183 /* file (startup_stm32l4xx.s). */
EricLew 0:d4e5ad7ad71c 184 /******************************************************************************/
EricLew 0:d4e5ad7ad71c 185
EricLew 0:d4e5ad7ad71c 186 /**
EricLew 0:d4e5ad7ad71c 187 * @brief This function handles EXTI0 interrupt request.
EricLew 0:d4e5ad7ad71c 188 * @param None
EricLew 0:d4e5ad7ad71c 189 * @retval None
EricLew 0:d4e5ad7ad71c 190 */
EricLew 0:d4e5ad7ad71c 191 void EXTI0_IRQHandler (void)
EricLew 0:d4e5ad7ad71c 192 {
EricLew 0:d4e5ad7ad71c 193 IrqCpt.IrqCpt_EXTI0++;
EricLew 0:d4e5ad7ad71c 194 HAL_GPIO_EXTI_IRQHandler(SEL_JOY_PIN);
EricLew 0:d4e5ad7ad71c 195 }
EricLew 0:d4e5ad7ad71c 196
EricLew 0:d4e5ad7ad71c 197 /**
EricLew 0:d4e5ad7ad71c 198 * @brief This function handles EXTI1 interrupt request.
EricLew 0:d4e5ad7ad71c 199 * @param None
EricLew 0:d4e5ad7ad71c 200 * @retval None
EricLew 0:d4e5ad7ad71c 201 */
EricLew 0:d4e5ad7ad71c 202 void EXTI1_IRQHandler (void)
EricLew 0:d4e5ad7ad71c 203 {
EricLew 0:d4e5ad7ad71c 204 IrqCpt.IrqCpt_EXTI1++;
EricLew 0:d4e5ad7ad71c 205 HAL_GPIO_EXTI_IRQHandler(LEFT_JOY_PIN);
EricLew 0:d4e5ad7ad71c 206 }
EricLew 0:d4e5ad7ad71c 207
EricLew 0:d4e5ad7ad71c 208 /**
EricLew 0:d4e5ad7ad71c 209 * @brief This function handles EXTI2 interrupt request.
EricLew 0:d4e5ad7ad71c 210 * @param None
EricLew 0:d4e5ad7ad71c 211 * @retval None
EricLew 0:d4e5ad7ad71c 212 */
EricLew 0:d4e5ad7ad71c 213 void EXTI2_IRQHandler (void)
EricLew 0:d4e5ad7ad71c 214 {
EricLew 0:d4e5ad7ad71c 215 IrqCpt.IrqCpt_EXTI2++;
EricLew 0:d4e5ad7ad71c 216 HAL_GPIO_EXTI_IRQHandler(RIGHT_JOY_PIN);
EricLew 0:d4e5ad7ad71c 217 }
EricLew 0:d4e5ad7ad71c 218
EricLew 0:d4e5ad7ad71c 219 /**
EricLew 0:d4e5ad7ad71c 220 * @brief This function handles EXTI3 interrupt request.
EricLew 0:d4e5ad7ad71c 221 * @param None
EricLew 0:d4e5ad7ad71c 222 * @retval None
EricLew 0:d4e5ad7ad71c 223 */
EricLew 0:d4e5ad7ad71c 224 void EXTI3_IRQHandler (void)
EricLew 0:d4e5ad7ad71c 225 {
EricLew 0:d4e5ad7ad71c 226 IrqCpt.IrqCpt_EXTI3++;
EricLew 0:d4e5ad7ad71c 227 HAL_GPIO_TogglePin(LED4_GPIO_PORT, LED4_PIN);
EricLew 0:d4e5ad7ad71c 228 HAL_GPIO_EXTI_IRQHandler(UP_JOY_PIN);
EricLew 0:d4e5ad7ad71c 229 HAL_GPIO_TogglePin(LED4_GPIO_PORT, LED4_PIN);
EricLew 0:d4e5ad7ad71c 230 }
EricLew 0:d4e5ad7ad71c 231
EricLew 0:d4e5ad7ad71c 232 /**
EricLew 0:d4e5ad7ad71c 233 * @brief This function handles EXTI9_5 interrupt request.
EricLew 0:d4e5ad7ad71c 234 * @param None
EricLew 0:d4e5ad7ad71c 235 * @retval None
EricLew 0:d4e5ad7ad71c 236 */
EricLew 0:d4e5ad7ad71c 237 void EXTI9_5_IRQHandler (void)
EricLew 0:d4e5ad7ad71c 238 {
EricLew 0:d4e5ad7ad71c 239 IrqCpt.IrqCpt_EXTI9_5++;
EricLew 0:d4e5ad7ad71c 240 HAL_GPIO_EXTI_IRQHandler(DOWN_JOY_PIN);
EricLew 0:d4e5ad7ad71c 241 }
EricLew 0:d4e5ad7ad71c 242
EricLew 0:d4e5ad7ad71c 243 /**
EricLew 0:d4e5ad7ad71c 244 * @brief This function handles EXTI15_10 interrupt request.
EricLew 0:d4e5ad7ad71c 245 * @param None
EricLew 0:d4e5ad7ad71c 246 * @retval None
EricLew 0:d4e5ad7ad71c 247 */
EricLew 0:d4e5ad7ad71c 248 void EXTI15_10_IRQHandler (void)
EricLew 0:d4e5ad7ad71c 249 {
EricLew 0:d4e5ad7ad71c 250 IrqCpt.IrqCpt_EXTI15_10++;
EricLew 0:d4e5ad7ad71c 251 HAL_GPIO_EXTI_IRQHandler(IDD_INT_PIN);
EricLew 0:d4e5ad7ad71c 252 }
EricLew 0:d4e5ad7ad71c 253
EricLew 0:d4e5ad7ad71c 254 /**
EricLew 0:d4e5ad7ad71c 255 * @brief This function handles SAI DMA interrupt request.
EricLew 0:d4e5ad7ad71c 256 * @param None
EricLew 0:d4e5ad7ad71c 257 * @retval None
EricLew 0:d4e5ad7ad71c 258 */
EricLew 0:d4e5ad7ad71c 259 void AUDIO_SAIx_DMAx_IRQHandler(void)
EricLew 0:d4e5ad7ad71c 260 {
EricLew 0:d4e5ad7ad71c 261 IrqCpt.IrqCpt_SAI++;
EricLew 0:d4e5ad7ad71c 262 HAL_DMA_IRQHandler(BSP_AUDIO_hSai.hdmatx);
EricLew 0:d4e5ad7ad71c 263 }
EricLew 0:d4e5ad7ad71c 264
EricLew 0:d4e5ad7ad71c 265 /**
EricLew 0:d4e5ad7ad71c 266 * @brief This function handles DFSDM Left DMAinterrupt request.
EricLew 0:d4e5ad7ad71c 267 * @param None
EricLew 0:d4e5ad7ad71c 268 * @retval None
EricLew 0:d4e5ad7ad71c 269 */
EricLew 0:d4e5ad7ad71c 270 void AUDIO_DFSDM_DMAx_LEFT_IRQHandler(void)
EricLew 0:d4e5ad7ad71c 271 {
EricLew 0:d4e5ad7ad71c 272 IrqCpt.IrqCpt_DFSDM++;
EricLew 0:d4e5ad7ad71c 273 HAL_DMA_IRQHandler(BSP_AUDIO_hDfsdmLeftFilter.hdmaReg);
EricLew 0:d4e5ad7ad71c 274 }
EricLew 0:d4e5ad7ad71c 275
EricLew 0:d4e5ad7ad71c 276 /**
EricLew 0:d4e5ad7ad71c 277 * @}
EricLew 0:d4e5ad7ad71c 278 */
EricLew 0:d4e5ad7ad71c 279
EricLew 0:d4e5ad7ad71c 280 /**
EricLew 0:d4e5ad7ad71c 281 * @}
EricLew 0:d4e5ad7ad71c 282 */
EricLew 0:d4e5ad7ad71c 283
EricLew 0:d4e5ad7ad71c 284 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
EricLew 0:d4e5ad7ad71c 285