diff --git a/Cargo.toml b/Cargo.toml index 013152be..d93d14f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ members = [ "examples/twi-ssd1306", "examples/ecb-demo", "examples/ccm-demo", + "examples/ppi-demo", ] [profile.dev] diff --git a/examples/ppi-demo/Cargo.toml b/examples/ppi-demo/Cargo.toml new file mode 100644 index 00000000..40cf35df --- /dev/null +++ b/examples/ppi-demo/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "ppi-demo" +version = "0.0.1" +edition = "2018" +authors = [ "Thales Fragoso "] + +[dependencies] +cortex-m = "0.6.2" +cortex-m-rt = "0.6.12" +rtt-target = {version = "0.2.0", features = ["cortex-m"] } + +nrf52810-hal = { path = "../../nrf52810-hal", features = ["rt"], optional = true } +nrf52832-hal = { path = "../../nrf52832-hal", features = ["rt"], optional = true } +nrf52840-hal = { path = "../../nrf52840-hal", features = ["rt"], optional = true } +nrf52833-hal = { path = "../../nrf52833-hal", features = ["rt"], optional = true } +nrf51-hal = { path = "../../nrf51-hal", features = ["rt"], optional = true} + +[[bin]] +name = "ppi-demo" +doc = false +test = false + +[features] +51 = ["nrf51-hal"] +52810 = ["nrf52810-hal"] +52832 = ["nrf52832-hal"] +52840 = ["nrf52840-hal"] +52833 = ["nrf52833-hal"] diff --git a/examples/ppi-demo/Embed.toml b/examples/ppi-demo/Embed.toml new file mode 100644 index 00000000..5da61018 --- /dev/null +++ b/examples/ppi-demo/Embed.toml @@ -0,0 +1,46 @@ +[probe] +# The index of the probe in the connected probe list. +# probe_index = 0 +# The protocol to be used for communicating with the target. +protocol = "Swd" +# The speed in kHz of the data link to the target. +# speed = 1337 + +[flashing] +# Whether or not the target should be flashed. +enabled = true +# Whether or not the target should be halted after flashing. +halt_afterwards = false +# Whether or not bytes erased but not rewritten with data from the ELF +# should be restored with their contents before erasing. +restore_unwritten_bytes = false +# The path where an SVG of the assembled flash layout should be written to. +# flash_layout_output_path = "out.svg" + +[general] +# The chip name of the chip to be debugged. +# chip = "nRF52832" +# A list of chip descriptions to be loaded during runtime. +chip_descriptions = [] +# The default log level to be used. +log_level = "Warn" + +[rtt] +# Whether or not an RTTUI should be opened after flashing. +# This is exclusive and cannot be used with GDB at the moment. +enabled = true +# A list of channel associations to be displayed. If left empty, all channels are displayed. +channels = [ + # { up = 0, down = 0, name = "name" } +] +# The duration in ms for which the logger should retry to attach to RTT. +timeout = 3000 +# Whether timestamps in the RTTUI are enabled +show_timestamps = true + +[gdb] +# Whether or not a GDB server should be opened after flashing. +# This is exclusive and cannot be used with RTT at the moment. +enabled = false +# The connection string in host:port format wher the GDB server will open a socket. +# gdb_connection_string diff --git a/examples/ppi-demo/README.md b/examples/ppi-demo/README.md new file mode 100644 index 00000000..49ded381 --- /dev/null +++ b/examples/ppi-demo/README.md @@ -0,0 +1,19 @@ +# Programmable peripheral interconnect demo + +Choose the microcontroller with one of the following features: +- 51 +- 52810 +- 52832 +- 52840 + +Also, if using `cargo-embed`, change the `chip` and `protocol` fields in [Embed.toml](Embed.toml). + +This demo uses the [rtt-target](https://crates.io/crates/rtt-target) crate for communication. + +If using `cargo-embed`, just run + +```console +$ cargo embed --release --features=52832 --target=thumbv7em-none-eabihf +``` + +Replace `52832` and `thumbv7em-none-eabihf` with the correct feature and target for your microcontroller. diff --git a/examples/ppi-demo/src/main.rs b/examples/ppi-demo/src/main.rs new file mode 100644 index 00000000..c52c9d8a --- /dev/null +++ b/examples/ppi-demo/src/main.rs @@ -0,0 +1,106 @@ +#![no_std] +#![no_main] + +#[cfg(not(any( + feature = "51", + feature = "52810", + feature = "52832", + feature = "52833", + feature = "52840" +)))] +compile_error!( + "This example requires one of the following device features enabled: + 51 + 52810 + 52832 + 52833 + 52840" +); + +// Import the right HAL/PAC crate, depending on the target chip +#[cfg(feature = "51")] +pub use nrf51_hal as hal; +#[cfg(feature = "52810")] +pub use nrf52810_hal as hal; +#[cfg(feature = "52832")] +pub use nrf52832_hal as hal; +#[cfg(feature = "52833")] +pub use nrf52833_hal as hal; +#[cfg(feature = "52840")] +pub use nrf52840_hal as hal; + +use { + core::{ + cell::RefCell, + panic::PanicInfo, + sync::atomic::{compiler_fence, Ordering}, + }, + cortex_m::interrupt::Mutex, + cortex_m_rt::entry, + hal::{ + pac::{interrupt, Interrupt, RADIO}, + ppi, + prelude::*, + timer::Timer, + Clocks, + }, + rtt_target::{rprintln, rtt_init_print}, +}; + +static RADIO_REGS: Mutex>> = Mutex::new(RefCell::new(None)); + +#[entry] +fn main() -> ! { + let p = hal::pac::Peripherals::take().unwrap(); + + let _clocks = Clocks::new(p.CLOCK).enable_ext_hfosc(); + rtt_init_print!(); + + let ppi_channels = ppi::Parts::new(p.PPI); + let mut channel0 = ppi_channels.ppi0; + + channel0.set_task_endpoint(&p.RADIO.tasks_disable); + channel0.set_event_endpoint(&p.TIMER0.events_compare[0]); + channel0.enable(); + + let radio = p.RADIO; + radio.intenset.write(|w| w.disabled().set()); + cortex_m::interrupt::free(|cs| RADIO_REGS.borrow(cs).replace(Some(radio))); + // NOTE(unsafe) There isn't any abstraction depending on this interrupt being masked + unsafe { + cortex_m::peripheral::NVIC::unmask(Interrupt::RADIO); + } + + let mut timer = Timer::one_shot(p.TIMER0); + timer.start(0xFFFFu32); + + loop { + // Prevent empty loop optimizations + compiler_fence(Ordering::SeqCst); + } +} + +#[interrupt] +fn RADIO() { + cortex_m::interrupt::free(|cs| { + if let Some(regs) = RADIO_REGS.borrow(cs).borrow_mut().as_mut() { + if regs.events_disabled.read().bits() == 1 { + rprintln!("We hit the RADIO disabled interrupt"); + + // Clear the disabled flag + // NOTE(unsafe) 0 is a valid value to write to this register + regs.events_disabled.write(|w| unsafe { w.bits(0) }); + } + } + }); +} + +#[inline(never)] +#[panic_handler] +fn panic(info: &PanicInfo) -> ! { + cortex_m::interrupt::disable(); + rprintln!("{}", info); + loop { + compiler_fence(Ordering::SeqCst); + } +} diff --git a/nrf-hal-common/Cargo.toml b/nrf-hal-common/Cargo.toml index fbefe9e6..3ba20d44 100644 --- a/nrf-hal-common/Cargo.toml +++ b/nrf-hal-common/Cargo.toml @@ -23,6 +23,7 @@ cortex-m = "0.6.2" nb = "0.1.2" fpa = "0.1.0" rand_core = "0.5.1" +cfg-if = "0.1.10" [dependencies.void] default-features = false diff --git a/nrf-hal-common/src/lib.rs b/nrf-hal-common/src/lib.rs index 0ad651b1..1665748c 100644 --- a/nrf-hal-common/src/lib.rs +++ b/nrf-hal-common/src/lib.rs @@ -31,6 +31,8 @@ pub mod delay; pub mod ecb; pub mod gpio; #[cfg(not(feature = "9160"))] +pub mod ppi; +#[cfg(not(feature = "9160"))] pub mod rng; pub mod rtc; #[cfg(not(feature = "51"))] @@ -58,6 +60,8 @@ pub mod prelude { pub use crate::hal::digital::v2::*; pub use crate::hal::prelude::*; + #[cfg(not(feature = "9160"))] + pub use crate::ppi::{ConfigurablePpi, Ppi}; pub use crate::time::U32Ext; } diff --git a/nrf-hal-common/src/ppi/event_nrf51.rs b/nrf-hal-common/src/ppi/event_nrf51.rs new file mode 100644 index 00000000..beef64b8 --- /dev/null +++ b/nrf-hal-common/src/ppi/event_nrf51.rs @@ -0,0 +1,65 @@ +use crate::ppi::Event; + +// Event impls +// +// To reproduce, in the pac crate, search +// `rg 'type EVENTS_.*crate::Reg' --type rust` +// Find (regex): +// `^src/(.*)\.rs:pub type (.*) = .*$` +// Replace (regex): +// `impl Event for crate::target::$1::$2 { }` +impl Event for crate::target::ecb::EVENTS_ENDECB {} +impl Event for crate::target::ecb::EVENTS_ERRORECB {} +impl Event for crate::target::rng::EVENTS_VALRDY {} +impl Event for crate::target::timer0::EVENTS_COMPARE {} +impl Event for crate::target::uart0::EVENTS_CTS {} +impl Event for crate::target::uart0::EVENTS_NCTS {} +impl Event for crate::target::uart0::EVENTS_RXDRDY {} +impl Event for crate::target::uart0::EVENTS_TXDRDY {} +impl Event for crate::target::uart0::EVENTS_ERROR {} +impl Event for crate::target::uart0::EVENTS_RXTO {} +impl Event for crate::target::gpiote::EVENTS_IN {} +impl Event for crate::target::gpiote::EVENTS_PORT {} +impl Event for crate::target::power::EVENTS_POFWARN {} +impl Event for crate::target::clock::EVENTS_HFCLKSTARTED {} +impl Event for crate::target::clock::EVENTS_LFCLKSTARTED {} +impl Event for crate::target::clock::EVENTS_DONE {} +impl Event for crate::target::clock::EVENTS_CTTO {} +impl Event for crate::target::spi0::EVENTS_READY {} +impl Event for crate::target::twi0::EVENTS_STOPPED {} +impl Event for crate::target::twi0::EVENTS_RXDREADY {} +impl Event for crate::target::twi0::EVENTS_TXDSENT {} +impl Event for crate::target::twi0::EVENTS_ERROR {} +impl Event for crate::target::twi0::EVENTS_BB {} +impl Event for crate::target::twi0::EVENTS_SUSPENDED {} +impl Event for crate::target::spis1::EVENTS_END {} +impl Event for crate::target::spis1::EVENTS_ENDRX {} +impl Event for crate::target::spis1::EVENTS_ACQUIRED {} +impl Event for crate::target::rtc0::EVENTS_TICK {} +impl Event for crate::target::rtc0::EVENTS_OVRFLW {} +impl Event for crate::target::rtc0::EVENTS_COMPARE {} +impl Event for crate::target::wdt::EVENTS_TIMEOUT {} +impl Event for crate::target::temp::EVENTS_DATARDY {} +impl Event for crate::target::radio::EVENTS_READY {} +impl Event for crate::target::radio::EVENTS_ADDRESS {} +impl Event for crate::target::radio::EVENTS_PAYLOAD {} +impl Event for crate::target::radio::EVENTS_END {} +impl Event for crate::target::radio::EVENTS_DISABLED {} +impl Event for crate::target::radio::EVENTS_DEVMATCH {} +impl Event for crate::target::radio::EVENTS_DEVMISS {} +impl Event for crate::target::radio::EVENTS_RSSIEND {} +impl Event for crate::target::radio::EVENTS_BCMATCH {} +impl Event for crate::target::lpcomp::EVENTS_READY {} +impl Event for crate::target::lpcomp::EVENTS_DOWN {} +impl Event for crate::target::lpcomp::EVENTS_UP {} +impl Event for crate::target::lpcomp::EVENTS_CROSS {} +impl Event for crate::target::ccm::EVENTS_ENDKSGEN {} +impl Event for crate::target::ccm::EVENTS_ENDCRYPT {} +impl Event for crate::target::ccm::EVENTS_ERROR {} +impl Event for crate::target::aar::EVENTS_END {} +impl Event for crate::target::aar::EVENTS_RESOLVED {} +impl Event for crate::target::aar::EVENTS_NOTRESOLVED {} +impl Event for crate::target::qdec::EVENTS_SAMPLERDY {} +impl Event for crate::target::qdec::EVENTS_REPORTRDY {} +impl Event for crate::target::qdec::EVENTS_ACCOF {} +impl Event for crate::target::adc::EVENTS_END {} diff --git a/nrf-hal-common/src/ppi/event_nrf52810.rs b/nrf-hal-common/src/ppi/event_nrf52810.rs new file mode 100644 index 00000000..20c60830 --- /dev/null +++ b/nrf-hal-common/src/ppi/event_nrf52810.rs @@ -0,0 +1,114 @@ +use crate::ppi::Event; + +// Event impls +// +// To reproduce, in the pac crate, search +// `rg 'type EVENTS_.*crate::Reg' --type rust` +// Find (regex): +// `^src/(.*)\.rs:pub type (.*) = .*$` +// Replace (regex): +// `impl Event for crate::target::$1::$2 { }` +impl Event for crate::target::rng::EVENTS_VALRDY {} +impl Event for crate::target::timer0::EVENTS_COMPARE {} +impl Event for crate::target::spis0::EVENTS_END {} +impl Event for crate::target::spis0::EVENTS_ENDRX {} +impl Event for crate::target::spis0::EVENTS_ACQUIRED {} +impl Event for crate::target::gpiote::EVENTS_IN {} +impl Event for crate::target::gpiote::EVENTS_PORT {} +impl Event for crate::target::uart0::EVENTS_CTS {} +impl Event for crate::target::uart0::EVENTS_NCTS {} +impl Event for crate::target::uart0::EVENTS_RXDRDY {} +impl Event for crate::target::uart0::EVENTS_TXDRDY {} +impl Event for crate::target::uart0::EVENTS_ERROR {} +impl Event for crate::target::uart0::EVENTS_RXTO {} +impl Event for crate::target::clock::EVENTS_HFCLKSTARTED {} +impl Event for crate::target::clock::EVENTS_LFCLKSTARTED {} +impl Event for crate::target::clock::EVENTS_DONE {} +impl Event for crate::target::clock::EVENTS_CTTO {} +impl Event for crate::target::power::EVENTS_POFWARN {} +impl Event for crate::target::power::EVENTS_SLEEPENTER {} +impl Event for crate::target::power::EVENTS_SLEEPEXIT {} +impl Event for crate::target::spim0::EVENTS_STOPPED {} +impl Event for crate::target::spim0::EVENTS_ENDRX {} +impl Event for crate::target::spim0::EVENTS_END {} +impl Event for crate::target::spim0::EVENTS_ENDTX {} +impl Event for crate::target::spim0::EVENTS_STARTED {} +impl Event for crate::target::spi0::EVENTS_READY {} +impl Event for crate::target::twim0::EVENTS_STOPPED {} +impl Event for crate::target::twim0::EVENTS_ERROR {} +impl Event for crate::target::twim0::EVENTS_SUSPENDED {} +impl Event for crate::target::twim0::EVENTS_RXSTARTED {} +impl Event for crate::target::twim0::EVENTS_TXSTARTED {} +impl Event for crate::target::twim0::EVENTS_LASTRX {} +impl Event for crate::target::twim0::EVENTS_LASTTX {} +impl Event for crate::target::twi0::EVENTS_STOPPED {} +impl Event for crate::target::twi0::EVENTS_RXDREADY {} +impl Event for crate::target::twi0::EVENTS_TXDSENT {} +impl Event for crate::target::twi0::EVENTS_ERROR {} +impl Event for crate::target::twi0::EVENTS_BB {} +impl Event for crate::target::twi0::EVENTS_SUSPENDED {} +impl Event for crate::target::egu0::EVENTS_TRIGGERED {} +impl Event for crate::target::ecb::EVENTS_ENDECB {} +impl Event for crate::target::ecb::EVENTS_ERRORECB {} +impl Event for crate::target::rtc0::EVENTS_TICK {} +impl Event for crate::target::rtc0::EVENTS_OVRFLW {} +impl Event for crate::target::rtc0::EVENTS_COMPARE {} +impl Event for crate::target::pdm::EVENTS_STARTED {} +impl Event for crate::target::pdm::EVENTS_STOPPED {} +impl Event for crate::target::pdm::EVENTS_END {} +impl Event for crate::target::wdt::EVENTS_TIMEOUT {} +impl Event for crate::target::radio::EVENTS_READY {} +impl Event for crate::target::radio::EVENTS_ADDRESS {} +impl Event for crate::target::radio::EVENTS_PAYLOAD {} +impl Event for crate::target::radio::EVENTS_END {} +impl Event for crate::target::radio::EVENTS_DISABLED {} +impl Event for crate::target::radio::EVENTS_DEVMATCH {} +impl Event for crate::target::radio::EVENTS_DEVMISS {} +impl Event for crate::target::radio::EVENTS_RSSIEND {} +impl Event for crate::target::radio::EVENTS_BCMATCH {} +impl Event for crate::target::radio::EVENTS_CRCOK {} +impl Event for crate::target::radio::EVENTS_CRCERROR {} +impl Event for crate::target::temp::EVENTS_DATARDY {} +impl Event for crate::target::ccm::EVENTS_ENDKSGEN {} +impl Event for crate::target::ccm::EVENTS_ENDCRYPT {} +impl Event for crate::target::ccm::EVENTS_ERROR {} +impl Event for crate::target::twis0::EVENTS_STOPPED {} +impl Event for crate::target::twis0::EVENTS_ERROR {} +impl Event for crate::target::twis0::EVENTS_RXSTARTED {} +impl Event for crate::target::twis0::EVENTS_TXSTARTED {} +impl Event for crate::target::twis0::EVENTS_WRITE {} +impl Event for crate::target::twis0::EVENTS_READ {} +impl Event for crate::target::uarte0::EVENTS_CTS {} +impl Event for crate::target::uarte0::EVENTS_NCTS {} +impl Event for crate::target::uarte0::EVENTS_RXDRDY {} +impl Event for crate::target::uarte0::EVENTS_ENDRX {} +impl Event for crate::target::uarte0::EVENTS_TXDRDY {} +impl Event for crate::target::uarte0::EVENTS_ENDTX {} +impl Event for crate::target::uarte0::EVENTS_ERROR {} +impl Event for crate::target::uarte0::EVENTS_RXTO {} +impl Event for crate::target::uarte0::EVENTS_RXSTARTED {} +impl Event for crate::target::uarte0::EVENTS_TXSTARTED {} +impl Event for crate::target::uarte0::EVENTS_TXSTOPPED {} +impl Event for crate::target::qdec::EVENTS_SAMPLERDY {} +impl Event for crate::target::qdec::EVENTS_REPORTRDY {} +impl Event for crate::target::qdec::EVENTS_ACCOF {} +impl Event for crate::target::qdec::EVENTS_DBLRDY {} +impl Event for crate::target::qdec::EVENTS_STOPPED {} +impl Event for crate::target::aar::EVENTS_END {} +impl Event for crate::target::aar::EVENTS_RESOLVED {} +impl Event for crate::target::aar::EVENTS_NOTRESOLVED {} +impl Event for crate::target::saadc::EVENTS_STARTED {} +impl Event for crate::target::saadc::EVENTS_END {} +impl Event for crate::target::saadc::EVENTS_DONE {} +impl Event for crate::target::saadc::EVENTS_RESULTDONE {} +impl Event for crate::target::saadc::EVENTS_CALIBRATEDONE {} +impl Event for crate::target::saadc::EVENTS_STOPPED {} +impl Event for crate::target::comp::EVENTS_READY {} +impl Event for crate::target::comp::EVENTS_DOWN {} +impl Event for crate::target::comp::EVENTS_UP {} +impl Event for crate::target::comp::EVENTS_CROSS {} +impl Event for crate::target::pwm0::EVENTS_STOPPED {} +impl Event for crate::target::pwm0::EVENTS_SEQSTARTED {} +impl Event for crate::target::pwm0::EVENTS_SEQEND {} +impl Event for crate::target::pwm0::EVENTS_PWMPERIODEND {} +impl Event for crate::target::pwm0::EVENTS_LOOPSDONE {} diff --git a/nrf-hal-common/src/ppi/event_nrf52832.rs b/nrf-hal-common/src/ppi/event_nrf52832.rs new file mode 100644 index 00000000..47590781 --- /dev/null +++ b/nrf-hal-common/src/ppi/event_nrf52832.rs @@ -0,0 +1,137 @@ +use crate::ppi::Event; + +// Event impls +// +// To reproduce, in the pac crate, search +// `rg 'type EVENTS_.*crate::Reg' --type rust` +// Find (regex): +// `^src/(.*)\.rs:pub type (.*) = .*$` +// Replace (regex): +// `impl Event for crate::target::$1::$2 { }` +impl Event for crate::target::radio::EVENTS_READY {} +impl Event for crate::target::radio::EVENTS_ADDRESS {} +impl Event for crate::target::radio::EVENTS_PAYLOAD {} +impl Event for crate::target::radio::EVENTS_END {} +impl Event for crate::target::radio::EVENTS_DISABLED {} +impl Event for crate::target::radio::EVENTS_DEVMATCH {} +impl Event for crate::target::radio::EVENTS_DEVMISS {} +impl Event for crate::target::radio::EVENTS_RSSIEND {} +impl Event for crate::target::radio::EVENTS_BCMATCH {} +impl Event for crate::target::radio::EVENTS_CRCOK {} +impl Event for crate::target::radio::EVENTS_CRCERROR {} +impl Event for crate::target::power::EVENTS_POFWARN {} +impl Event for crate::target::power::EVENTS_SLEEPENTER {} +impl Event for crate::target::power::EVENTS_SLEEPEXIT {} +impl Event for crate::target::timer0::EVENTS_COMPARE {} +impl Event for crate::target::rng::EVENTS_VALRDY {} +impl Event for crate::target::uart0::EVENTS_CTS {} +impl Event for crate::target::uart0::EVENTS_NCTS {} +impl Event for crate::target::uart0::EVENTS_RXDRDY {} +impl Event for crate::target::uart0::EVENTS_TXDRDY {} +impl Event for crate::target::uart0::EVENTS_ERROR {} +impl Event for crate::target::uart0::EVENTS_RXTO {} +impl Event for crate::target::spis0::EVENTS_END {} +impl Event for crate::target::spis0::EVENTS_ENDRX {} +impl Event for crate::target::spis0::EVENTS_ACQUIRED {} +impl Event for crate::target::gpiote::EVENTS_IN {} +impl Event for crate::target::gpiote::EVENTS_PORT {} +impl Event for crate::target::clock::EVENTS_HFCLKSTARTED {} +impl Event for crate::target::clock::EVENTS_LFCLKSTARTED {} +impl Event for crate::target::clock::EVENTS_DONE {} +impl Event for crate::target::clock::EVENTS_CTTO {} +impl Event for crate::target::spim0::EVENTS_STOPPED {} +impl Event for crate::target::spim0::EVENTS_ENDRX {} +impl Event for crate::target::spim0::EVENTS_END {} +impl Event for crate::target::spim0::EVENTS_ENDTX {} +impl Event for crate::target::spim0::EVENTS_STARTED {} +impl Event for crate::target::spi0::EVENTS_READY {} +impl Event for crate::target::wdt::EVENTS_TIMEOUT {} +impl Event for crate::target::twim0::EVENTS_STOPPED {} +impl Event for crate::target::twim0::EVENTS_ERROR {} +impl Event for crate::target::twim0::EVENTS_SUSPENDED {} +impl Event for crate::target::twim0::EVENTS_RXSTARTED {} +impl Event for crate::target::twim0::EVENTS_TXSTARTED {} +impl Event for crate::target::twim0::EVENTS_LASTRX {} +impl Event for crate::target::twim0::EVENTS_LASTTX {} +impl Event for crate::target::rtc0::EVENTS_TICK {} +impl Event for crate::target::rtc0::EVENTS_OVRFLW {} +impl Event for crate::target::rtc0::EVENTS_COMPARE {} +impl Event for crate::target::twi0::EVENTS_STOPPED {} +impl Event for crate::target::twi0::EVENTS_RXDREADY {} +impl Event for crate::target::twi0::EVENTS_TXDSENT {} +impl Event for crate::target::twi0::EVENTS_ERROR {} +impl Event for crate::target::twi0::EVENTS_BB {} +impl Event for crate::target::twi0::EVENTS_SUSPENDED {} +impl Event for crate::target::egu0::EVENTS_TRIGGERED {} +impl Event for crate::target::pdm::EVENTS_STARTED {} +impl Event for crate::target::pdm::EVENTS_STOPPED {} +impl Event for crate::target::pdm::EVENTS_END {} +impl Event for crate::target::ecb::EVENTS_ENDECB {} +impl Event for crate::target::ecb::EVENTS_ERRORECB {} +impl Event for crate::target::lpcomp::EVENTS_READY {} +impl Event for crate::target::lpcomp::EVENTS_DOWN {} +impl Event for crate::target::lpcomp::EVENTS_UP {} +impl Event for crate::target::lpcomp::EVENTS_CROSS {} +impl Event for crate::target::temp::EVENTS_DATARDY {} +impl Event for crate::target::ccm::EVENTS_ENDKSGEN {} +impl Event for crate::target::ccm::EVENTS_ENDCRYPT {} +impl Event for crate::target::ccm::EVENTS_ERROR {} +impl Event for crate::target::i2s::EVENTS_RXPTRUPD {} +impl Event for crate::target::i2s::EVENTS_STOPPED {} +impl Event for crate::target::i2s::EVENTS_TXPTRUPD {} +impl Event for crate::target::uarte0::EVENTS_CTS {} +impl Event for crate::target::uarte0::EVENTS_NCTS {} +impl Event for crate::target::uarte0::EVENTS_RXDRDY {} +impl Event for crate::target::uarte0::EVENTS_ENDRX {} +impl Event for crate::target::uarte0::EVENTS_TXDRDY {} +impl Event for crate::target::uarte0::EVENTS_ENDTX {} +impl Event for crate::target::uarte0::EVENTS_ERROR {} +impl Event for crate::target::uarte0::EVENTS_RXTO {} +impl Event for crate::target::uarte0::EVENTS_RXSTARTED {} +impl Event for crate::target::uarte0::EVENTS_TXSTARTED {} +impl Event for crate::target::uarte0::EVENTS_TXSTOPPED {} +impl Event for crate::target::timer3::EVENTS_COMPARE {} +impl Event for crate::target::comp::EVENTS_READY {} +impl Event for crate::target::comp::EVENTS_DOWN {} +impl Event for crate::target::comp::EVENTS_UP {} +impl Event for crate::target::comp::EVENTS_CROSS {} +impl Event for crate::target::twis0::EVENTS_STOPPED {} +impl Event for crate::target::twis0::EVENTS_ERROR {} +impl Event for crate::target::twis0::EVENTS_RXSTARTED {} +impl Event for crate::target::twis0::EVENTS_TXSTARTED {} +impl Event for crate::target::twis0::EVENTS_WRITE {} +impl Event for crate::target::twis0::EVENTS_READ {} +impl Event for crate::target::aar::EVENTS_END {} +impl Event for crate::target::aar::EVENTS_RESOLVED {} +impl Event for crate::target::aar::EVENTS_NOTRESOLVED {} +impl Event for crate::target::qdec::EVENTS_SAMPLERDY {} +impl Event for crate::target::qdec::EVENTS_REPORTRDY {} +impl Event for crate::target::qdec::EVENTS_ACCOF {} +impl Event for crate::target::qdec::EVENTS_DBLRDY {} +impl Event for crate::target::qdec::EVENTS_STOPPED {} +impl Event for crate::target::saadc::EVENTS_STARTED {} +impl Event for crate::target::saadc::EVENTS_END {} +impl Event for crate::target::saadc::EVENTS_DONE {} +impl Event for crate::target::saadc::EVENTS_RESULTDONE {} +impl Event for crate::target::saadc::EVENTS_CALIBRATEDONE {} +impl Event for crate::target::saadc::EVENTS_STOPPED {} +impl Event for crate::target::nfct::EVENTS_READY {} +impl Event for crate::target::nfct::EVENTS_FIELDDETECTED {} +impl Event for crate::target::nfct::EVENTS_FIELDLOST {} +impl Event for crate::target::nfct::EVENTS_TXFRAMESTART {} +impl Event for crate::target::nfct::EVENTS_TXFRAMEEND {} +impl Event for crate::target::nfct::EVENTS_RXFRAMESTART {} +impl Event for crate::target::nfct::EVENTS_RXFRAMEEND {} +impl Event for crate::target::nfct::EVENTS_ERROR {} +impl Event for crate::target::nfct::EVENTS_RXERROR {} +impl Event for crate::target::nfct::EVENTS_ENDRX {} +impl Event for crate::target::nfct::EVENTS_ENDTX {} +impl Event for crate::target::nfct::EVENTS_AUTOCOLRESSTARTED {} +impl Event for crate::target::nfct::EVENTS_COLLISION {} +impl Event for crate::target::nfct::EVENTS_SELECTED {} +impl Event for crate::target::nfct::EVENTS_STARTED {} +impl Event for crate::target::pwm0::EVENTS_STOPPED {} +impl Event for crate::target::pwm0::EVENTS_SEQSTARTED {} +impl Event for crate::target::pwm0::EVENTS_SEQEND {} +impl Event for crate::target::pwm0::EVENTS_PWMPERIODEND {} +impl Event for crate::target::pwm0::EVENTS_LOOPSDONE {} diff --git a/nrf-hal-common/src/ppi/event_nrf52833.rs b/nrf-hal-common/src/ppi/event_nrf52833.rs new file mode 100644 index 00000000..e078fb5b --- /dev/null +++ b/nrf-hal-common/src/ppi/event_nrf52833.rs @@ -0,0 +1,165 @@ +use crate::ppi::Event; + +// Event impls +// +// To reproduce, in the pac crate, search +// `rg 'type EVENTS_.*crate::Reg' --type rust` +// Find (regex): +// `^src/(.*)\.rs:pub type (.*) = .*$` +// Replace (regex): +// `impl Event for crate::target::$1::$2 { }` +impl Event for crate::target::rng::EVENTS_VALRDY {} +impl Event for crate::target::uart0::EVENTS_CTS {} +impl Event for crate::target::uart0::EVENTS_NCTS {} +impl Event for crate::target::uart0::EVENTS_RXDRDY {} +impl Event for crate::target::uart0::EVENTS_TXDRDY {} +impl Event for crate::target::uart0::EVENTS_ERROR {} +impl Event for crate::target::uart0::EVENTS_RXTO {} +impl Event for crate::target::gpiote::EVENTS_IN {} +impl Event for crate::target::gpiote::EVENTS_PORT {} +impl Event for crate::target::spis0::EVENTS_END {} +impl Event for crate::target::spis0::EVENTS_ENDRX {} +impl Event for crate::target::spis0::EVENTS_ACQUIRED {} +impl Event for crate::target::spim0::EVENTS_STOPPED {} +impl Event for crate::target::spim0::EVENTS_ENDRX {} +impl Event for crate::target::spim0::EVENTS_END {} +impl Event for crate::target::spim0::EVENTS_ENDTX {} +impl Event for crate::target::spim0::EVENTS_STARTED {} +impl Event for crate::target::timer0::EVENTS_COMPARE {} +impl Event for crate::target::clock::EVENTS_HFCLKSTARTED {} +impl Event for crate::target::clock::EVENTS_LFCLKSTARTED {} +impl Event for crate::target::clock::EVENTS_DONE {} +impl Event for crate::target::clock::EVENTS_CTTO {} +impl Event for crate::target::clock::EVENTS_CTSTARTED {} +impl Event for crate::target::clock::EVENTS_CTSTOPPED {} +impl Event for crate::target::power::EVENTS_POFWARN {} +impl Event for crate::target::power::EVENTS_SLEEPENTER {} +impl Event for crate::target::power::EVENTS_SLEEPEXIT {} +impl Event for crate::target::power::EVENTS_USBDETECTED {} +impl Event for crate::target::power::EVENTS_USBREMOVED {} +impl Event for crate::target::power::EVENTS_USBPWRRDY {} +impl Event for crate::target::spi0::EVENTS_READY {} +impl Event for crate::target::twi0::EVENTS_STOPPED {} +impl Event for crate::target::twi0::EVENTS_RXDREADY {} +impl Event for crate::target::twi0::EVENTS_TXDSENT {} +impl Event for crate::target::twi0::EVENTS_ERROR {} +impl Event for crate::target::twi0::EVENTS_BB {} +impl Event for crate::target::twi0::EVENTS_SUSPENDED {} +impl Event for crate::target::twim0::EVENTS_STOPPED {} +impl Event for crate::target::twim0::EVENTS_ERROR {} +impl Event for crate::target::twim0::EVENTS_SUSPENDED {} +impl Event for crate::target::twim0::EVENTS_RXSTARTED {} +impl Event for crate::target::twim0::EVENTS_TXSTARTED {} +impl Event for crate::target::twim0::EVENTS_LASTRX {} +impl Event for crate::target::twim0::EVENTS_LASTTX {} +impl Event for crate::target::egu0::EVENTS_TRIGGERED {} +impl Event for crate::target::ecb::EVENTS_ENDECB {} +impl Event for crate::target::ecb::EVENTS_ERRORECB {} +impl Event for crate::target::wdt::EVENTS_TIMEOUT {} +impl Event for crate::target::lpcomp::EVENTS_READY {} +impl Event for crate::target::lpcomp::EVENTS_DOWN {} +impl Event for crate::target::lpcomp::EVENTS_UP {} +impl Event for crate::target::lpcomp::EVENTS_CROSS {} +impl Event for crate::target::radio::EVENTS_READY {} +impl Event for crate::target::radio::EVENTS_ADDRESS {} +impl Event for crate::target::radio::EVENTS_PAYLOAD {} +impl Event for crate::target::radio::EVENTS_END {} +impl Event for crate::target::radio::EVENTS_DISABLED {} +impl Event for crate::target::radio::EVENTS_DEVMATCH {} +impl Event for crate::target::radio::EVENTS_DEVMISS {} +impl Event for crate::target::radio::EVENTS_RSSIEND {} +impl Event for crate::target::radio::EVENTS_BCMATCH {} +impl Event for crate::target::radio::EVENTS_CRCOK {} +impl Event for crate::target::radio::EVENTS_CRCERROR {} +impl Event for crate::target::radio::EVENTS_FRAMESTART {} +impl Event for crate::target::radio::EVENTS_EDEND {} +impl Event for crate::target::radio::EVENTS_EDSTOPPED {} +impl Event for crate::target::radio::EVENTS_CCAIDLE {} +impl Event for crate::target::radio::EVENTS_CCABUSY {} +impl Event for crate::target::radio::EVENTS_CCASTOPPED {} +impl Event for crate::target::radio::EVENTS_RATEBOOST {} +impl Event for crate::target::radio::EVENTS_TXREADY {} +impl Event for crate::target::radio::EVENTS_RXREADY {} +impl Event for crate::target::radio::EVENTS_MHRMATCH {} +impl Event for crate::target::radio::EVENTS_SYNC {} +impl Event for crate::target::radio::EVENTS_PHYEND {} +impl Event for crate::target::radio::EVENTS_CTEPRESENT {} +impl Event for crate::target::temp::EVENTS_DATARDY {} +impl Event for crate::target::pdm::EVENTS_STARTED {} +impl Event for crate::target::pdm::EVENTS_STOPPED {} +impl Event for crate::target::pdm::EVENTS_END {} +impl Event for crate::target::ccm::EVENTS_ENDKSGEN {} +impl Event for crate::target::ccm::EVENTS_ENDCRYPT {} +impl Event for crate::target::ccm::EVENTS_ERROR {} +impl Event for crate::target::uarte0::EVENTS_CTS {} +impl Event for crate::target::uarte0::EVENTS_NCTS {} +impl Event for crate::target::uarte0::EVENTS_RXDRDY {} +impl Event for crate::target::uarte0::EVENTS_ENDRX {} +impl Event for crate::target::uarte0::EVENTS_TXDRDY {} +impl Event for crate::target::uarte0::EVENTS_ENDTX {} +impl Event for crate::target::uarte0::EVENTS_ERROR {} +impl Event for crate::target::uarte0::EVENTS_RXTO {} +impl Event for crate::target::uarte0::EVENTS_RXSTARTED {} +impl Event for crate::target::uarte0::EVENTS_TXSTARTED {} +impl Event for crate::target::uarte0::EVENTS_TXSTOPPED {} +impl Event for crate::target::i2s::EVENTS_RXPTRUPD {} +impl Event for crate::target::i2s::EVENTS_STOPPED {} +impl Event for crate::target::i2s::EVENTS_TXPTRUPD {} +impl Event for crate::target::rtc0::EVENTS_TICK {} +impl Event for crate::target::rtc0::EVENTS_OVRFLW {} +impl Event for crate::target::rtc0::EVENTS_COMPARE {} +impl Event for crate::target::qdec::EVENTS_SAMPLERDY {} +impl Event for crate::target::qdec::EVENTS_REPORTRDY {} +impl Event for crate::target::qdec::EVENTS_ACCOF {} +impl Event for crate::target::qdec::EVENTS_DBLRDY {} +impl Event for crate::target::qdec::EVENTS_STOPPED {} +impl Event for crate::target::twis0::EVENTS_STOPPED {} +impl Event for crate::target::twis0::EVENTS_ERROR {} +impl Event for crate::target::twis0::EVENTS_RXSTARTED {} +impl Event for crate::target::twis0::EVENTS_TXSTARTED {} +impl Event for crate::target::twis0::EVENTS_WRITE {} +impl Event for crate::target::twis0::EVENTS_READ {} +impl Event for crate::target::comp::EVENTS_READY {} +impl Event for crate::target::comp::EVENTS_DOWN {} +impl Event for crate::target::comp::EVENTS_UP {} +impl Event for crate::target::comp::EVENTS_CROSS {} +impl Event for crate::target::usbd::EVENTS_USBRESET {} +impl Event for crate::target::usbd::EVENTS_STARTED {} +impl Event for crate::target::usbd::EVENTS_ENDEPIN {} +impl Event for crate::target::usbd::EVENTS_EP0DATADONE {} +impl Event for crate::target::usbd::EVENTS_ENDISOIN {} +impl Event for crate::target::usbd::EVENTS_ENDEPOUT {} +impl Event for crate::target::usbd::EVENTS_ENDISOOUT {} +impl Event for crate::target::usbd::EVENTS_SOF {} +impl Event for crate::target::usbd::EVENTS_USBEVENT {} +impl Event for crate::target::usbd::EVENTS_EP0SETUP {} +impl Event for crate::target::usbd::EVENTS_EPDATA {} +impl Event for crate::target::saadc::EVENTS_STARTED {} +impl Event for crate::target::saadc::EVENTS_END {} +impl Event for crate::target::saadc::EVENTS_DONE {} +impl Event for crate::target::saadc::EVENTS_RESULTDONE {} +impl Event for crate::target::saadc::EVENTS_CALIBRATEDONE {} +impl Event for crate::target::saadc::EVENTS_STOPPED {} +impl Event for crate::target::aar::EVENTS_END {} +impl Event for crate::target::aar::EVENTS_RESOLVED {} +impl Event for crate::target::aar::EVENTS_NOTRESOLVED {} +impl Event for crate::target::pwm0::EVENTS_STOPPED {} +impl Event for crate::target::pwm0::EVENTS_SEQSTARTED {} +impl Event for crate::target::pwm0::EVENTS_SEQEND {} +impl Event for crate::target::pwm0::EVENTS_PWMPERIODEND {} +impl Event for crate::target::pwm0::EVENTS_LOOPSDONE {} +impl Event for crate::target::nfct::EVENTS_READY {} +impl Event for crate::target::nfct::EVENTS_FIELDDETECTED {} +impl Event for crate::target::nfct::EVENTS_FIELDLOST {} +impl Event for crate::target::nfct::EVENTS_TXFRAMESTART {} +impl Event for crate::target::nfct::EVENTS_TXFRAMEEND {} +impl Event for crate::target::nfct::EVENTS_RXFRAMESTART {} +impl Event for crate::target::nfct::EVENTS_RXFRAMEEND {} +impl Event for crate::target::nfct::EVENTS_ERROR {} +impl Event for crate::target::nfct::EVENTS_RXERROR {} +impl Event for crate::target::nfct::EVENTS_ENDRX {} +impl Event for crate::target::nfct::EVENTS_ENDTX {} +impl Event for crate::target::nfct::EVENTS_AUTOCOLRESSTARTED {} +impl Event for crate::target::nfct::EVENTS_COLLISION {} +impl Event for crate::target::nfct::EVENTS_SELECTED {} +impl Event for crate::target::nfct::EVENTS_STARTED {} diff --git a/nrf-hal-common/src/ppi/event_nrf52840.rs b/nrf-hal-common/src/ppi/event_nrf52840.rs new file mode 100644 index 00000000..a69ece6d --- /dev/null +++ b/nrf-hal-common/src/ppi/event_nrf52840.rs @@ -0,0 +1,165 @@ +use crate::ppi::Event; + +// Event impls +// +// To reproduce, in the pac crate, search +// `rg 'type EVENTS_.*crate::Reg' --type rust` +// Find (regex): +// `^src/(.*)\.rs:pub type (.*) = .*$` +// Replace (regex): +// `impl Event for crate::target::$1::$2 { }` +impl Event for crate::target::nfct::EVENTS_READY {} +impl Event for crate::target::nfct::EVENTS_FIELDDETECTED {} +impl Event for crate::target::nfct::EVENTS_FIELDLOST {} +impl Event for crate::target::nfct::EVENTS_TXFRAMESTART {} +impl Event for crate::target::nfct::EVENTS_TXFRAMEEND {} +impl Event for crate::target::nfct::EVENTS_RXFRAMESTART {} +impl Event for crate::target::nfct::EVENTS_RXFRAMEEND {} +impl Event for crate::target::nfct::EVENTS_ERROR {} +impl Event for crate::target::nfct::EVENTS_RXERROR {} +impl Event for crate::target::nfct::EVENTS_ENDRX {} +impl Event for crate::target::nfct::EVENTS_ENDTX {} +impl Event for crate::target::nfct::EVENTS_AUTOCOLRESSTARTED {} +impl Event for crate::target::nfct::EVENTS_COLLISION {} +impl Event for crate::target::nfct::EVENTS_SELECTED {} +impl Event for crate::target::nfct::EVENTS_STARTED {} +impl Event for crate::target::temp::EVENTS_DATARDY {} +impl Event for crate::target::rng::EVENTS_VALRDY {} +impl Event for crate::target::timer0::EVENTS_COMPARE {} +impl Event for crate::target::uart0::EVENTS_CTS {} +impl Event for crate::target::uart0::EVENTS_NCTS {} +impl Event for crate::target::uart0::EVENTS_RXDRDY {} +impl Event for crate::target::uart0::EVENTS_TXDRDY {} +impl Event for crate::target::uart0::EVENTS_ERROR {} +impl Event for crate::target::uart0::EVENTS_RXTO {} +impl Event for crate::target::clock::EVENTS_HFCLKSTARTED {} +impl Event for crate::target::clock::EVENTS_LFCLKSTARTED {} +impl Event for crate::target::clock::EVENTS_DONE {} +impl Event for crate::target::clock::EVENTS_CTTO {} +impl Event for crate::target::clock::EVENTS_CTSTARTED {} +impl Event for crate::target::clock::EVENTS_CTSTOPPED {} +impl Event for crate::target::gpiote::EVENTS_IN {} +impl Event for crate::target::gpiote::EVENTS_PORT {} +impl Event for crate::target::spis0::EVENTS_END {} +impl Event for crate::target::spis0::EVENTS_ENDRX {} +impl Event for crate::target::spis0::EVENTS_ACQUIRED {} +impl Event for crate::target::spim0::EVENTS_STOPPED {} +impl Event for crate::target::spim0::EVENTS_ENDRX {} +impl Event for crate::target::spim0::EVENTS_END {} +impl Event for crate::target::spim0::EVENTS_ENDTX {} +impl Event for crate::target::spim0::EVENTS_STARTED {} +impl Event for crate::target::power::EVENTS_POFWARN {} +impl Event for crate::target::power::EVENTS_SLEEPENTER {} +impl Event for crate::target::power::EVENTS_SLEEPEXIT {} +impl Event for crate::target::power::EVENTS_USBDETECTED {} +impl Event for crate::target::power::EVENTS_USBREMOVED {} +impl Event for crate::target::power::EVENTS_USBPWRRDY {} +impl Event for crate::target::spi0::EVENTS_READY {} +impl Event for crate::target::wdt::EVENTS_TIMEOUT {} +impl Event for crate::target::egu0::EVENTS_TRIGGERED {} +impl Event for crate::target::rtc0::EVENTS_TICK {} +impl Event for crate::target::rtc0::EVENTS_OVRFLW {} +impl Event for crate::target::rtc0::EVENTS_COMPARE {} +impl Event for crate::target::twi0::EVENTS_STOPPED {} +impl Event for crate::target::twi0::EVENTS_RXDREADY {} +impl Event for crate::target::twi0::EVENTS_TXDSENT {} +impl Event for crate::target::twi0::EVENTS_ERROR {} +impl Event for crate::target::twi0::EVENTS_BB {} +impl Event for crate::target::twi0::EVENTS_SUSPENDED {} +impl Event for crate::target::pdm::EVENTS_STARTED {} +impl Event for crate::target::pdm::EVENTS_STOPPED {} +impl Event for crate::target::pdm::EVENTS_END {} +impl Event for crate::target::lpcomp::EVENTS_READY {} +impl Event for crate::target::lpcomp::EVENTS_DOWN {} +impl Event for crate::target::lpcomp::EVENTS_UP {} +impl Event for crate::target::lpcomp::EVENTS_CROSS {} +impl Event for crate::target::radio::EVENTS_READY {} +impl Event for crate::target::radio::EVENTS_ADDRESS {} +impl Event for crate::target::radio::EVENTS_PAYLOAD {} +impl Event for crate::target::radio::EVENTS_END {} +impl Event for crate::target::radio::EVENTS_DISABLED {} +impl Event for crate::target::radio::EVENTS_DEVMATCH {} +impl Event for crate::target::radio::EVENTS_DEVMISS {} +impl Event for crate::target::radio::EVENTS_RSSIEND {} +impl Event for crate::target::radio::EVENTS_BCMATCH {} +impl Event for crate::target::radio::EVENTS_CRCOK {} +impl Event for crate::target::radio::EVENTS_CRCERROR {} +impl Event for crate::target::radio::EVENTS_FRAMESTART {} +impl Event for crate::target::radio::EVENTS_EDEND {} +impl Event for crate::target::radio::EVENTS_EDSTOPPED {} +impl Event for crate::target::radio::EVENTS_CCAIDLE {} +impl Event for crate::target::radio::EVENTS_CCABUSY {} +impl Event for crate::target::radio::EVENTS_CCASTOPPED {} +impl Event for crate::target::radio::EVENTS_RATEBOOST {} +impl Event for crate::target::radio::EVENTS_TXREADY {} +impl Event for crate::target::radio::EVENTS_RXREADY {} +impl Event for crate::target::radio::EVENTS_MHRMATCH {} +impl Event for crate::target::radio::EVENTS_PHYEND {} +impl Event for crate::target::ecb::EVENTS_ENDECB {} +impl Event for crate::target::ecb::EVENTS_ERRORECB {} +impl Event for crate::target::twim0::EVENTS_STOPPED {} +impl Event for crate::target::twim0::EVENTS_ERROR {} +impl Event for crate::target::twim0::EVENTS_SUSPENDED {} +impl Event for crate::target::twim0::EVENTS_RXSTARTED {} +impl Event for crate::target::twim0::EVENTS_TXSTARTED {} +impl Event for crate::target::twim0::EVENTS_LASTRX {} +impl Event for crate::target::twim0::EVENTS_LASTTX {} +impl Event for crate::target::ccm::EVENTS_ENDKSGEN {} +impl Event for crate::target::ccm::EVENTS_ENDCRYPT {} +impl Event for crate::target::ccm::EVENTS_ERROR {} +impl Event for crate::target::uarte0::EVENTS_CTS {} +impl Event for crate::target::uarte0::EVENTS_NCTS {} +impl Event for crate::target::uarte0::EVENTS_RXDRDY {} +impl Event for crate::target::uarte0::EVENTS_ENDRX {} +impl Event for crate::target::uarte0::EVENTS_TXDRDY {} +impl Event for crate::target::uarte0::EVENTS_ENDTX {} +impl Event for crate::target::uarte0::EVENTS_ERROR {} +impl Event for crate::target::uarte0::EVENTS_RXTO {} +impl Event for crate::target::uarte0::EVENTS_RXSTARTED {} +impl Event for crate::target::uarte0::EVENTS_TXSTARTED {} +impl Event for crate::target::uarte0::EVENTS_TXSTOPPED {} +impl Event for crate::target::i2s::EVENTS_RXPTRUPD {} +impl Event for crate::target::i2s::EVENTS_STOPPED {} +impl Event for crate::target::i2s::EVENTS_TXPTRUPD {} +impl Event for crate::target::twis0::EVENTS_STOPPED {} +impl Event for crate::target::twis0::EVENTS_ERROR {} +impl Event for crate::target::twis0::EVENTS_RXSTARTED {} +impl Event for crate::target::twis0::EVENTS_TXSTARTED {} +impl Event for crate::target::twis0::EVENTS_WRITE {} +impl Event for crate::target::twis0::EVENTS_READ {} +impl Event for crate::target::timer3::EVENTS_COMPARE {} +impl Event for crate::target::qdec::EVENTS_SAMPLERDY {} +impl Event for crate::target::qdec::EVENTS_REPORTRDY {} +impl Event for crate::target::qdec::EVENTS_ACCOF {} +impl Event for crate::target::qdec::EVENTS_DBLRDY {} +impl Event for crate::target::qdec::EVENTS_STOPPED {} +impl Event for crate::target::aar::EVENTS_END {} +impl Event for crate::target::aar::EVENTS_RESOLVED {} +impl Event for crate::target::aar::EVENTS_NOTRESOLVED {} +impl Event for crate::target::comp::EVENTS_READY {} +impl Event for crate::target::comp::EVENTS_DOWN {} +impl Event for crate::target::comp::EVENTS_UP {} +impl Event for crate::target::comp::EVENTS_CROSS {} +impl Event for crate::target::usbd::EVENTS_USBRESET {} +impl Event for crate::target::usbd::EVENTS_STARTED {} +impl Event for crate::target::usbd::EVENTS_ENDEPIN {} +impl Event for crate::target::usbd::EVENTS_EP0DATADONE {} +impl Event for crate::target::usbd::EVENTS_ENDISOIN {} +impl Event for crate::target::usbd::EVENTS_ENDEPOUT {} +impl Event for crate::target::usbd::EVENTS_ENDISOOUT {} +impl Event for crate::target::usbd::EVENTS_SOF {} +impl Event for crate::target::usbd::EVENTS_USBEVENT {} +impl Event for crate::target::usbd::EVENTS_EP0SETUP {} +impl Event for crate::target::usbd::EVENTS_EPDATA {} +impl Event for crate::target::pwm0::EVENTS_STOPPED {} +impl Event for crate::target::pwm0::EVENTS_SEQSTARTED {} +impl Event for crate::target::pwm0::EVENTS_SEQEND {} +impl Event for crate::target::pwm0::EVENTS_PWMPERIODEND {} +impl Event for crate::target::pwm0::EVENTS_LOOPSDONE {} +impl Event for crate::target::saadc::EVENTS_STARTED {} +impl Event for crate::target::saadc::EVENTS_END {} +impl Event for crate::target::saadc::EVENTS_DONE {} +impl Event for crate::target::saadc::EVENTS_RESULTDONE {} +impl Event for crate::target::saadc::EVENTS_CALIBRATEDONE {} +impl Event for crate::target::saadc::EVENTS_STOPPED {} +impl Event for crate::target::qspi::EVENTS_READY {} diff --git a/nrf-hal-common/src/ppi/mod.rs b/nrf-hal-common/src/ppi/mod.rs new file mode 100644 index 00000000..d322fdcb --- /dev/null +++ b/nrf-hal-common/src/ppi/mod.rs @@ -0,0 +1,241 @@ +//! HAL interface for the PPI peripheral +//! +//! The Programmable Peripheral Interconnect interface allows for an autonomous interoperability +//! between peripherals through their events and tasks. There are fixed PPI channels and fully +//! configurable ones, fixed channels can only connect specific events to specific tasks. For fully +//! configurable channels, it is possible to choose, via software, the event and the task that it +//! will triggered by the event. +//! +//! On nRF52 devices, there is also a fork task endpoint, where the user can configure one more task +//! to be triggered by the same event, even fixed PPI channels have a configurable fork task. + +use crate::target::PPI; +use cfg_if::cfg_if; + +cfg_if! { + if #[cfg(feature = "51")] { + mod event_nrf51; + mod task_nrf51; + } else if #[cfg(feature = "52810")] { + mod event_nrf52810; + mod task_nrf52810; + } else if #[cfg(feature = "52832")] { + mod event_nrf52832; + mod task_nrf52832; + } else if #[cfg(feature = "52833")] { + mod event_nrf52833; + mod task_nrf52833; + } else if #[cfg(feature = "52840")] { + mod event_nrf52840; + mod task_nrf52840; + } +} + +mod sealed { + use super::{EventAddr, TaskAddr}; + + pub trait Channel { + const CH: usize; + } + + pub trait Task { + #[inline(always)] + fn task_addr(&self) -> TaskAddr { + TaskAddr(self as *const _ as *const u32 as u32) + } + } + pub trait Event { + #[inline(always)] + fn event_addr(&self) -> EventAddr { + EventAddr(self as *const _ as *const u32 as u32) + } + } + + pub trait NotFixed {} +} +use sealed::{Channel, Event, NotFixed, Task}; + +pub struct TaskAddr(pub(crate) u32); +pub struct EventAddr(pub(crate) u32); + +/// Trait to represent a Programmable Peripheral Interconnect channel. +pub trait Ppi { + /// Enables the channel. + fn enable(&mut self); + + /// Disables the channel. + fn disable(&mut self); + + #[cfg(not(feature = "51"))] + /// Sets the fork task that must be triggered when the configured event occurs. The user must + /// provide a reference to the task. + fn set_fork_task_endpoint(&mut self, task: &T); +} + +/// Traits that extends the [Ppi](trait.Ppi.html) trait, marking a channel as fully configurable. +pub trait ConfigurablePpi { + /// Sets the task that must be triggered when the configured event occurs. The user must provide + /// a reference to the task. + fn set_task_endpoint(&mut self, task: &T); + + /// Sets the event that will trigger the chosen task(s). The user must provide a reference to + /// the event. + fn set_event_endpoint(&mut self, event: &E); +} + +// All unsafe `ptr` calls only uses registers atomically, and only changes the resources owned by +// the type (guaranteed by the abstraction) +impl Ppi for P { + #[inline(always)] + fn enable(&mut self) { + let regs = unsafe { &*PPI::ptr() }; + regs.chenset.write(|w| unsafe { w.bits(1 << P::CH) }); + } + + #[inline(always)] + fn disable(&mut self) { + let regs = unsafe { &*PPI::ptr() }; + regs.chenclr.write(|w| unsafe { w.bits(1 << P::CH) }); + } + + #[cfg(not(feature = "51"))] + #[inline(always)] + fn set_fork_task_endpoint(&mut self, task: &T) { + let regs = unsafe { &*PPI::ptr() }; + regs.fork[P::CH] + .tep + .write(|w| unsafe { w.bits(task.task_addr().0) }); + } +} + +// All unsafe `ptr` calls only uses registers atomically, and only changes the resources owned by +// the type (guaranteed by the abstraction) +impl ConfigurablePpi for P { + #[inline(always)] + fn set_task_endpoint(&mut self, task: &T) { + let regs = unsafe { &*PPI::ptr() }; + regs.ch[P::CH] + .tep + .write(|w| unsafe { w.bits(task.task_addr().0) }); + } + + #[inline(always)] + fn set_event_endpoint(&mut self, event: &E) { + let regs = unsafe { &*PPI::ptr() }; + regs.ch[P::CH] + .eep + .write(|w| unsafe { w.bits(event.event_addr().0) }); + } +} + +macro_rules! ppi { + ( + not_fixed: [ $( + $(#[$attr:meta])* + ($ppix:ident, $PpixType:ident, $ch:expr),)+ + ], + fixed: [$(($ppix_fixed:ident, $PpixTypeFixed:ident, $ch_fixed:expr),)+], + ) => { + + $( + /// Fully configurable PPI Channel. + $(#[$attr])* + pub struct $PpixType { + _private: (), + } + + $(#[$attr])* + impl Channel for $PpixType { + const CH: usize = $ch; + } + + $(#[$attr])* + impl NotFixed for $PpixType {} + )+ + + $( + /// Fixed PPI channel. + pub struct $PpixTypeFixed { + _private: (), + } + + impl Channel for $PpixTypeFixed { + const CH: usize = $ch_fixed; + } + )+ + + /// Type that abstracts all the PPI channels. + pub struct Parts { + $( + $(#[$attr])* + pub $ppix: $PpixType, + )+ + $( + pub $ppix_fixed: $PpixTypeFixed, + )+ + } + + impl Parts { + /// Gets access to the PPI abstraction, making it possible to separate the channels through + /// different objects. + pub fn new(_regs: PPI) -> Self { + Self { + $( + $(#[$attr])* + $ppix: $PpixType { + _private: (), + }, + )+ + $( + $ppix_fixed: $PpixTypeFixed { + _private: (), + }, + )+ + } + } + } + }; +} + +ppi!( + not_fixed: [ + (ppi0, Ppi0, 0), + (ppi1, Ppi1, 1), + (ppi2, Ppi2, 2), + (ppi3, Ppi3, 3), + (ppi4, Ppi4, 4), + (ppi5, Ppi5, 5), + (ppi6, Ppi6, 6), + (ppi7, Ppi7, 7), + (ppi8, Ppi8, 8), + (ppi9, Ppi9, 9), + (ppi10, Ppi10, 10), + (ppi11, Ppi11, 11), + (ppi12, Ppi12, 12), + (ppi13, Ppi13, 13), + (ppi14, Ppi14, 14), + (ppi15, Ppi15, 15), + #[cfg(not(feature = "51"))] + (ppi16, Ppi16, 16), + #[cfg(not(feature = "51"))] + (ppi17, Ppi17, 17), + #[cfg(not(feature = "51"))] + (ppi18, Ppi18, 18), + #[cfg(not(feature = "51"))] + (ppi19, Ppi19, 19), + ], + fixed: [ + (ppi20, Ppi20, 20), + (ppi21, Ppi21, 21), + (ppi22, Ppi22, 22), + (ppi23, Ppi23, 23), + (ppi24, Ppi24, 24), + (ppi25, Ppi25, 25), + (ppi26, Ppi26, 26), + (ppi27, Ppi27, 27), + (ppi28, Ppi28, 28), + (ppi29, Ppi29, 29), + (ppi30, Ppi30, 30), + (ppi31, Ppi31, 31), + ], +); diff --git a/nrf-hal-common/src/ppi/task_nrf51.rs b/nrf-hal-common/src/ppi/task_nrf51.rs new file mode 100644 index 00000000..ebd2c131 --- /dev/null +++ b/nrf-hal-common/src/ppi/task_nrf51.rs @@ -0,0 +1,71 @@ +use crate::ppi::Task; + +// Task Impls +// +// To reproduce, in the pac crate, search +// `rg 'type TASKS_.*crate::Reg' --type rust` +// Find (regex): +// `^src/(.*)\.rs:pub type (.*) = .*$` +// Replace (regex): +// `impl Task for crate::target::$1::$2 { }` +impl Task for crate::target::rng::TASKS_START {} +impl Task for crate::target::rng::TASKS_STOP {} +impl Task for crate::target::timer0::TASKS_START {} +impl Task for crate::target::timer0::TASKS_STOP {} +impl Task for crate::target::timer0::TASKS_COUNT {} +impl Task for crate::target::timer0::TASKS_CLEAR {} +impl Task for crate::target::timer0::TASKS_SHUTDOWN {} +impl Task for crate::target::timer0::TASKS_CAPTURE {} +impl Task for crate::target::uart0::TASKS_STARTRX {} +impl Task for crate::target::uart0::TASKS_STOPRX {} +impl Task for crate::target::uart0::TASKS_STARTTX {} +impl Task for crate::target::uart0::TASKS_STOPTX {} +impl Task for crate::target::uart0::TASKS_SUSPEND {} +impl Task for crate::target::gpiote::TASKS_OUT {} +impl Task for crate::target::clock::TASKS_HFCLKSTART {} +impl Task for crate::target::clock::TASKS_HFCLKSTOP {} +impl Task for crate::target::clock::TASKS_LFCLKSTART {} +impl Task for crate::target::clock::TASKS_LFCLKSTOP {} +impl Task for crate::target::clock::TASKS_CAL {} +impl Task for crate::target::clock::TASKS_CTSTART {} +impl Task for crate::target::clock::TASKS_CTSTOP {} +impl Task for crate::target::power::TASKS_CONSTLAT {} +impl Task for crate::target::power::TASKS_LOWPWR {} +impl Task for crate::target::twi0::TASKS_STARTRX {} +impl Task for crate::target::twi0::TASKS_STARTTX {} +impl Task for crate::target::twi0::TASKS_STOP {} +impl Task for crate::target::twi0::TASKS_SUSPEND {} +impl Task for crate::target::twi0::TASKS_RESUME {} +impl Task for crate::target::ecb::TASKS_STARTECB {} +impl Task for crate::target::ecb::TASKS_STOPECB {} +impl Task for crate::target::wdt::TASKS_START {} +impl Task for crate::target::spis1::TASKS_ACQUIRE {} +impl Task for crate::target::spis1::TASKS_RELEASE {} +impl Task for crate::target::rtc0::TASKS_START {} +impl Task for crate::target::rtc0::TASKS_STOP {} +impl Task for crate::target::rtc0::TASKS_CLEAR {} +impl Task for crate::target::rtc0::TASKS_TRIGOVRFLW {} +impl Task for crate::target::lpcomp::TASKS_START {} +impl Task for crate::target::lpcomp::TASKS_STOP {} +impl Task for crate::target::lpcomp::TASKS_SAMPLE {} +impl Task for crate::target::radio::TASKS_TXEN {} +impl Task for crate::target::radio::TASKS_RXEN {} +impl Task for crate::target::radio::TASKS_START {} +impl Task for crate::target::radio::TASKS_STOP {} +impl Task for crate::target::radio::TASKS_DISABLE {} +impl Task for crate::target::radio::TASKS_RSSISTART {} +impl Task for crate::target::radio::TASKS_RSSISTOP {} +impl Task for crate::target::radio::TASKS_BCSTART {} +impl Task for crate::target::radio::TASKS_BCSTOP {} +impl Task for crate::target::temp::TASKS_START {} +impl Task for crate::target::temp::TASKS_STOP {} +impl Task for crate::target::ccm::TASKS_KSGEN {} +impl Task for crate::target::ccm::TASKS_CRYPT {} +impl Task for crate::target::ccm::TASKS_STOP {} +impl Task for crate::target::adc::TASKS_START {} +impl Task for crate::target::adc::TASKS_STOP {} +impl Task for crate::target::aar::TASKS_START {} +impl Task for crate::target::aar::TASKS_STOP {} +impl Task for crate::target::qdec::TASKS_START {} +impl Task for crate::target::qdec::TASKS_STOP {} +impl Task for crate::target::qdec::TASKS_READCLRACC {} diff --git a/nrf-hal-common/src/ppi/task_nrf52810.rs b/nrf-hal-common/src/ppi/task_nrf52810.rs new file mode 100644 index 00000000..c70dca7b --- /dev/null +++ b/nrf-hal-common/src/ppi/task_nrf52810.rs @@ -0,0 +1,103 @@ +use crate::ppi::Task; + +// Task Impls +// +// To reproduce, in the pac crate, search +// `rg 'type TASKS_.*crate::Reg' --type rust` +// Find (regex): +// `^src/(.*)\.rs:pub type (.*) = .*$` +// Replace (regex): +// `impl Task for crate::target::$1::$2 { }` +impl Task for crate::target::spim0::TASKS_START {} +impl Task for crate::target::spim0::TASKS_STOP {} +impl Task for crate::target::spim0::TASKS_SUSPEND {} +impl Task for crate::target::spim0::TASKS_RESUME {} +impl Task for crate::target::rng::TASKS_START {} +impl Task for crate::target::rng::TASKS_STOP {} +impl Task for crate::target::timer0::TASKS_START {} +impl Task for crate::target::timer0::TASKS_STOP {} +impl Task for crate::target::timer0::TASKS_COUNT {} +impl Task for crate::target::timer0::TASKS_CLEAR {} +impl Task for crate::target::timer0::TASKS_SHUTDOWN {} +impl Task for crate::target::timer0::TASKS_CAPTURE {} +impl Task for crate::target::spis0::TASKS_ACQUIRE {} +impl Task for crate::target::spis0::TASKS_RELEASE {} +impl Task for crate::target::uart0::TASKS_STARTRX {} +impl Task for crate::target::uart0::TASKS_STOPRX {} +impl Task for crate::target::uart0::TASKS_STARTTX {} +impl Task for crate::target::uart0::TASKS_STOPTX {} +impl Task for crate::target::uart0::TASKS_SUSPEND {} +impl Task for crate::target::gpiote::TASKS_OUT {} +impl Task for crate::target::gpiote::TASKS_SET {} +impl Task for crate::target::gpiote::TASKS_CLR {} +impl Task for crate::target::clock::TASKS_HFCLKSTART {} +impl Task for crate::target::clock::TASKS_HFCLKSTOP {} +impl Task for crate::target::clock::TASKS_LFCLKSTART {} +impl Task for crate::target::clock::TASKS_LFCLKSTOP {} +impl Task for crate::target::clock::TASKS_CAL {} +impl Task for crate::target::clock::TASKS_CTSTART {} +impl Task for crate::target::clock::TASKS_CTSTOP {} +impl Task for crate::target::power::TASKS_CONSTLAT {} +impl Task for crate::target::power::TASKS_LOWPWR {} +impl Task for crate::target::egu0::TASKS_TRIGGER {} +impl Task for crate::target::twim0::TASKS_STARTRX {} +impl Task for crate::target::twim0::TASKS_STARTTX {} +impl Task for crate::target::twim0::TASKS_STOP {} +impl Task for crate::target::twim0::TASKS_SUSPEND {} +impl Task for crate::target::twim0::TASKS_RESUME {} +impl Task for crate::target::pdm::TASKS_START {} +impl Task for crate::target::pdm::TASKS_STOP {} +impl Task for crate::target::ecb::TASKS_STARTECB {} +impl Task for crate::target::ecb::TASKS_STOPECB {} +impl Task for crate::target::twi0::TASKS_STARTRX {} +impl Task for crate::target::twi0::TASKS_STARTTX {} +impl Task for crate::target::twi0::TASKS_STOP {} +impl Task for crate::target::twi0::TASKS_SUSPEND {} +impl Task for crate::target::twi0::TASKS_RESUME {} +impl Task for crate::target::wdt::TASKS_START {} +impl Task for crate::target::rtc0::TASKS_START {} +impl Task for crate::target::rtc0::TASKS_STOP {} +impl Task for crate::target::rtc0::TASKS_CLEAR {} +impl Task for crate::target::rtc0::TASKS_TRIGOVRFLW {} +impl Task for crate::target::radio::TASKS_TXEN {} +impl Task for crate::target::radio::TASKS_RXEN {} +impl Task for crate::target::radio::TASKS_START {} +impl Task for crate::target::radio::TASKS_STOP {} +impl Task for crate::target::radio::TASKS_DISABLE {} +impl Task for crate::target::radio::TASKS_RSSISTART {} +impl Task for crate::target::radio::TASKS_RSSISTOP {} +impl Task for crate::target::radio::TASKS_BCSTART {} +impl Task for crate::target::radio::TASKS_BCSTOP {} +impl Task for crate::target::temp::TASKS_START {} +impl Task for crate::target::temp::TASKS_STOP {} +impl Task for crate::target::ccm::TASKS_KSGEN {} +impl Task for crate::target::ccm::TASKS_CRYPT {} +impl Task for crate::target::ccm::TASKS_STOP {} +impl Task for crate::target::ccm::TASKS_RATEOVERRIDE {} +impl Task for crate::target::uarte0::TASKS_STARTRX {} +impl Task for crate::target::uarte0::TASKS_STOPRX {} +impl Task for crate::target::uarte0::TASKS_STARTTX {} +impl Task for crate::target::uarte0::TASKS_STOPTX {} +impl Task for crate::target::uarte0::TASKS_FLUSHRX {} +impl Task for crate::target::twis0::TASKS_STOP {} +impl Task for crate::target::twis0::TASKS_SUSPEND {} +impl Task for crate::target::twis0::TASKS_RESUME {} +impl Task for crate::target::twis0::TASKS_PREPARERX {} +impl Task for crate::target::twis0::TASKS_PREPARETX {} +impl Task for crate::target::aar::TASKS_START {} +impl Task for crate::target::aar::TASKS_STOP {} +impl Task for crate::target::comp::TASKS_START {} +impl Task for crate::target::comp::TASKS_STOP {} +impl Task for crate::target::comp::TASKS_SAMPLE {} +impl Task for crate::target::qdec::TASKS_START {} +impl Task for crate::target::qdec::TASKS_STOP {} +impl Task for crate::target::qdec::TASKS_READCLRACC {} +impl Task for crate::target::qdec::TASKS_RDCLRACC {} +impl Task for crate::target::qdec::TASKS_RDCLRDBL {} +impl Task for crate::target::saadc::TASKS_START {} +impl Task for crate::target::saadc::TASKS_SAMPLE {} +impl Task for crate::target::saadc::TASKS_STOP {} +impl Task for crate::target::saadc::TASKS_CALIBRATEOFFSET {} +impl Task for crate::target::pwm0::TASKS_STOP {} +impl Task for crate::target::pwm0::TASKS_SEQSTART {} +impl Task for crate::target::pwm0::TASKS_NEXTSTEP {} diff --git a/nrf-hal-common/src/ppi/task_nrf52832.rs b/nrf-hal-common/src/ppi/task_nrf52832.rs new file mode 100644 index 00000000..8406d111 --- /dev/null +++ b/nrf-hal-common/src/ppi/task_nrf52832.rs @@ -0,0 +1,120 @@ +use crate::ppi::Task; + +// Task Impls +// +// To reproduce, in the pac crate, search +// `rg 'type TASKS_.*crate::Reg' --type rust` +// Find (regex): +// `^src/(.*)\.rs:pub type (.*) = .*$` +// Replace (regex): +// `impl Task for crate::target::$1::$2 { }` +impl Task for crate::target::nfct::TASKS_ACTIVATE {} +impl Task for crate::target::nfct::TASKS_DISABLE {} +impl Task for crate::target::nfct::TASKS_SENSE {} +impl Task for crate::target::nfct::TASKS_STARTTX {} +impl Task for crate::target::nfct::TASKS_ENABLERXDATA {} +impl Task for crate::target::nfct::TASKS_GOIDLE {} +impl Task for crate::target::nfct::TASKS_GOSLEEP {} +impl Task for crate::target::rng::TASKS_START {} +impl Task for crate::target::rng::TASKS_STOP {} +impl Task for crate::target::timer0::TASKS_START {} +impl Task for crate::target::timer0::TASKS_STOP {} +impl Task for crate::target::timer0::TASKS_COUNT {} +impl Task for crate::target::timer0::TASKS_CLEAR {} +impl Task for crate::target::timer0::TASKS_SHUTDOWN {} +impl Task for crate::target::timer0::TASKS_CAPTURE {} +impl Task for crate::target::spis0::TASKS_ACQUIRE {} +impl Task for crate::target::spis0::TASKS_RELEASE {} +impl Task for crate::target::uart0::TASKS_STARTRX {} +impl Task for crate::target::uart0::TASKS_STOPRX {} +impl Task for crate::target::uart0::TASKS_STARTTX {} +impl Task for crate::target::uart0::TASKS_STOPTX {} +impl Task for crate::target::uart0::TASKS_SUSPEND {} +impl Task for crate::target::gpiote::TASKS_OUT {} +impl Task for crate::target::gpiote::TASKS_SET {} +impl Task for crate::target::gpiote::TASKS_CLR {} +impl Task for crate::target::clock::TASKS_HFCLKSTART {} +impl Task for crate::target::clock::TASKS_HFCLKSTOP {} +impl Task for crate::target::clock::TASKS_LFCLKSTART {} +impl Task for crate::target::clock::TASKS_LFCLKSTOP {} +impl Task for crate::target::clock::TASKS_CAL {} +impl Task for crate::target::clock::TASKS_CTSTART {} +impl Task for crate::target::clock::TASKS_CTSTOP {} +impl Task for crate::target::spim0::TASKS_START {} +impl Task for crate::target::spim0::TASKS_STOP {} +impl Task for crate::target::spim0::TASKS_SUSPEND {} +impl Task for crate::target::spim0::TASKS_RESUME {} +impl Task for crate::target::power::TASKS_CONSTLAT {} +impl Task for crate::target::power::TASKS_LOWPWR {} +impl Task for crate::target::twim0::TASKS_STARTRX {} +impl Task for crate::target::twim0::TASKS_STARTTX {} +impl Task for crate::target::twim0::TASKS_STOP {} +impl Task for crate::target::twim0::TASKS_SUSPEND {} +impl Task for crate::target::twim0::TASKS_RESUME {} +impl Task for crate::target::twi0::TASKS_STARTRX {} +impl Task for crate::target::twi0::TASKS_STARTTX {} +impl Task for crate::target::twi0::TASKS_STOP {} +impl Task for crate::target::twi0::TASKS_SUSPEND {} +impl Task for crate::target::twi0::TASKS_RESUME {} +impl Task for crate::target::egu0::TASKS_TRIGGER {} +impl Task for crate::target::ecb::TASKS_STARTECB {} +impl Task for crate::target::ecb::TASKS_STOPECB {} +impl Task for crate::target::wdt::TASKS_START {} +impl Task for crate::target::pdm::TASKS_START {} +impl Task for crate::target::pdm::TASKS_STOP {} +impl Task for crate::target::rtc0::TASKS_START {} +impl Task for crate::target::rtc0::TASKS_STOP {} +impl Task for crate::target::rtc0::TASKS_CLEAR {} +impl Task for crate::target::rtc0::TASKS_TRIGOVRFLW {} +impl Task for crate::target::lpcomp::TASKS_START {} +impl Task for crate::target::lpcomp::TASKS_STOP {} +impl Task for crate::target::lpcomp::TASKS_SAMPLE {} +impl Task for crate::target::radio::TASKS_TXEN {} +impl Task for crate::target::radio::TASKS_RXEN {} +impl Task for crate::target::radio::TASKS_START {} +impl Task for crate::target::radio::TASKS_STOP {} +impl Task for crate::target::radio::TASKS_DISABLE {} +impl Task for crate::target::radio::TASKS_RSSISTART {} +impl Task for crate::target::radio::TASKS_RSSISTOP {} +impl Task for crate::target::radio::TASKS_BCSTART {} +impl Task for crate::target::radio::TASKS_BCSTOP {} +impl Task for crate::target::temp::TASKS_START {} +impl Task for crate::target::temp::TASKS_STOP {} +impl Task for crate::target::ccm::TASKS_KSGEN {} +impl Task for crate::target::ccm::TASKS_CRYPT {} +impl Task for crate::target::ccm::TASKS_STOP {} +impl Task for crate::target::uarte0::TASKS_STARTRX {} +impl Task for crate::target::uarte0::TASKS_STOPRX {} +impl Task for crate::target::uarte0::TASKS_STARTTX {} +impl Task for crate::target::uarte0::TASKS_STOPTX {} +impl Task for crate::target::uarte0::TASKS_FLUSHRX {} +impl Task for crate::target::i2s::TASKS_START {} +impl Task for crate::target::i2s::TASKS_STOP {} +impl Task for crate::target::twis0::TASKS_STOP {} +impl Task for crate::target::twis0::TASKS_SUSPEND {} +impl Task for crate::target::twis0::TASKS_RESUME {} +impl Task for crate::target::twis0::TASKS_PREPARERX {} +impl Task for crate::target::twis0::TASKS_PREPARETX {} +impl Task for crate::target::timer3::TASKS_START {} +impl Task for crate::target::timer3::TASKS_STOP {} +impl Task for crate::target::timer3::TASKS_COUNT {} +impl Task for crate::target::timer3::TASKS_CLEAR {} +impl Task for crate::target::timer3::TASKS_SHUTDOWN {} +impl Task for crate::target::timer3::TASKS_CAPTURE {} +impl Task for crate::target::qdec::TASKS_START {} +impl Task for crate::target::qdec::TASKS_STOP {} +impl Task for crate::target::qdec::TASKS_READCLRACC {} +impl Task for crate::target::qdec::TASKS_RDCLRACC {} +impl Task for crate::target::qdec::TASKS_RDCLRDBL {} +impl Task for crate::target::aar::TASKS_START {} +impl Task for crate::target::aar::TASKS_STOP {} +impl Task for crate::target::comp::TASKS_START {} +impl Task for crate::target::comp::TASKS_STOP {} +impl Task for crate::target::comp::TASKS_SAMPLE {} +impl Task for crate::target::saadc::TASKS_START {} +impl Task for crate::target::saadc::TASKS_SAMPLE {} +impl Task for crate::target::saadc::TASKS_STOP {} +impl Task for crate::target::saadc::TASKS_CALIBRATEOFFSET {} +impl Task for crate::target::pwm0::TASKS_STOP {} +impl Task for crate::target::pwm0::TASKS_SEQSTART {} +impl Task for crate::target::pwm0::TASKS_NEXTSTEP {} diff --git a/nrf-hal-common/src/ppi/task_nrf52833.rs b/nrf-hal-common/src/ppi/task_nrf52833.rs new file mode 100644 index 00000000..2c8f40d1 --- /dev/null +++ b/nrf-hal-common/src/ppi/task_nrf52833.rs @@ -0,0 +1,128 @@ +use crate::ppi::Task; + +// Task Impls +// +// To reproduce, in the pac crate, search +// `rg 'type TASKS_.*crate::Reg' --type rust` +// Find (regex): +// `^src/(.*)\.rs:pub type (.*) = .*$` +// Replace (regex): +// `impl Task for crate::target::$1::$2 { }` +impl Task for crate::target::rng::TASKS_START {} +impl Task for crate::target::rng::TASKS_STOP {} +impl Task for crate::target::timer0::TASKS_START {} +impl Task for crate::target::timer0::TASKS_STOP {} +impl Task for crate::target::timer0::TASKS_COUNT {} +impl Task for crate::target::timer0::TASKS_CLEAR {} +impl Task for crate::target::timer0::TASKS_SHUTDOWN {} +impl Task for crate::target::timer0::TASKS_CAPTURE {} +impl Task for crate::target::uart0::TASKS_STARTRX {} +impl Task for crate::target::uart0::TASKS_STOPRX {} +impl Task for crate::target::uart0::TASKS_STARTTX {} +impl Task for crate::target::uart0::TASKS_STOPTX {} +impl Task for crate::target::uart0::TASKS_SUSPEND {} +impl Task for crate::target::spis0::TASKS_ACQUIRE {} +impl Task for crate::target::spis0::TASKS_RELEASE {} +impl Task for crate::target::gpiote::TASKS_OUT {} +impl Task for crate::target::gpiote::TASKS_SET {} +impl Task for crate::target::gpiote::TASKS_CLR {} +impl Task for crate::target::clock::TASKS_HFCLKSTART {} +impl Task for crate::target::clock::TASKS_HFCLKSTOP {} +impl Task for crate::target::clock::TASKS_LFCLKSTART {} +impl Task for crate::target::clock::TASKS_LFCLKSTOP {} +impl Task for crate::target::clock::TASKS_CAL {} +impl Task for crate::target::clock::TASKS_CTSTART {} +impl Task for crate::target::clock::TASKS_CTSTOP {} +impl Task for crate::target::spim0::TASKS_START {} +impl Task for crate::target::spim0::TASKS_STOP {} +impl Task for crate::target::spim0::TASKS_SUSPEND {} +impl Task for crate::target::spim0::TASKS_RESUME {} +impl Task for crate::target::power::TASKS_CONSTLAT {} +impl Task for crate::target::power::TASKS_LOWPWR {} +impl Task for crate::target::egu0::TASKS_TRIGGER {} +impl Task for crate::target::twim0::TASKS_STARTRX {} +impl Task for crate::target::twim0::TASKS_STARTTX {} +impl Task for crate::target::twim0::TASKS_STOP {} +impl Task for crate::target::twim0::TASKS_SUSPEND {} +impl Task for crate::target::twim0::TASKS_RESUME {} +impl Task for crate::target::twi0::TASKS_STARTRX {} +impl Task for crate::target::twi0::TASKS_STARTTX {} +impl Task for crate::target::twi0::TASKS_STOP {} +impl Task for crate::target::twi0::TASKS_SUSPEND {} +impl Task for crate::target::twi0::TASKS_RESUME {} +impl Task for crate::target::ecb::TASKS_STARTECB {} +impl Task for crate::target::ecb::TASKS_STOPECB {} +impl Task for crate::target::wdt::TASKS_START {} +impl Task for crate::target::rtc0::TASKS_START {} +impl Task for crate::target::rtc0::TASKS_STOP {} +impl Task for crate::target::rtc0::TASKS_CLEAR {} +impl Task for crate::target::rtc0::TASKS_TRIGOVRFLW {} +impl Task for crate::target::pdm::TASKS_START {} +impl Task for crate::target::pdm::TASKS_STOP {} +impl Task for crate::target::lpcomp::TASKS_START {} +impl Task for crate::target::lpcomp::TASKS_STOP {} +impl Task for crate::target::lpcomp::TASKS_SAMPLE {} +impl Task for crate::target::radio::TASKS_TXEN {} +impl Task for crate::target::radio::TASKS_RXEN {} +impl Task for crate::target::radio::TASKS_START {} +impl Task for crate::target::radio::TASKS_STOP {} +impl Task for crate::target::radio::TASKS_DISABLE {} +impl Task for crate::target::radio::TASKS_RSSISTART {} +impl Task for crate::target::radio::TASKS_RSSISTOP {} +impl Task for crate::target::radio::TASKS_BCSTART {} +impl Task for crate::target::radio::TASKS_BCSTOP {} +impl Task for crate::target::radio::TASKS_EDSTART {} +impl Task for crate::target::radio::TASKS_EDSTOP {} +impl Task for crate::target::radio::TASKS_CCASTART {} +impl Task for crate::target::radio::TASKS_CCASTOP {} +impl Task for crate::target::temp::TASKS_START {} +impl Task for crate::target::temp::TASKS_STOP {} +impl Task for crate::target::ccm::TASKS_KSGEN {} +impl Task for crate::target::ccm::TASKS_CRYPT {} +impl Task for crate::target::ccm::TASKS_STOP {} +impl Task for crate::target::ccm::TASKS_RATEOVERRIDE {} +impl Task for crate::target::uarte0::TASKS_STARTRX {} +impl Task for crate::target::uarte0::TASKS_STOPRX {} +impl Task for crate::target::uarte0::TASKS_STARTTX {} +impl Task for crate::target::uarte0::TASKS_STOPTX {} +impl Task for crate::target::uarte0::TASKS_FLUSHRX {} +impl Task for crate::target::i2s::TASKS_START {} +impl Task for crate::target::i2s::TASKS_STOP {} +impl Task for crate::target::twis0::TASKS_STOP {} +impl Task for crate::target::twis0::TASKS_SUSPEND {} +impl Task for crate::target::twis0::TASKS_RESUME {} +impl Task for crate::target::twis0::TASKS_PREPARERX {} +impl Task for crate::target::twis0::TASKS_PREPARETX {} +impl Task for crate::target::qdec::TASKS_START {} +impl Task for crate::target::qdec::TASKS_STOP {} +impl Task for crate::target::qdec::TASKS_READCLRACC {} +impl Task for crate::target::qdec::TASKS_RDCLRACC {} +impl Task for crate::target::qdec::TASKS_RDCLRDBL {} +impl Task for crate::target::aar::TASKS_START {} +impl Task for crate::target::aar::TASKS_STOP {} +impl Task for crate::target::comp::TASKS_START {} +impl Task for crate::target::comp::TASKS_STOP {} +impl Task for crate::target::comp::TASKS_SAMPLE {} +impl Task for crate::target::usbd::TASKS_STARTEPIN {} +impl Task for crate::target::usbd::TASKS_STARTISOIN {} +impl Task for crate::target::usbd::TASKS_STARTEPOUT {} +impl Task for crate::target::usbd::TASKS_STARTISOOUT {} +impl Task for crate::target::usbd::TASKS_EP0RCVOUT {} +impl Task for crate::target::usbd::TASKS_EP0STATUS {} +impl Task for crate::target::usbd::TASKS_EP0STALL {} +impl Task for crate::target::usbd::TASKS_DPDMDRIVE {} +impl Task for crate::target::usbd::TASKS_DPDMNODRIVE {} +impl Task for crate::target::saadc::TASKS_START {} +impl Task for crate::target::saadc::TASKS_SAMPLE {} +impl Task for crate::target::saadc::TASKS_STOP {} +impl Task for crate::target::saadc::TASKS_CALIBRATEOFFSET {} +impl Task for crate::target::pwm0::TASKS_STOP {} +impl Task for crate::target::pwm0::TASKS_SEQSTART {} +impl Task for crate::target::pwm0::TASKS_NEXTSTEP {} +impl Task for crate::target::nfct::TASKS_ACTIVATE {} +impl Task for crate::target::nfct::TASKS_DISABLE {} +impl Task for crate::target::nfct::TASKS_SENSE {} +impl Task for crate::target::nfct::TASKS_STARTTX {} +impl Task for crate::target::nfct::TASKS_ENABLERXDATA {} +impl Task for crate::target::nfct::TASKS_GOIDLE {} +impl Task for crate::target::nfct::TASKS_GOSLEEP {} diff --git a/nrf-hal-common/src/ppi/task_nrf52840.rs b/nrf-hal-common/src/ppi/task_nrf52840.rs new file mode 100644 index 00000000..24eb7a09 --- /dev/null +++ b/nrf-hal-common/src/ppi/task_nrf52840.rs @@ -0,0 +1,139 @@ +use crate::ppi::Task; + +// Task Impls +// +// To reproduce, in the pac crate, search +// `rg 'type TASKS_.*crate::Reg' --type rust` +// Find (regex): +// `^src/(.*)\.rs:pub type (.*) = .*$` +// Replace (regex): +// `impl Task for crate::target::$1::$2 { }` +impl Task for crate::target::radio::TASKS_TXEN {} +impl Task for crate::target::radio::TASKS_RXEN {} +impl Task for crate::target::radio::TASKS_START {} +impl Task for crate::target::radio::TASKS_STOP {} +impl Task for crate::target::radio::TASKS_DISABLE {} +impl Task for crate::target::radio::TASKS_RSSISTART {} +impl Task for crate::target::radio::TASKS_RSSISTOP {} +impl Task for crate::target::radio::TASKS_BCSTART {} +impl Task for crate::target::radio::TASKS_BCSTOP {} +impl Task for crate::target::radio::TASKS_EDSTART {} +impl Task for crate::target::radio::TASKS_EDSTOP {} +impl Task for crate::target::radio::TASKS_CCASTART {} +impl Task for crate::target::radio::TASKS_CCASTOP {} +impl Task for crate::target::rng::TASKS_START {} +impl Task for crate::target::rng::TASKS_STOP {} +impl Task for crate::target::timer0::TASKS_START {} +impl Task for crate::target::timer0::TASKS_STOP {} +impl Task for crate::target::timer0::TASKS_COUNT {} +impl Task for crate::target::timer0::TASKS_CLEAR {} +impl Task for crate::target::timer0::TASKS_SHUTDOWN {} +impl Task for crate::target::timer0::TASKS_CAPTURE {} +impl Task for crate::target::uart0::TASKS_STARTRX {} +impl Task for crate::target::uart0::TASKS_STOPRX {} +impl Task for crate::target::uart0::TASKS_STARTTX {} +impl Task for crate::target::uart0::TASKS_STOPTX {} +impl Task for crate::target::uart0::TASKS_SUSPEND {} +impl Task for crate::target::spis0::TASKS_ACQUIRE {} +impl Task for crate::target::spis0::TASKS_RELEASE {} +impl Task for crate::target::gpiote::TASKS_OUT {} +impl Task for crate::target::gpiote::TASKS_SET {} +impl Task for crate::target::gpiote::TASKS_CLR {} +impl Task for crate::target::clock::TASKS_HFCLKSTART {} +impl Task for crate::target::clock::TASKS_HFCLKSTOP {} +impl Task for crate::target::clock::TASKS_LFCLKSTART {} +impl Task for crate::target::clock::TASKS_LFCLKSTOP {} +impl Task for crate::target::clock::TASKS_CAL {} +impl Task for crate::target::clock::TASKS_CTSTART {} +impl Task for crate::target::clock::TASKS_CTSTOP {} +impl Task for crate::target::spim0::TASKS_START {} +impl Task for crate::target::spim0::TASKS_STOP {} +impl Task for crate::target::spim0::TASKS_SUSPEND {} +impl Task for crate::target::spim0::TASKS_RESUME {} +impl Task for crate::target::power::TASKS_CONSTLAT {} +impl Task for crate::target::power::TASKS_LOWPWR {} +impl Task for crate::target::egu0::TASKS_TRIGGER {} +impl Task for crate::target::wdt::TASKS_START {} +impl Task for crate::target::pdm::TASKS_START {} +impl Task for crate::target::pdm::TASKS_STOP {} +impl Task for crate::target::ecb::TASKS_STARTECB {} +impl Task for crate::target::ecb::TASKS_STOPECB {} +impl Task for crate::target::twi0::TASKS_STARTRX {} +impl Task for crate::target::twi0::TASKS_STARTTX {} +impl Task for crate::target::twi0::TASKS_STOP {} +impl Task for crate::target::twi0::TASKS_SUSPEND {} +impl Task for crate::target::twi0::TASKS_RESUME {} +impl Task for crate::target::twim0::TASKS_STARTRX {} +impl Task for crate::target::twim0::TASKS_STARTTX {} +impl Task for crate::target::twim0::TASKS_STOP {} +impl Task for crate::target::twim0::TASKS_SUSPEND {} +impl Task for crate::target::twim0::TASKS_RESUME {} +impl Task for crate::target::rtc0::TASKS_START {} +impl Task for crate::target::rtc0::TASKS_STOP {} +impl Task for crate::target::rtc0::TASKS_CLEAR {} +impl Task for crate::target::rtc0::TASKS_TRIGOVRFLW {} +impl Task for crate::target::lpcomp::TASKS_START {} +impl Task for crate::target::lpcomp::TASKS_STOP {} +impl Task for crate::target::lpcomp::TASKS_SAMPLE {} +impl Task for crate::target::temp::TASKS_START {} +impl Task for crate::target::temp::TASKS_STOP {} +impl Task for crate::target::ccm::TASKS_KSGEN {} +impl Task for crate::target::ccm::TASKS_CRYPT {} +impl Task for crate::target::ccm::TASKS_STOP {} +impl Task for crate::target::ccm::TASKS_RATEOVERRIDE {} +impl Task for crate::target::i2s::TASKS_START {} +impl Task for crate::target::i2s::TASKS_STOP {} +impl Task for crate::target::uarte0::TASKS_STARTRX {} +impl Task for crate::target::uarte0::TASKS_STOPRX {} +impl Task for crate::target::uarte0::TASKS_STARTTX {} +impl Task for crate::target::uarte0::TASKS_STOPTX {} +impl Task for crate::target::uarte0::TASKS_FLUSHRX {} +impl Task for crate::target::twis0::TASKS_STOP {} +impl Task for crate::target::twis0::TASKS_SUSPEND {} +impl Task for crate::target::twis0::TASKS_RESUME {} +impl Task for crate::target::twis0::TASKS_PREPARERX {} +impl Task for crate::target::twis0::TASKS_PREPARETX {} +impl Task for crate::target::timer3::TASKS_START {} +impl Task for crate::target::timer3::TASKS_STOP {} +impl Task for crate::target::timer3::TASKS_COUNT {} +impl Task for crate::target::timer3::TASKS_CLEAR {} +impl Task for crate::target::timer3::TASKS_SHUTDOWN {} +impl Task for crate::target::timer3::TASKS_CAPTURE {} +impl Task for crate::target::aar::TASKS_START {} +impl Task for crate::target::aar::TASKS_STOP {} +impl Task for crate::target::comp::TASKS_START {} +impl Task for crate::target::comp::TASKS_STOP {} +impl Task for crate::target::comp::TASKS_SAMPLE {} +impl Task for crate::target::saadc::TASKS_START {} +impl Task for crate::target::saadc::TASKS_SAMPLE {} +impl Task for crate::target::saadc::TASKS_STOP {} +impl Task for crate::target::saadc::TASKS_CALIBRATEOFFSET {} +impl Task for crate::target::qspi::TASKS_ACTIVATE {} +impl Task for crate::target::qspi::TASKS_READSTART {} +impl Task for crate::target::qspi::TASKS_WRITESTART {} +impl Task for crate::target::qspi::TASKS_ERASESTART {} +impl Task for crate::target::qspi::TASKS_DEACTIVATE {} +impl Task for crate::target::usbd::TASKS_STARTEPIN {} +impl Task for crate::target::usbd::TASKS_STARTISOIN {} +impl Task for crate::target::usbd::TASKS_STARTEPOUT {} +impl Task for crate::target::usbd::TASKS_STARTISOOUT {} +impl Task for crate::target::usbd::TASKS_EP0RCVOUT {} +impl Task for crate::target::usbd::TASKS_EP0STATUS {} +impl Task for crate::target::usbd::TASKS_EP0STALL {} +impl Task for crate::target::usbd::TASKS_DPDMDRIVE {} +impl Task for crate::target::usbd::TASKS_DPDMNODRIVE {} +impl Task for crate::target::pwm0::TASKS_STOP {} +impl Task for crate::target::pwm0::TASKS_SEQSTART {} +impl Task for crate::target::pwm0::TASKS_NEXTSTEP {} +impl Task for crate::target::qdec::TASKS_START {} +impl Task for crate::target::qdec::TASKS_STOP {} +impl Task for crate::target::qdec::TASKS_READCLRACC {} +impl Task for crate::target::qdec::TASKS_RDCLRACC {} +impl Task for crate::target::qdec::TASKS_RDCLRDBL {} +impl Task for crate::target::nfct::TASKS_ACTIVATE {} +impl Task for crate::target::nfct::TASKS_DISABLE {} +impl Task for crate::target::nfct::TASKS_SENSE {} +impl Task for crate::target::nfct::TASKS_STARTTX {} +impl Task for crate::target::nfct::TASKS_ENABLERXDATA {} +impl Task for crate::target::nfct::TASKS_GOIDLE {} +impl Task for crate::target::nfct::TASKS_GOSLEEP {} diff --git a/scripts/build.sh b/scripts/build.sh index 06ff8739..dcdda8fe 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -47,5 +47,7 @@ echo Building examples/ecb-demo... cargo build --manifest-path examples/ecb-demo/Cargo.toml --features=52832 echo Building examples/ccm-demo... cargo build --manifest-path examples/ccm-demo/Cargo.toml --features=52832 +echo Building examples/ppi-demo... +cargo build --manifest-path examples/ppi-demo/Cargo.toml --features=52832 echo Checking source code formatting... cargo +stable fmt -- --check