Projet

Dependents:   DISCO-F746NG_Scope_copy

Fork of BSP_DISCO_F746NG by ST

Revision:
2:458ab1edf6b2
Parent:
1:ee089790cdbb
Child:
3:8ae03419c0f3
--- a/stm32746g_discovery_audio.c	Mon Jan 04 15:19:15 2016 +0000
+++ b/stm32746g_discovery_audio.c	Thu Mar 24 20:50:59 2016 +0000
@@ -147,6 +147,9 @@
 /** @defgroup STM32746G_DISCOVERY_AUDIO_Private_Function_Prototypes STM32746G_DISCOVERY AUDIO Private Function Prototypes
   * @{
   */
+static void AUDIO_IN_INT_IRQHandler(void);
+static void AUDIO_IN_SAIx_DMAx_IRQHandler(void);
+static void AUDIO_OUT_SAIx_DMAx_IRQHandler(void);
 static void SAIx_Out_Init(uint32_t AudioFreq);
 static void SAIx_Out_DeInit(void);
 static void SAIx_In_Init(uint32_t SaiOutMode, uint32_t SlotActive, uint32_t AudioFreq);
@@ -599,10 +602,20 @@
     /* Configure the DMA Stream */
     HAL_DMA_Init(&hdma_sai_tx);      
   }
-  
+#if ( __MBED__ == 1)
+    // Enable interrupt
+    IRQn_Type irqn = (IRQn_Type)(AUDIO_OUT_SAIx_DMAx_IRQ);
+    NVIC_ClearPendingIRQ(irqn);
+    NVIC_DisableIRQ(irqn);
+    NVIC_SetPriority(irqn, AUDIO_OUT_IRQ_PREPRIO);
+    NVIC_SetVector(irqn, (uint32_t)AUDIO_OUT_SAIx_DMAx_IRQHandler);
+    NVIC_EnableIRQ(irqn);
+
+#else
   /* SAI DMA IRQ Channel configuration */
   HAL_NVIC_SetPriority(AUDIO_OUT_SAIx_DMAx_IRQ, AUDIO_OUT_IRQ_PREPRIO, 0);
   HAL_NVIC_EnableIRQ(AUDIO_OUT_SAIx_DMAx_IRQ); 
+#endif
 }
 
 /**
@@ -1168,12 +1181,30 @@
   }
   
   /* SAI DMA IRQ Channel configuration */
+#if ( __MBED__ == 1)
+    IRQn_Type irqn = (IRQn_Type)(AUDIO_IN_SAIx_DMAx_IRQ);
+    NVIC_ClearPendingIRQ(irqn);
+    NVIC_DisableIRQ(irqn);
+    NVIC_SetPriority(irqn, AUDIO_IN_IRQ_PREPRIO);
+    NVIC_SetVector(irqn, (uint32_t)AUDIO_IN_SAIx_DMAx_IRQHandler);
+    NVIC_EnableIRQ(irqn);
+#else
   HAL_NVIC_SetPriority(AUDIO_IN_SAIx_DMAx_IRQ, AUDIO_IN_IRQ_PREPRIO, 0);
   HAL_NVIC_EnableIRQ(AUDIO_IN_SAIx_DMAx_IRQ);
+#endif
 
   /* Audio INT IRQ Channel configuration */
+#if ( __MBED__ == 1)
+    irqn = (IRQn_Type)(AUDIO_IN_INT_IRQ);
+    NVIC_ClearPendingIRQ(irqn);
+    NVIC_DisableIRQ(irqn);
+    NVIC_SetPriority(irqn, AUDIO_IN_IRQ_PREPRIO);
+    NVIC_SetVector(irqn, (uint32_t)AUDIO_IN_INT_IRQHandler);
+    NVIC_EnableIRQ(irqn);
+#else
   HAL_NVIC_SetPriority(AUDIO_IN_INT_IRQ, AUDIO_IN_IRQ_PREPRIO, 0);
   HAL_NVIC_EnableIRQ(AUDIO_IN_INT_IRQ);
+#endif
 }
 
 /**
@@ -1340,6 +1371,39 @@
   HAL_SAI_DeInit(&haudio_in_sai);
 }
 
+/**
+  * @brief  This function handles External line 15_10 interrupt request.
+  * @param  None
+  * @retval None
+  */
+static void AUDIO_IN_INT_IRQHandler(void)
+{
+  /* Interrupt handler shared between SD_DETECT pin, USER_KEY button and touch screen interrupt */
+  if (__HAL_GPIO_EXTI_GET_IT(AUDIO_IN_INT_GPIO_PIN) != RESET)
+  {
+    HAL_GPIO_EXTI_IRQHandler(AUDIO_IN_INT_GPIO_PIN);   /* Audio Interrupt */
+  }
+}
+
+/**
+  * @brief This function handles DMA2 Stream 7 interrupt request.
+  * @param None
+  * @retval None
+  */
+static void AUDIO_IN_SAIx_DMAx_IRQHandler(void)
+{
+  HAL_DMA_IRQHandler(haudio_in_sai.hdmarx);
+}
+
+/**
+  * @brief  This function handles DMA2 Stream 6 interrupt request.
+  * @param  None
+  * @retval None
+  */
+static void AUDIO_OUT_SAIx_DMAx_IRQHandler(void)
+{
+  HAL_DMA_IRQHandler(haudio_out_sai.hdmatx);
+}
 
 /**
   * @}