aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-rp/src/adc.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs
index bac455743..5b913f156 100644
--- a/embassy-rp/src/adc.rs
+++ b/embassy-rp/src/adc.rs
@@ -213,6 +213,7 @@ impl<'d> Adc<'d, Async> {
213 ch: &mut Channel<'_>, 213 ch: &mut Channel<'_>,
214 buf: &mut [W], 214 buf: &mut [W],
215 fcs_err: bool, 215 fcs_err: bool,
216 div: u16,
216 dma: impl Peripheral<P = impl dma::Channel>, 217 dma: impl Peripheral<P = impl dma::Channel>,
217 ) -> Result<(), Error> { 218 ) -> Result<(), Error> {
218 let r = Self::regs(); 219 let r = Self::regs();
@@ -258,6 +259,7 @@ impl<'d> Adc<'d, Async> {
258 // start conversions and wait for dma to finish. we can't report errors early 259 // start conversions and wait for dma to finish. we can't report errors early
259 // because there's no interrupt to signal them, and inspecting every element 260 // because there's no interrupt to signal them, and inspecting every element
260 // of the fifo is too costly to do here. 261 // of the fifo is too costly to do here.
262 r.div().write_set(|w| w.set_int(div));
261 r.cs().write_set(|w| w.set_start_many(true)); 263 r.cs().write_set(|w| w.set_start_many(true));
262 dma.await; 264 dma.await;
263 mem::drop(auto_reset); 265 mem::drop(auto_reset);
@@ -275,9 +277,10 @@ impl<'d> Adc<'d, Async> {
275 &mut self, 277 &mut self,
276 ch: &mut Channel<'_>, 278 ch: &mut Channel<'_>,
277 buf: &mut [S], 279 buf: &mut [S],
280 div: u16,
278 dma: impl Peripheral<P = impl dma::Channel>, 281 dma: impl Peripheral<P = impl dma::Channel>,
279 ) -> Result<(), Error> { 282 ) -> Result<(), Error> {
280 self.read_many_inner(ch, buf, false, dma).await 283 self.read_many_inner(ch, buf, false, div, dma).await
281 } 284 }
282 285
283 #[inline] 286 #[inline]
@@ -285,11 +288,12 @@ impl<'d> Adc<'d, Async> {
285 &mut self, 288 &mut self,
286 ch: &mut Channel<'_>, 289 ch: &mut Channel<'_>,
287 buf: &mut [Sample], 290 buf: &mut [Sample],
291 div: u16,
288 dma: impl Peripheral<P = impl dma::Channel>, 292 dma: impl Peripheral<P = impl dma::Channel>,
289 ) { 293 ) {
290 // errors are reported in individual samples 294 // errors are reported in individual samples
291 let _ = self 295 let _ = self
292 .read_many_inner(ch, unsafe { mem::transmute::<_, &mut [u16]>(buf) }, true, dma) 296 .read_many_inner(ch, unsafe { mem::transmute::<_, &mut [u16]>(buf) }, true, div, dma)
293 .await; 297 .await;
294 } 298 }
295} 299}