23 #include "picovoice.h"
25 #define PV_AUDIO_REC_AUDIO_FREQUENCY (16000U)
26 #define PV_AUDIO_REC_CHANNEL_NUMBER (1)
27 #define PV_AUDIO_REC_RECORD_BUFFER_SIZE (512)
28 #define DECIMATION_RATE (96u)
29 #define AUDIO_SYS_CLOCK_HZ (24576000u)
30 #define PDM_DATA (P10_5)
31 #define PDM_CLK (P10_4)
43 .mode = CYHAL_PDM_PCM_MODE_LEFT,
63 result = cyhal_clock_get(&
pll_clock, &CYHAL_CLOCK_PLL[1]);
65 if (result == CY_RSLT_SUCCESS) {
69 if (result == CY_RSLT_SUCCESS) {
73 if (result == CY_RSLT_SUCCESS) {
74 result = cyhal_clock_set_enabled(&
pll_clock,
true,
true);
77 if (result == CY_RSLT_SUCCESS) {
78 result = cyhal_clock_get(&
audio_clock, &CYHAL_CLOCK_HF[1]);
81 if (result == CY_RSLT_SUCCESS) {
85 if (result == CY_RSLT_SUCCESS) {
89 if (result == CY_RSLT_SUCCESS) {
90 result = cyhal_clock_set_enabled(&
audio_clock,
true,
true);
99 if (result != CY_RSLT_SUCCESS) {
104 if (result != CY_RSLT_SUCCESS) {
109 cyhal_pdm_pcm_enable_event(&
pdm_pcm, CYHAL_PDM_PCM_ASYNC_COMPLETE, CYHAL_ISR_PRIORITY_DEFAULT,
true);
142 sum += (int64_t) pcm_buffer[i] * (int64_t) pcm_buffer[i];