Optimises the buffer passing for nRF SAADC

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.
This commit is contained in:
huntc 2021-10-18 12:23:13 +11:00
parent a5c11b1a80
commit 8dcc41c7f0

View file

@ -320,7 +320,7 @@ impl<'d, const N: usize> Saadc<'d, N> {
r.events_end.reset(); r.events_end.reset();
r.intenset.write(|w| w.end().set()); r.intenset.write(|w| w.end().set());
if sampler(&bufs[current_buffer][0..r.result.amount.read().bits() as usize / N]) if sampler(&bufs[current_buffer])
== SamplerState::Sampled == SamplerState::Sampled
{ {
let next_buffer = 1 - current_buffer; let next_buffer = 1 - current_buffer;