diff options
| -rw-r--r-- | embassy-stm32/src/adc/ringbuffered_v2.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/embassy-stm32/src/adc/ringbuffered_v2.rs b/embassy-stm32/src/adc/ringbuffered_v2.rs index 82b67c533..3f5277a9d 100644 --- a/embassy-stm32/src/adc/ringbuffered_v2.rs +++ b/embassy-stm32/src/adc/ringbuffered_v2.rs | |||
| @@ -408,6 +408,12 @@ impl<'d, T: Instance> RingBufferedAdc<'d, T> { | |||
| 408 | /// [`teardown_adc`]: #method.teardown_adc | 408 | /// [`teardown_adc`]: #method.teardown_adc |
| 409 | /// [`start`]: #method.start | 409 | /// [`start`]: #method.start |
| 410 | pub async fn read_exact<const N: usize>(&mut self, measurements: &mut [u16; N]) -> Result<usize, OverrunError> { | 410 | pub async fn read_exact<const N: usize>(&mut self, measurements: &mut [u16; N]) -> Result<usize, OverrunError> { |
| 411 | assert_eq!( | ||
| 412 | self.ring_buf.capacity() / 2, | ||
| 413 | N, | ||
| 414 | "Buffer size must be half the size of the ring buffer" | ||
| 415 | ); | ||
| 416 | |||
| 411 | let r = T::regs(); | 417 | let r = T::regs(); |
| 412 | 418 | ||
| 413 | // Start background receive if it was not already started | 419 | // Start background receive if it was not already started |
