aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-10-18 01:31:45 +0000
committerGitHub <[email protected]>2021-10-18 01:31:45 +0000
commitb22c472af3a7e88c2855e6de216dcfa15ff155d1 (patch)
tree238a4b5a4da4720dcc3294f687ff4b07d0b1c5da
parenta5c11b1a80bd8a20b88a4f8c083c80111ec49b84 (diff)
parent3f31774674686bcd6c99a3d0443e9cf517dc0e82 (diff)
Merge #435
435: Optimises the buffer passing for nRF SAADC r=huntc a=huntc The buffer will always have been filled and we never explicitly stop the task outside of this code. Thus, we can assume the number of bytes in the slice. Co-authored-by: huntc <[email protected]>
-rw-r--r--embassy-nrf/src/saadc.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs
index 8bf4f7276..215f968a7 100644
--- a/embassy-nrf/src/saadc.rs
+++ b/embassy-nrf/src/saadc.rs
@@ -320,9 +320,7 @@ impl<'d, const N: usize> Saadc<'d, N> {
320 r.events_end.reset(); 320 r.events_end.reset();
321 r.intenset.write(|w| w.end().set()); 321 r.intenset.write(|w| w.end().set());
322 322
323 if sampler(&bufs[current_buffer][0..r.result.amount.read().bits() as usize / N]) 323 if sampler(&bufs[current_buffer]) == SamplerState::Sampled {
324 == SamplerState::Sampled
325 {
326 let next_buffer = 1 - current_buffer; 324 let next_buffer = 1 - current_buffer;
327 current_buffer = next_buffer; 325 current_buffer = next_buffer;
328 r.tasks_start.write(|w| unsafe { w.bits(1) }); 326 r.tasks_start.write(|w| unsafe { w.bits(1) });