diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/nrf/src/bin/ppi.rs | 22 | ||||
| -rw-r--r-- | examples/nrf/src/bin/saadc_continuous.rs | 4 |
2 files changed, 10 insertions, 16 deletions
diff --git a/examples/nrf/src/bin/ppi.rs b/examples/nrf/src/bin/ppi.rs index 6ea03ebd0..99246eeda 100644 --- a/examples/nrf/src/bin/ppi.rs +++ b/examples/nrf/src/bin/ppi.rs | |||
| @@ -51,25 +51,21 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 51 | OutputChannelPolarity::Toggle, | 51 | OutputChannelPolarity::Toggle, |
| 52 | ); | 52 | ); |
| 53 | 53 | ||
| 54 | let mut ppi = Ppi::new(p.PPI_CH0); | 54 | let mut ppi = Ppi::new_one_to_one(p.PPI_CH0, button1.event_in(), led1.task_out()); |
| 55 | ppi.set_event(button1.event_in()); | ||
| 56 | ppi.set_task(led1.task_out()); | ||
| 57 | ppi.enable(); | 55 | ppi.enable(); |
| 58 | 56 | ||
| 59 | let mut ppi = Ppi::new(p.PPI_CH1); | 57 | let mut ppi = Ppi::new_one_to_one(p.PPI_CH1, button2.event_in(), led1.task_clr()); |
| 60 | ppi.set_event(button2.event_in()); | ||
| 61 | ppi.set_task(led1.task_clr()); | ||
| 62 | ppi.enable(); | 58 | ppi.enable(); |
| 63 | 59 | ||
| 64 | let mut ppi = Ppi::new(p.PPI_CH2); | 60 | let mut ppi = Ppi::new_one_to_one(p.PPI_CH2, button3.event_in(), led1.task_set()); |
| 65 | ppi.set_event(button3.event_in()); | ||
| 66 | ppi.set_task(led1.task_set()); | ||
| 67 | ppi.enable(); | 61 | ppi.enable(); |
| 68 | 62 | ||
| 69 | let mut ppi = Ppi::new(p.PPI_CH3); | 63 | let mut ppi = Ppi::new_one_to_two( |
| 70 | ppi.set_event(button4.event_in()); | 64 | p.PPI_CH3, |
| 71 | ppi.set_task(led1.task_out()); | 65 | button4.event_in(), |
| 72 | ppi.set_fork_task(led2.task_out()); | 66 | led1.task_out(), |
| 67 | led2.task_out(), | ||
| 68 | ); | ||
| 73 | ppi.enable(); | 69 | ppi.enable(); |
| 74 | 70 | ||
| 75 | info!("PPI setup!"); | 71 | info!("PPI setup!"); |
diff --git a/examples/nrf/src/bin/saadc_continuous.rs b/examples/nrf/src/bin/saadc_continuous.rs index 149b9c60c..a06a01e91 100644 --- a/examples/nrf/src/bin/saadc_continuous.rs +++ b/examples/nrf/src/bin/saadc_continuous.rs | |||
| @@ -32,9 +32,7 @@ async fn main(_spawner: Spawner, mut p: Peripherals) { | |||
| 32 | timer.cc(0).write(100); // We want to sample at 10KHz | 32 | timer.cc(0).write(100); // We want to sample at 10KHz |
| 33 | timer.cc(0).short_compare_clear(); | 33 | timer.cc(0).short_compare_clear(); |
| 34 | 34 | ||
| 35 | let mut ppi = Ppi::new(p.PPI_CH0); | 35 | let mut ppi = Ppi::new_one_to_one(p.PPI_CH0, timer.cc(0).event_compare(), saadc.task_sample()); |
| 36 | ppi.set_event(timer.cc(0).event_compare()); | ||
| 37 | ppi.set_task(saadc.task_sample()); | ||
| 38 | ppi.enable(); | 36 | ppi.enable(); |
| 39 | 37 | ||
| 40 | timer.start(); | 38 | timer.start(); |
