Removed the Mode enum and factored out into two functions so that we can assert channel limits
This commit is contained in:
parent
a020b1a404
commit
cb56f52b99
2 changed files with 55 additions and 22 deletions
examples/nrf/src/bin
|
@ -7,7 +7,7 @@ mod example_common;
|
|||
use defmt::panic;
|
||||
use embassy::executor::Spawner;
|
||||
use embassy_nrf::ppi::Ppi;
|
||||
use embassy_nrf::saadc::{ChannelConfig, Config, Mode, Saadc, SamplerState};
|
||||
use embassy_nrf::saadc::{ChannelConfig, Config, Saadc, SamplerState};
|
||||
use embassy_nrf::timer::{Frequency, Timer};
|
||||
use embassy_nrf::{interrupt, Peripherals};
|
||||
use example_common::*;
|
||||
|
@ -45,7 +45,7 @@ async fn main(_spawner: Spawner, mut p: Peripherals) {
|
|||
let mut a: i32 = 0;
|
||||
|
||||
saadc
|
||||
.run_sampler(&mut bufs, Mode::Task, move |buf| {
|
||||
.run_task_sampler(&mut bufs, move |buf| {
|
||||
for (i, b) in buf.iter().enumerate() {
|
||||
if i % 3 == 0 {
|
||||
a += *b as i32;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue