diff --git a/inc/MicroBitAudio.h b/inc/MicroBitAudio.h index 0a0d70c3..0e56c2d4 100644 --- a/inc/MicroBitAudio.h +++ b/inc/MicroBitAudio.h @@ -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. */ diff --git a/source/MicroBitAudio.cpp b/source/MicroBitAudio.cpp index 93a22266..b5543846 100644 --- a/source/MicroBitAudio.cpp +++ b/source/MicroBitAudio.cpp @@ -224,12 +224,6 @@ MicroBitAudio::~MicroBitAudio() } } -int MicroBitAudio::deepSleepCallback( deepSleepCallbackReason reason, deepSleepCallbackData *data) -{ - deactivateMic(); -} - - int MicroBitAudio::setSleep(bool doSleep) { if (doSleep) @@ -244,6 +238,7 @@ int MicroBitAudio::setSleep(bool doSleep) delete pwm; pwm = NULL; } + deactivateMic(); } else { @@ -252,6 +247,7 @@ int MicroBitAudio::setSleep(bool doSleep) status &= ~MICROBIT_AUDIO_STATUS_DEEPSLEEP; enable(); } + activateMic(); } return DEVICE_OK;