Skip to content

Commit

Permalink
Forgot to reset ADMUX
Browse files Browse the repository at this point in the history
Also reset ADMUX register to original after recording

#196
  • Loading branch information
TMRh20 committed Sep 29, 2023
1 parent c490ed9 commit 2eaa335
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions TMRpcm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,7 @@ void TMRpcm::startRecording(const char *fileName, unsigned int SAMPLE_RATE, byte

adcsra = ADCSRA;
adcsrb = ADCSRB;
admux = ADMUX;
recording = passThrough + 1;
setPin();
if(recording < 3){
Expand Down Expand Up @@ -1848,6 +1849,7 @@ void TMRpcm::stopRecording(const char *fileName){
*TIMSK[tt] &= ~(_BV(OCIE1B) | _BV(OCIE1A));
ADCSRA = adcsra;
ADCSRB = adcsrb;
ADMUX = admux;

if(recording == 1 || recording == 2){
recording = 0;
Expand Down
1 change: 1 addition & 0 deletions TMRpcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class TMRpcm
#if defined (ENABLE_RECORDING)
uint8_t adcsra;
uint8_t adcsrb;
uint8_t admux;
#endif

};
Expand Down

0 comments on commit 2eaa335

Please sign in to comment.