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> { /// [`teardown_adc`]: #method.teardown_adc /// [`start`]: #method.start pub async fn read_exact(&mut self, measurements: &mut [u16; N]) -> Result { + assert_eq!( + self.ring_buf.capacity() / 2, + N, + "Buffer size must be half the size of the ring buffer" + ); + let r = T::regs(); // Start background receive if it was not already started