Skip to content

Commit 4620323

Browse files
authored
Update ports/raspberrypi/common-hal/analogbufio/BufferedIn.c
1 parent 6eab2ec commit 4620323

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ports/raspberrypi/common-hal/analogbufio/BufferedIn.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ void common_hal_analogbufio_bufferedin_construct(analogbufio_bufferedin_obj_t *s
5353
// sample rate determines divisor, not zero.
5454

5555
// sample_rate is forced to be >= 1 in shared-bindings
56+
// Per the datasheet: "Setting DIV.INT to some positive value n will trigger the ADC once per n + 1 cycles."
57+
// So subtract 1. See PR #9396.
5658
float clk_div = (float)ADC_CLOCK_INPUT / (float)sample_rate - 1;
5759
adc_set_clkdiv(clk_div);
5860

0 commit comments

Comments
 (0)