ST / BSP_DISCO_H747I

Dependents:   DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo

Files at this revision

API Documentation at this revision

Comitter:
Jerome Coutant
Date:
Wed Sep 25 17:50:02 2019 +0200
Parent:
0:146cf26a9bbb
Child:
2:53134782cc12
Commit message:
Update to remove PDM

Changed in this revision

STM32H747I-Discovery/STM32H747I-Discovery_BSP_User_Manual.chm Show diff for this revision Revisions of this file
STM32H747I-Discovery/pdm2pcm_glo.h Show diff for this revision Revisions of this file
STM32H747I-Discovery/stm32h747i_discovery_audio.c Show annotated file Show diff for this revision Revisions of this file
STM32H747I-Discovery/stm32h747i_discovery_audio.h Show annotated file Show diff for this revision Revisions of this file
Binary file STM32H747I-Discovery/STM32H747I-Discovery_BSP_User_Manual.chm has changed
--- a/STM32H747I-Discovery/pdm2pcm_glo.h	Wed Sep 25 13:37:39 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    pdm2pcm_glo.h
-  * @author  MCD Application Team
-  * @version V3.0.0
-  * @date    28-February-2017
-  * @brief   Global header for PDM2PCM conversion code
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
-  *
-  * Licensed under MCD-ST Image SW License Agreement V2, (the "License");
-  * You may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at:
-  *
-  *        http://www.st.com/software_license_agreement_image_v2
-  *
-  * Unless required by applicable law or agreed to in writing, software 
-  * distributed under the License is distributed on an "AS IS" BASIS, 
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *
-  *
-  ******************************************************************************
-  */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __PDM2PCM_FILTER_H
-#define __PDM2PCM_FILTER_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/* Includes ------------------------------------------------------------------*/
-#include <stdint.h>
-
-/* Exported constants --------------------------------------------------------*/
-#define PDM_FILTER_ENDIANNESS_LE     ((uint16_t)0x0000)
-#define PDM_FILTER_ENDIANNESS_BE     ((uint16_t)0x0001)
-
-#define PDM_FILTER_BIT_ORDER_LSB     ((uint16_t)0x0000)
-#define PDM_FILTER_BIT_ORDER_MSB     ((uint16_t)0x0001)
-
-#define PDM_FILTER_DEC_FACTOR_48     ((uint16_t)0x0001)
-#define PDM_FILTER_DEC_FACTOR_64     ((uint16_t)0x0002)
-#define PDM_FILTER_DEC_FACTOR_80     ((uint16_t)0x0003)
-#define PDM_FILTER_DEC_FACTOR_128    ((uint16_t)0x0004)
-#define PDM_FILTER_DEC_FACTOR_16     ((uint16_t)0x0005)
-#define PDM_FILTER_DEC_FACTOR_24     ((uint16_t)0x0006)
-#define PDM_FILTER_DEC_FACTOR_32     ((uint16_t)0x0007)
-
-#define PDM_FILTER_INIT_ERROR           ((uint16_t)0x0010)
-#define PDM_FILTER_CONFIG_ERROR         ((uint16_t)0x0020)
-#define PDM_FILTER_ENDIANNESS_ERROR     ((uint16_t)0x0001)
-#define PDM_FILTER_BIT_ORDER_ERROR      ((uint16_t)0x0002)
-#define PDM_FILTER_CRC_LOCK_ERROR       ((uint16_t)0x0004)
-#define PDM_FILTER_DECIMATION_ERROR     ((uint16_t)0x0008)
-#define PDM_FILTER_GAIN_ERROR           ((uint16_t)0x0040)
-#define PDM_FILTER_SAMPLES_NUMBER_ERROR ((uint16_t)0x0080)
-#define PDM2PCM_INTERNAL_MEMORY_SIZE 16
-
-/* Exported types ------------------------------------------------------------*/
-typedef struct{
-  uint16_t bit_order;
-  uint16_t endianness;
-  uint32_t high_pass_tap;
-  uint16_t in_ptr_channels;
-  uint16_t out_ptr_channels;
-  uint32_t pInternalMemory[PDM2PCM_INTERNAL_MEMORY_SIZE];
-}PDM_Filter_Handler_t;
-
-typedef struct{
-  uint16_t decimation_factor;
-  uint16_t output_samples_number;
-  int16_t  mic_gain;
-}PDM_Filter_Config_t;
-
-/* Exported macros -----------------------------------------------------------*/
-
-/* Exported functions ------------------------------------------------------- */
-uint32_t PDM_Filter_Init(PDM_Filter_Handler_t *pHandler);
-uint32_t PDM_Filter_setConfig(PDM_Filter_Handler_t *pHandler, PDM_Filter_Config_t *pConfig); 
-uint32_t PDM_Filter_getConfig(PDM_Filter_Handler_t *pHandler, PDM_Filter_Config_t *pConfig);
-uint32_t PDM_Filter_deInterleave(void *pDataIn, void *pDataOut, PDM_Filter_Handler_t * pHandler);
-uint32_t PDM_Filter(void *pDataIn, void *pDataOut, PDM_Filter_Handler_t *pHandler);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __PDM2PCM_FILTER_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
--- a/STM32H747I-Discovery/stm32h747i_discovery_audio.c	Wed Sep 25 13:37:39 2019 +0200
+++ b/STM32H747I-Discovery/stm32h747i_discovery_audio.c	Wed Sep 25 17:50:02 2019 +0200
@@ -115,6 +115,7 @@
   */
 /* Includes ------------------------------------------------------------------*/
 #include "stm32h747i_discovery_audio.h"
+#include "mbed_assert.h"
 
 /** @addtogroup BSP
   * @{
@@ -147,8 +148,8 @@
 __IO uint16_t                   AudioInVolume = DEFAULT_AUDIO_IN_VOLUME;
 
 /* PDM filters params */
-PDM_Filter_Handler_t  PDM_FilterHandler[2];
-PDM_Filter_Config_t   PDM_FilterConfig[2];
+// PDM_Filter_Handler_t  PDM_FilterHandler[2];
+// PDM_Filter_Config_t   PDM_FilterConfig[2];
 
 /**
   * @}
@@ -1106,6 +1107,7 @@
 uint8_t BSP_AUDIO_IN_PDMToPCM_Init(uint32_t AudioFreq, uint32_t ChnlNbrIn, uint32_t ChnlNbrOut)
 {
   uint32_t index = 0;
+  MBED_ASSERT(0);
 
   /* Enable CRC peripheral to unlock the PDM library */
   __HAL_RCC_CRC_CLK_ENABLE();
@@ -1113,18 +1115,18 @@
   for(index = 0; index < ChnlNbrIn; index++)
   {
     /* Init PDM filters */
-    PDM_FilterHandler[index].bit_order  = PDM_FILTER_BIT_ORDER_MSB;
-    PDM_FilterHandler[index].endianness = PDM_FILTER_ENDIANNESS_LE;
-    PDM_FilterHandler[index].high_pass_tap = 2122358088;
-    PDM_FilterHandler[index].out_ptr_channels = ChnlNbrOut;
-    PDM_FilterHandler[index].in_ptr_channels  = ChnlNbrIn;
-    PDM_Filter_Init((PDM_Filter_Handler_t *)(&PDM_FilterHandler[index]));
-
+    // PDM_FilterHandler[index].bit_order  = PDM_FILTER_BIT_ORDER_MSB;
+    // PDM_FilterHandler[index].endianness = PDM_FILTER_ENDIANNESS_LE;
+    // PDM_FilterHandler[index].high_pass_tap = 2122358088;
+    // PDM_FilterHandler[index].out_ptr_channels = ChnlNbrOut;
+    // PDM_FilterHandler[index].in_ptr_channels  = ChnlNbrIn;
+    // PDM_Filter_Init((PDM_Filter_Handler_t *)(&PDM_FilterHandler[index]));
+    
     /* PDM lib config phase */
-    PDM_FilterConfig[index].output_samples_number = AudioFreq/1000;
-    PDM_FilterConfig[index].mic_gain = 24;
-    PDM_FilterConfig[index].decimation_factor = PDM_FILTER_DEC_FACTOR_64;
-    PDM_Filter_setConfig((PDM_Filter_Handler_t *)&PDM_FilterHandler[index], &PDM_FilterConfig[index]);
+    // PDM_FilterConfig[index].output_samples_number = AudioFreq/1000;
+    // PDM_FilterConfig[index].mic_gain = 24;
+    // PDM_FilterConfig[index].decimation_factor = PDM_FILTER_DEC_FACTOR_64;
+    // PDM_Filter_setConfig((PDM_Filter_Handler_t *)&PDM_FilterHandler[index], &PDM_FilterConfig[index]);
   }
 
   return AUDIO_OK;
@@ -1141,10 +1143,11 @@
 uint8_t BSP_AUDIO_IN_PDMToPCM(uint16_t *PDMBuf, uint16_t *PCMBuf)
 {
   uint32_t index = 0;
+  MBED_ASSERT(0);
 
   for(index = 0; index < hAudioIn.ChannelNbr; index++)
   {
-    PDM_Filter(&((uint8_t*)(PDMBuf))[index], (uint16_t*)&(PCMBuf[index]), &PDM_FilterHandler[index]);
+    // PDM_Filter(&((uint8_t*)(PDMBuf))[index], (uint16_t*)&(PCMBuf[index]), &PDM_FilterHandler[index]);
   }
 
   return AUDIO_OK;
--- a/STM32H747I-Discovery/stm32h747i_discovery_audio.h	Wed Sep 25 13:37:39 2019 +0200
+++ b/STM32H747I-Discovery/stm32h747i_discovery_audio.h	Wed Sep 25 17:50:02 2019 +0200
@@ -32,7 +32,7 @@
 #include "stm32h747i_discovery.h"
 #include <stdlib.h>
 /* Include PDM to PCM lib header file */
-#include "pdm2pcm_glo.h"
+// include "pdm2pcm_glo.h" // MBED
 
 /** @addtogroup BSP
   * @{