Skip to content

Commit

Permalink
Add wait for new samples loop in hello analog/pdm microphone examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepmistry committed Sep 29, 2021
1 parent 84e48c4 commit 00b8a25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/hello_analog_microphone/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ int main( void )
}

while (1) {
// wait for new samples
while (samples_read == 0) { tight_loop_contents(); }

// store and clear the samples read from the callback
int sample_count = samples_read;
samples_read = 0;
Expand Down
5 changes: 4 additions & 1 deletion examples/hello_pdm_microphone/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ int main( void )
}

while (1) {
// store and clear the samples read from the callback
// wait for new samples
while (samples_read == 0) { tight_loop_contents(); }

// store and clear the samples read from the callback
int sample_count = samples_read;
samples_read = 0;

Expand Down

0 comments on commit 00b8a25

Please sign in to comment.