We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a037491 + 4620323 commit 95dbb18Copy full SHA for 95dbb18
ports/raspberrypi/common-hal/analogbufio/BufferedIn.c
@@ -53,7 +53,9 @@ void common_hal_analogbufio_bufferedin_construct(analogbufio_bufferedin_obj_t *s
53
// sample rate determines divisor, not zero.
54
55
// sample_rate is forced to be >= 1 in shared-bindings
56
- float clk_div = (float)ADC_CLOCK_INPUT / (float)sample_rate;
+ // 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.
58
+ float clk_div = (float)ADC_CLOCK_INPUT / (float)sample_rate - 1;
59
adc_set_clkdiv(clk_div);
60
61
// Set up the DMA to start transferring data as soon as it appears in FIFO
0 commit comments