Skip to content

Commit 00b8a25

Browse files
committed
Add wait for new samples loop in hello analog/pdm microphone examples
1 parent 84e48c4 commit 00b8a25

File tree

2 files changed

+7
-1
lines changed
  • examples

2 files changed

+7
-1
lines changed

examples/hello_analog_microphone/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ int main( void )
6868
}
6969

7070
while (1) {
71+
// wait for new samples
72+
while (samples_read == 0) { tight_loop_contents(); }
73+
7174
// store and clear the samples read from the callback
7275
int sample_count = samples_read;
7376
samples_read = 0;

examples/hello_pdm_microphone/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ int main( void )
7474
}
7575

7676
while (1) {
77-
// store and clear the samples read from the callback
77+
// wait for new samples
78+
while (samples_read == 0) { tight_loop_contents(); }
79+
80+
// store and clear the samples read from the callback
7881
int sample_count = samples_read;
7982
samples_read = 0;
8083

0 commit comments

Comments
 (0)