Skip to content

Commit

Permalink
Added a hook to manually deactivate the microphone when we deep sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnVidler committed Sep 18, 2023
1 parent 3d10777 commit 0c22efe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions inc/MicroBitAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ 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
5 changes: 5 additions & 0 deletions source/MicroBitAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ MicroBitAudio::~MicroBitAudio()
}
}

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


int MicroBitAudio::setSleep(bool doSleep)
{
Expand Down

0 comments on commit 0c22efe

Please sign in to comment.