pdm2pcm.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * File Name : pdm2pcm.c
  5. * Description : This file provides code for the configuration
  6. * of the pdm2pcm instances.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  11. * All rights reserved.</center></h2>
  12. *
  13. * This software component is licensed by ST under Ultimate Liberty license
  14. * SLA0044, the "License"; You may not use this file except in compliance with
  15. * the License. You may obtain a copy of the License at:
  16. * www.st.com/SLA0044
  17. *
  18. ******************************************************************************
  19. */
  20. /* USER CODE END Header */
  21. /* Includes ------------------------------------------------------------------*/
  22. #include "pdm2pcm.h"
  23. /* USER CODE BEGIN 0 */
  24. /* USER CODE END 0 */
  25. /* Global variables ---------------------------------------------------------*/
  26. PDM_Filter_Handler_t PDM1_filter_handler;
  27. PDM_Filter_Config_t PDM1_filter_config;
  28. /* USER CODE BEGIN 1 */
  29. /* USER CODE END 1 */
  30. /* PDM2PCM init function */
  31. void MX_PDM2PCM_Init(void)
  32. {
  33. /* USER CODE BEGIN 2 */
  34. /* USER CODE END 2 */
  35. /**
  36. */
  37. PDM1_filter_handler.bit_order = PDM_FILTER_BIT_ORDER_LSB;
  38. PDM1_filter_handler.endianness = PDM_FILTER_ENDIANNESS_BE;
  39. PDM1_filter_handler.high_pass_tap = 2104533974;
  40. PDM1_filter_handler.in_ptr_channels = 2;
  41. PDM1_filter_handler.out_ptr_channels = 2;
  42. PDM_Filter_Init(&PDM1_filter_handler);
  43. PDM1_filter_config.decimation_factor = PDM_FILTER_DEC_FACTOR_64;
  44. PDM1_filter_config.output_samples_number = 16;
  45. PDM1_filter_config.mic_gain = 0;
  46. PDM_Filter_setConfig(&PDM1_filter_handler, &PDM1_filter_config);
  47. /* USER CODE BEGIN 3 */
  48. /* USER CODE END 3 */
  49. }
  50. /* USER CODE BEGIN 4 */
  51. /* process function */
  52. uint8_t MX_PDM2PCM_Process(uint16_t *PDMBuf, uint16_t *PCMBuf)
  53. {
  54. /*
  55. uint8_t BSP_AUDIO_IN_PDMToPCM(uint16_t * PDMBuf, uint16_t * PCMBuf)
  56. Converts audio format from PDM to PCM.
  57. Parameters:
  58. PDMBuf : Pointer to PDM buffer data
  59. PCMBuf : Pointer to PCM buffer data
  60. Return values:
  61. AUDIO_OK in case of success, AUDIO_ERROR otherwise
  62. */
  63. /* this example return the default status AUDIO_ERROR */
  64. return (uint8_t) 1;
  65. }
  66. /* USER CODE END 4 */
  67. /**
  68. * @}
  69. */
  70. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/