diff options
| author | huntc <[email protected]> | 2021-10-18 12:23:13 +1100 |
|---|---|---|
| committer | huntc <[email protected]> | 2021-10-18 12:23:13 +1100 |
| commit | 8dcc41c7f04ebcb6246d3f4f3c672d7b947ab82d (patch) | |
| tree | 0b59f52cbffcd7a4c1d0e1e816539d17c81cb126 | |
| parent | a5c11b1a80bd8a20b88a4f8c083c80111ec49b84 (diff) | |
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.
| -rw-r--r-- | embassy-nrf/src/saadc.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs index 8bf4f7276..d9b766420 100644 --- a/embassy-nrf/src/saadc.rs +++ b/embassy-nrf/src/saadc.rs | |||
| @@ -320,7 +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]) |
| 324 | == SamplerState::Sampled | 324 | == SamplerState::Sampled |
| 325 | { | 325 | { |
| 326 | let next_buffer = 1 - current_buffer; | 326 | let next_buffer = 1 - current_buffer; |
