From 686c3c87aa49101969329e78bc7b564533f5df7f Mon Sep 17 00:00:00 2001 From: TMRh20 Date: Sun, 17 Dec 2023 05:52:37 -0600 Subject: [PATCH] Timing Update - Adjust timing so PWM playback is slightly slower than PDM recording to prevent popping/clicking sounds on playback --- src/NRF52840/AutoAnalogAudio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NRF52840/AutoAnalogAudio.cpp b/src/NRF52840/AutoAnalogAudio.cpp index 9b8828b..577b89e 100644 --- a/src/NRF52840/AutoAnalogAudio.cpp +++ b/src/NRF52840/AutoAnalogAudio.cpp @@ -191,7 +191,7 @@ void AutoAnalog::begin(bool enADC, bool enDAC){ NRF_PWM0->ENABLE = (PWM_ENABLE_ENABLE_Enabled << PWM_ENABLE_ENABLE_Pos); NRF_PWM0->MODE = (PWM_MODE_UPDOWN_Up << PWM_MODE_UPDOWN_Pos); NRF_PWM0->PRESCALER = (PWM_PRESCALER_PRESCALER_DIV_1 << PWM_PRESCALER_PRESCALER_Pos); - NRF_PWM0->COUNTERTOP = (1000 << PWM_COUNTERTOP_COUNTERTOP_Pos); //1 msec + NRF_PWM0->COUNTERTOP = (1003 << PWM_COUNTERTOP_COUNTERTOP_Pos); //1 msec NRF_PWM0->LOOP = (1 << PWM_LOOP_CNT_Pos); NRF_PWM0->DECODER = (PWM_DECODER_LOAD_Common << PWM_DECODER_LOAD_Pos) | (PWM_DECODER_MODE_RefreshCount << PWM_DECODER_MODE_Pos); NRF_PWM0->SEQ[0].PTR = ((uint32_t)(&dacBuf0[0]) << PWM_SEQ_PTR_PTR_Pos);