Another redo using the feedback.

PPI is now split up into PPI and DPPI under the name 'interconnect'.
The tasks and events are tracked and reset in the drop function.
This commit is contained in:
Dion Dokter
2021-10-18 16:23:39 +02:00
committed by Dario Nieuwenhuis
parent e6ec81b999
commit 11655af034
20 changed files with 729 additions and 880 deletions

View File

@ -26,7 +26,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
let irq = interrupt::take!(UARTE0_UART0);
let mut state = State::new();
let u = unsafe {
unwrap!(BufferedUarte::new(
BufferedUarte::new(
&mut state,
p.UARTE0,
p.TIMER0,
@ -40,7 +40,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
config,
&mut rx_buffer,
&mut tx_buffer,
))
)
};
pin_mut!(u);

View File

@ -10,7 +10,7 @@ use core::future::pending;
use embassy::executor::Spawner;
use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull};
use embassy_nrf::gpiote::{self, InputChannel, InputChannelPolarity};
use embassy_nrf::ppi::Ppi;
use embassy_nrf::interconnect::Ppi;
use embassy_nrf::Peripherals;
use gpiote::{OutputChannel, OutputChannelPolarity};
@ -51,25 +51,21 @@ async fn main(_spawner: Spawner, p: Peripherals) {
OutputChannelPolarity::Toggle,
);
let mut ppi = Ppi::new(p.PPI_CH0);
ppi.publish(button1.event_in()).unwrap();
ppi.subscribe(led1.task_out()).unwrap();
let mut ppi = Ppi::new_one_to_one(p.PPI_CH0, button1.event_in(), led1.task_out());
ppi.enable();
let mut ppi = Ppi::new(p.PPI_CH1);
ppi.publish(button2.event_in()).unwrap();
ppi.subscribe(led1.task_clr()).unwrap();
let mut ppi = Ppi::new_one_to_one(p.PPI_CH1, button2.event_in(), led1.task_clr());
ppi.enable();
let mut ppi = Ppi::new(p.PPI_CH2);
ppi.publish(button3.event_in()).unwrap();
ppi.subscribe(led1.task_set()).unwrap();
let mut ppi = Ppi::new_one_to_one(p.PPI_CH2, button3.event_in(), led1.task_set());
ppi.enable();
let mut ppi = Ppi::new(p.PPI_CH3);
ppi.publish(button4.event_in()).unwrap();
ppi.subscribe(led1.task_out()).unwrap();
ppi.subscribe(led2.task_out()).unwrap();
let mut ppi = Ppi::new_one_to_two(
p.PPI_CH3,
button4.event_in(),
led1.task_out(),
led2.task_out(),
);
ppi.enable();
info!("PPI setup!");

View File

@ -21,9 +21,9 @@ async fn main(_spawner: Spawner, p: Peripherals) {
let irq = interrupt::take!(UARTE0_UART0);
let mut uart = unsafe {
unwrap!(uarte::UarteWithIdle::new(
uarte::UarteWithIdle::new(
p.UARTE0, p.TIMER0, p.PPI_CH0, p.PPI_CH1, irq, p.P0_08, p.P0_06, NoPin, NoPin, config,
))
)
};
info!("uarte initialized!");