Patched for Audio example - Add status check when DFSDM's filter and channel de-init.

Dependents:   DISCO_F413ZH-AUDIO-demo

The base repository is https://os.mbed.com/teams/ST/code/BSP_DISCO_F413ZH/. I've just added workaround patch for Audio-in demo on DISCO_F413ZH board(Microphone U16, U17)

Files at this revision

API Documentation at this revision

Comitter:
Daniel_Lee
Date:
Fri Jan 31 07:17:05 2020 +0000
Parent:
3:42b354f5069c
Commit message:
Patched for Audio example;

Changed in this revision

Drivers/BSP/STM32F413H-Discovery/stm32f413h_discovery_audio.c Show annotated file Show diff for this revision Revisions of this file
diff -r 42b354f5069c -r c051317d4051 Drivers/BSP/STM32F413H-Discovery/stm32f413h_discovery_audio.c
--- a/Drivers/BSP/STM32F413H-Discovery/stm32f413h_discovery_audio.c	Wed Feb 28 14:35:04 2018 +0100
+++ b/Drivers/BSP/STM32F413H-Discovery/stm32f413h_discovery_audio.c	Fri Jan 31 07:17:05 2020 +0000
@@ -953,7 +953,17 @@
   
     mic_init[mic_num] = 1;
   
-    HAL_DFSDM_FilterDeInit(&hAudioInDfsdmFilter[mic_num]);
+    /* Filter **********************************************************************************************************/
+    if(hAudioInDfsdmFilter[mic_num].Instance != NULL)
+	{
+	  if(HAL_OK != HAL_DFSDM_FilterDeInit(&hAudioInDfsdmFilter[mic_num]))
+	  {
+        return AUDIO_ERROR;
+	  } 
+	  /* MIC filters  initialization */
+	  __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(&hAudioInDfsdmFilter[mic_num]); 
+	}
+	
     /* MIC filters  initialization */
     __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(&hAudioInDfsdmFilter[mic_num]); 
     hAudioInDfsdmFilter[mic_num].Instance                          = FilterInstnace[mic_num]; 
@@ -974,7 +984,18 @@
       return AUDIO_ERROR;
     }
 
-    HAL_DFSDM_ChannelDeInit(&hAudioInDfsdmChannel[mic_num]);
+	/* Channel **********************************************************************************************************/
+    if(hAudioInDfsdmChannel[mic_num].Instance != NULL)
+    {
+      if(HAL_OK != HAL_DFSDM_ChannelDeInit(&hAudioInDfsdmChannel[mic_num]))
+      {
+        return AUDIO_ERROR;
+      }
+	  
+	  /* MIC channels initialization */
+	  __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(&hAudioInDfsdmChannel[mic_num]);   
+    }
+    
     /* MIC channels initialization */
     __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(&hAudioInDfsdmChannel[mic_num]);   
     hAudioInDfsdmChannel[mic_num].Init.OutputClock.Activation   = ENABLE;