Skip to content

Commit fe5529a

Browse files
committed
define TARGET_BUFFER_LENGTH
it can be set to -1 for some reason this would mean that by the time core0 is ready to put data on the buffer, there is exactly no data on the buffer
1 parent 4c0f529 commit fe5529a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

i2s/audio_i2s.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ bufring2=bufring1;
5353
cpu_freq = freq;
5454
}
5555

56+
// minimum target without popping: -1 (?)
57+
#define TARGET_BUFFER_LENGTH 0
58+
5659
//uint32_t buflends[8192];
5760
void audioi2sconstuff2() {
58-
uint32_t divider = (cpu_freq * 2 / 48000) - ((bufring2->len - 16)/2);
61+
uint32_t divider = (cpu_freq * 2 / 48000) - ((bufring2->len - TARGET_BUFFER_LENGTH) / 2);
5962
// buflends[bufring2->index1] = divider;
6063
pio_sm_set_clkdiv_int_frac(audio_pio, shared_state.pio_sm, divider >> 8u, divider & 0xffu);
6164
}

0 commit comments

Comments
 (0)