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 <huntchr@gmail.com>
This commit is contained in:
bors[bot] 2021-10-18 01:31:45 +00:00 committed by GitHub
commit b22c472af3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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