Skip to content

Commit 86bb6db

Browse files
committed
raspberrypi: PDMIn: Fix sample rate calculation.
The sample rate needs to be mutiplied by oversampling, not by 32.
1 parent 4b7b098 commit 86bb6db

File tree

1 file changed

+1
-1
lines changed
  • ports/raspberrypi/common-hal/audiobusio

1 file changed

+1
-1
lines changed

ports/raspberrypi/common-hal/audiobusio/PDMIn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t *self,
4343
// Use the state machine to manage pins.
4444
common_hal_rp2pio_statemachine_construct(&self->state_machine,
4545
pdmin, MP_ARRAY_SIZE(pdmin),
46-
sample_rate * 32 * 2, // Frequency based on sample rate
46+
sample_rate * OVERSAMPLING * 2, // Frequency based on sample rate
4747
NULL, 0,
4848
NULL, 0, // may_exec
4949
NULL, 1, PIO_PINMASK32_NONE, PIO_PINMASK32_ALL, // out pin

0 commit comments

Comments
 (0)