extern
porcupine
demo
mcu
stm32h735
stm32h735g-dk
PDM2PCM
App
pdm2pcm.c
Go to the documentation of this file.
1
/* USER CODE BEGIN Header */
20
/* USER CODE END Header */
21
22
/* Includes ------------------------------------------------------------------*/
23
#include "
pdm2pcm.h
"
24
25
/* USER CODE BEGIN 0 */
26
/* USER CODE END 0 */
27
28
/* Global variables ---------------------------------------------------------*/
29
PDM_Filter_Handler_t
PDM1_filter_handler
;
30
PDM_Filter_Config_t
PDM1_filter_config
;
31
32
/* USER CODE BEGIN 1 */
33
/* USER CODE END 1 */
34
35
/* PDM2PCM init function */
36
void
MX_PDM2PCM_Init
(
void
)
37
{
38
/* USER CODE BEGIN 2 */
39
/* USER CODE END 2 */
40
43
PDM1_filter_handler
.bit_order = PDM_FILTER_BIT_ORDER_MSB;
44
PDM1_filter_handler
.endianness = PDM_FILTER_ENDIANNESS_LE;
45
PDM1_filter_handler
.high_pass_tap = 2104533974;
46
PDM1_filter_handler
.in_ptr_channels = 1;
47
PDM1_filter_handler
.out_ptr_channels = 1;
48
PDM_Filter_Init(&
PDM1_filter_handler
);
49
50
PDM1_filter_config
.decimation_factor = PDM_FILTER_DEC_FACTOR_128;
51
PDM1_filter_config
.output_samples_number = 240;
52
PDM1_filter_config
.mic_gain = 24;
53
PDM_Filter_setConfig(&
PDM1_filter_handler
, &
PDM1_filter_config
);
54
55
/* USER CODE BEGIN 3 */
56
/* USER CODE END 3 */
57
58
}
59
60
/* USER CODE BEGIN 4 */
61
62
/* process function */
63
uint8_t
MX_PDM2PCM_Process
(uint16_t *PDMBuf, uint16_t *PCMBuf)
64
{
65
/*
66
uint8_t BSP_AUDIO_IN_PDMToPCM(uint16_t * PDMBuf, uint16_t * PCMBuf)
67
68
Converts audio format from PDM to PCM.
69
Parameters:
70
PDMBuf : Pointer to PDM buffer data
71
PCMBuf : Pointer to PCM buffer data
72
Return values:
73
AUDIO_OK in case of success, AUDIO_ERROR otherwise
74
*/
75
/* this example return the default status AUDIO_ERROR */
76
PDM_Filter((
void
*)PDMBuf, (
void
*)PCMBuf, &
PDM1_filter_handler
);
77
return
(uint8_t) 0;
78
79
}
80
81
/* USER CODE END 4 */
82
87
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
MX_PDM2PCM_Process
uint8_t MX_PDM2PCM_Process(uint16_t *PDMBuf, uint16_t *PCMBuf)
Definition:
pdm2pcm.c:63
pdm2pcm.h
PDM1_filter_handler
PDM_Filter_Handler_t PDM1_filter_handler
Definition:
pdm2pcm.c:29
MX_PDM2PCM_Init
void MX_PDM2PCM_Init(void)
Definition:
pdm2pcm.c:36
PDM1_filter_config
PDM_Filter_Config_t PDM1_filter_config
Definition:
pdm2pcm.c:30
picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:50