Skip to content

Commit

Permalink
Timing Update
Browse files Browse the repository at this point in the history
- Adjust timing so PWM playback is slightly slower than PDM recording to prevent popping/clicking sounds on playback
  • Loading branch information
TMRh20 committed Dec 17, 2023
1 parent 31cf09e commit 686c3c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/NRF52840/AutoAnalogAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 686c3c8

Please sign in to comment.