Skip to content

Commit

Permalink
Fix for the microphone failing to wake after a sleep event
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnVidler committed Nov 1, 2023
1 parent 1370026 commit 9e6f027
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
5 changes: 0 additions & 5 deletions inc/MicroBitAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,6 @@ namespace codal
*/
bool isPinEnabled();

/**
* Hook deep sleep events so we can manually turn off/on the microphone power pin.
*/
int deepSleepCallback( deepSleepCallbackReason reason, deepSleepCallbackData *data);

/**
* Puts the component in (or out of) sleep (low power) mode.
*/
Expand Down
8 changes: 2 additions & 6 deletions source/MicroBitAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,6 @@ MicroBitAudio::~MicroBitAudio()
}
}

int MicroBitAudio::deepSleepCallback( deepSleepCallbackReason reason, deepSleepCallbackData *data)
{
deactivateMic();
}


int MicroBitAudio::setSleep(bool doSleep)
{
if (doSleep)
Expand All @@ -244,6 +238,7 @@ int MicroBitAudio::setSleep(bool doSleep)
delete pwm;
pwm = NULL;
}
deactivateMic();
}
else
{
Expand All @@ -252,6 +247,7 @@ int MicroBitAudio::setSleep(bool doSleep)
status &= ~MICROBIT_AUDIO_STATUS_DEEPSLEEP;
enable();
}
activateMic();
}

return DEVICE_OK;
Expand Down

0 comments on commit 9e6f027

Please sign in to comment.